public static void addScoreDistribution(Node pmmlNode, double[] classDistribution, Instances instances) {
    """
	Adds a {@link org.dmg.pmml.ScoreDistribution PMML ScoreDistribution element} to the given {@link org.dmg.pmml.Node PMML Node}
	with the confidence from the given {@code classDistribution}.
	
	@param pmmlNode          The {@link org.dmg.pmml.Node PMML Node} to which add a {@link org.dmg.pmml.ScoreDistribution PMML ScoreDistribution element}.
	@param classDistribution The class distribution to calculate a score for.
	@param instances         The header {@link weka.core.Instances}.
    """
        if (classDistribution != null) {

            double sum = 0.0;
            for (int i = 0; i < classDistribution.length; i++) {
                sum += classDistribution[i];
            }

            for (int i = 0; i < classDistribution.length; i++) {
                String value = instances.classAttribute().value(i);
                double probability;

                if (sum != 0.0) {
                    probability = classDistribution[i]/sum;
                } else {
                    probability = 1.0/classDistribution.length;
                }

                ScoreDistribution scoreDistribution = new ScoreDistribution(value, 0);
                scoreDistribution.withConfidence(classDistribution[i]);
                scoreDistribution.withProbability(probability);
                pmmlNode.withScoreDistributions(scoreDistribution);
            }
        }
    }
public static void addScoreDistribution(Node pmmlNode, double[] classDistribution, Instances instances) {
        if (classDistribution != null) {

            double sum = 0.0;
            for (int i = 0; i < classDistribution.length; i++) {
                sum += classDistribution[i];
            }

            for (int i = 0; i < classDistribution.length; i++) {
                String value = instances.classAttribute().value(i);
                double probability;

                if (sum != 0.0) {
                    probability = classDistribution[i]/sum;
                } else {
                    probability = 1.0/classDistribution.length;
                }

                ScoreDistribution scoreDistribution = new ScoreDistribution(value, 0);
                scoreDistribution.withConfidence(classDistribution[i]);
                scoreDistribution.withProbability(probability);
                pmmlNode.withScoreDistributions(scoreDistribution);
            }
        }
    }
public static void addScoreDistribution ( Node pmmlNode , double [ ] classDistribution , Instances instances ) { if ( classDistribution != null ) { double sum = 0.0 ; for ( int i = 0 ; i < classDistribution . length ; i ++ ) { sum += classDistribution [ i ] ; } for ( int i = 0 ; i < classDistribution . length ; i ++ ) { String value = instances . classAttribute ( ) . value ( i ) ; double probability ; if ( sum != 0.0 ) { probability = classDistribution [ i ] / sum ; } else { probability = 1.0 / classDistribution . length ; } ScoreDistribution scoreDistribution = new ScoreDistribution ( value , 0 ) ; scoreDistribution . withConfidence ( classDistribution [ i ] ) ; scoreDistribution . withProbability ( probability ) ; pmmlNode . withScoreDistributions ( scoreDistribution ) ; } } }
Adds a {@link org.dmg.pmml.ScoreDistribution PMML ScoreDistribution element} to the given {@link org.dmg.pmml.Node PMML Node}
with the confidence from the given {@code classDistribution}.

@param pmmlNode          The {@link org.dmg.pmml.Node PMML Node} to which add a {@link org.dmg.pmml.ScoreDistribution PMML ScoreDistribution element}.
@param classDistribution The class distribution to calculate a score for.
@param instances         The header {@link weka.core.Instances}.
Adds a { @link org . dmg . pmml . ScoreDistribution PMML ScoreDistribution element } to the given { @link org . dmg . pmml . Node PMML Node } with the confidence from the given { @code classDistribution } .