public static int getClassIndex(Instances instances, TreeModel treeModel) {
        MiningSchema miningModel = treeModel.getMiningSchema();

        String className = null;
        for (MiningField miningField : miningModel.getMiningFields()) {
            if (miningField.getUsageType() == FieldUsageType.PREDICTED) {
                className = miningField.getName().getValue();
                break;
            }
        }

        return instances.attribute(className).index();
    }
public static int getClassIndex(Instances instances, TreeModel treeModel) {
        MiningSchema miningModel = treeModel.getMiningSchema();

        String className = null;
        for (MiningField miningField : miningModel.getMiningFields()) {
            if (miningField.getUsageType() == FieldUsageType.PREDICTED) {
                className = miningField.getName().getValue();
                break;
            }
        }

        return instances.attribute(className).index();
    }
public static int getClassIndex ( Instances instances , TreeModel treeModel ) { MiningSchema miningModel = treeModel . getMiningSchema ( ) ; String className = null ; for ( MiningField miningField : miningModel . getMiningFields ( ) ) { if ( miningField . getUsageType ( ) == FieldUsageType . PREDICTED ) { className = miningField . getName ( ) . getValue ( ) ; break ; } } return instances . attribute ( className ) . index ( ) ; }
Retrieves the index of the class attribute. This is the attribute to be predicted.

@param instances The {@link weka.core.Instances}.
@param treeModel The {@link org.dmg.pmml.TreeModel PMML TreeModel element}.
@return An int representing the index of the class attribute.
Retrieves the index of the class attribute . This is the attribute to be predicted .