Search in sources :

Example 6 with MiningModel

use of org.dmg.pmml.MiningModelDocument.MiningModel in project knime-core by knime.

the class ClassificationGBTModelExporter method addSegmentation.

private void addSegmentation(final MiningModel miningModel, final int c) {
    Segmentation seg = miningModel.addNewSegmentation();
    MultiClassGradientBoostedTreesModel gbt = getGBTModel();
    Collection<TreeModelRegression> trees = IntStream.range(0, gbt.getNrLevels()).mapToObj(i -> gbt.getModel(i, c)).collect(Collectors.toList());
    Collection<Map<TreeNodeSignature, Double>> coefficientMaps = IntStream.range(0, gbt.getNrLevels()).mapToObj(i -> gbt.getCoefficientMap(i, c)).collect(Collectors.toList());
    writeSumSegmentation(seg, trees, coefficientMaps);
}
Also used : IntStream(java.util.stream.IntStream) MININGFUNCTION(org.dmg.pmml.MININGFUNCTION) Enum(org.dmg.pmml.MININGFUNCTION.Enum) Targets(org.dmg.pmml.TargetsDocument.Targets) DATATYPE(org.dmg.pmml.DATATYPE) PMMLMiningSchemaTranslator(org.knime.core.node.port.pmml.PMMLMiningSchemaTranslator) RegressionTable(org.dmg.pmml.RegressionTableDocument.RegressionTable) Output(org.dmg.pmml.OutputDocument.Output) RESULTFEATURE(org.dmg.pmml.RESULTFEATURE) MiningSchema(org.dmg.pmml.MiningSchemaDocument.MiningSchema) Map(java.util.Map) Target(org.dmg.pmml.TargetDocument.Target) FIELDUSAGETYPE(org.dmg.pmml.FIELDUSAGETYPE) TreeNodeSignature(org.knime.base.node.mine.treeensemble2.model.TreeNodeSignature) Collection(java.util.Collection) Segmentation(org.dmg.pmml.SegmentationDocument.Segmentation) RegressionModel(org.dmg.pmml.RegressionModelDocument.RegressionModel) Collectors(java.util.stream.Collectors) MiningField(org.dmg.pmml.MiningFieldDocument.MiningField) OPTYPE(org.dmg.pmml.OPTYPE) MULTIPLEMODELMETHOD(org.dmg.pmml.MULTIPLEMODELMETHOD) NumericPredictor(org.dmg.pmml.NumericPredictorDocument.NumericPredictor) MultiClassGradientBoostedTreesModel(org.knime.base.node.mine.treeensemble2.model.MultiClassGradientBoostedTreesModel) REGRESSIONNORMALIZATIONMETHOD(org.dmg.pmml.REGRESSIONNORMALIZATIONMETHOD) DerivedFieldMapper(org.knime.core.node.port.pmml.preproc.DerivedFieldMapper) MiningModel(org.dmg.pmml.MiningModelDocument.MiningModel) Segment(org.dmg.pmml.SegmentDocument.Segment) OutputField(org.dmg.pmml.OutputFieldDocument.OutputField) TreeModelRegression(org.knime.base.node.mine.treeensemble2.model.TreeModelRegression) Segmentation(org.dmg.pmml.SegmentationDocument.Segmentation) MultiClassGradientBoostedTreesModel(org.knime.base.node.mine.treeensemble2.model.MultiClassGradientBoostedTreesModel) Map(java.util.Map) TreeModelRegression(org.knime.base.node.mine.treeensemble2.model.TreeModelRegression)

Aggregations

MiningModel (org.dmg.pmml.MiningModelDocument.MiningModel)6 PMML (org.dmg.pmml.PMMLDocument.PMML)3 RegressionModel (org.dmg.pmml.RegressionModelDocument.RegressionModel)3 AssociationModel (org.dmg.pmml.AssociationModelDocument.AssociationModel)2 ClusteringModel (org.dmg.pmml.ClusteringModelDocument.ClusteringModel)2 GeneralRegressionModel (org.dmg.pmml.GeneralRegressionModelDocument.GeneralRegressionModel)2 NaiveBayesModel (org.dmg.pmml.NaiveBayesModelDocument.NaiveBayesModel)2 NeuralNetwork (org.dmg.pmml.NeuralNetworkDocument.NeuralNetwork)2 RuleSetModel (org.dmg.pmml.RuleSetModelDocument.RuleSetModel)2 Segment (org.dmg.pmml.SegmentDocument.Segment)2 SequenceModel (org.dmg.pmml.SequenceModelDocument.SequenceModel)2 SupportVectorMachineModel (org.dmg.pmml.SupportVectorMachineModelDocument.SupportVectorMachineModel)2 TextModel (org.dmg.pmml.TextModelDocument.TextModel)2 TimeSeriesModel (org.dmg.pmml.TimeSeriesModelDocument.TimeSeriesModel)2 TreeModel (org.dmg.pmml.TreeModelDocument.TreeModel)2 Collection (java.util.Collection)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 DATATYPE (org.dmg.pmml.DATATYPE)1