@Override public ExampleSetMetaData applyEffects(ExampleSetMetaData emd, InputPort inputPort) { if (predictedLabelMetaData == null) { return emd; } List<AttributeMetaData> predictionAttributes = getPredictionAttributeMetaData(); if (predictionAttributes != null) { emd.addAllAttributes(predictionAttributes); emd.mergeSetRelation(getPredictionAttributeSetRelation()); } return emd; }
@Override public ModelMetaData clone() { ModelMetaData md = (ModelMetaData) super.clone(); if (trainingSetMetaData != null) { md.trainingSetMetaData = trainingSetMetaData.clone(); } return md; }
public PredictionModelMetaData( Class<? extends PredictionModel> modelClass, ExampleSetMetaData trainingSetMetaData) { super(modelClass, trainingSetMetaData); if (trainingSetMetaData != null) { AttributeMetaData labelAttributeMetaData = trainingSetMetaData.getLabelMetaData(); if (labelAttributeMetaData != null) { this.predictedLabelMetaData = labelAttributeMetaData.copy(); this.predictedLabelMetaData.setRole(Attributes.PREDICTION_NAME); this.predictedLabelMetaData.setName("prediction(" + predictedLabelMetaData.getName() + ")"); if (predictedLabelMetaData.isNumerical()) { this.predictedLabelMetaData.setValueSetRelation(SetRelation.SUPERSET); } this.predictedLabelMetaData.setMean(new MDReal()); // creating confidence attributes generatedPredictionAttributes.add(predictedLabelMetaData); if (predictedLabelMetaData.isNominal()) { if (predictedLabelMetaData.getValueSet().isEmpty()) { AttributeMetaData confidence = new AttributeMetaData( Attributes.CONFIDENCE_NAME + "(?)", Ontology.REAL, Attributes.CONFIDENCE_NAME + "_" + "?"); confidence.setValueRange(new Range(0, 1), SetRelation.SUBSET); generatedPredictionAttributes.add(confidence); predictedLabelMetaData.setValueSetRelation(SetRelation.SUPERSET); } else { for (String value : predictedLabelMetaData.getValueSet()) { AttributeMetaData confidence = new AttributeMetaData( Attributes.CONFIDENCE_NAME + "(" + value + ")", Ontology.REAL, Attributes.CONFIDENCE_NAME + "_" + value); confidence.setValueRange(new Range(0, 1), SetRelation.SUBSET); generatedPredictionAttributes.add(confidence); } } } } } }