Skip to content

Commit

Permalink
Updated JPMML-Python dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Jul 21, 2023
1 parent 6f5d7a4 commit 5006cdd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 138 deletions.
113 changes: 0 additions & 113 deletions pmml-statsmodels/src/main/java/org/jpmml/statsmodels/OrdinalLabel.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,26 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.google.common.collect.Iterables;
import org.dmg.pmml.DataField;
import org.dmg.pmml.DataType;
import org.dmg.pmml.DerivedField;
import org.dmg.pmml.MiningFunction;
import org.dmg.pmml.OpType;
import org.dmg.pmml.OutputField;
import org.dmg.pmml.mining.Segmentation;
import org.dmg.pmml.regression.RegressionModel;
import org.dmg.pmml.regression.RegressionTable;
import org.jpmml.converter.ContinuousFeature;
import org.jpmml.converter.Feature;
import org.jpmml.converter.Label;
import org.jpmml.converter.ModelEncoder;
import org.jpmml.converter.ModelUtil;
import org.jpmml.converter.OrdinalLabel;
import org.jpmml.converter.Schema;
import org.jpmml.converter.ValueUtil;
import org.jpmml.converter.mining.MiningModelUtil;
import org.jpmml.converter.regression.RegressionModelUtil;
import org.jpmml.statsmodels.OrdinalLabel;
import org.jpmml.statsmodels.StatsModelsEncoder;
import scipy.stats.RVContinuous;
import statsmodels.Model;
Expand Down Expand Up @@ -98,25 +95,7 @@ public org.dmg.pmml.Model encodeModel(List<? extends Number> params, Schema sche

Feature feature = new ContinuousFeature(encoder, linpredField);

List<RegressionTable> regressionTables = new ArrayList<>();

for(int i = 0; i < thresholds.size(); i++){
RegressionTable regressionTable = RegressionModelUtil.createRegressionTable(Collections.singletonList(feature), Collections.singletonList(-1d), thresholds.get(i))
.setTargetCategory(ordinalLabel.getValue(i));

regressionTables.add(regressionTable);
}

{
RegressionTable regressionTable = RegressionModelUtil.createRegressionTable(Collections.emptyList(), Collections.emptyList(), 1000d)
.setTargetCategory(ordinalLabel.getValue(kLevels - 1));

regressionTables.add(regressionTable);
}

RegressionModel secondRegressionModel = new RegressionModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(ordinalLabel), regressionTables)
.setNormalizationMethod(parseNormalizationMethod(distr))
.setOutput(ModelUtil.createProbabilityOutput(DataType.DOUBLE, ordinalLabel.toCategoricalLabel()));
RegressionModel secondRegressionModel = RegressionModelUtil.createOrdinalClassification(feature, thresholds, parseNormalizationMethod(distr), true, schema);

return MiningModelUtil.createModelChain(Arrays.asList(firstRegressionModel, secondRegressionModel), Segmentation.MissingPredictionTreatment.RETURN_MISSING);
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@
<dependency>
<groupId>org.jpmml</groupId>
<artifactId>pmml-python</artifactId>
<version>1.1.15</version>
<version>1.1.17</version>
</dependency>
<dependency>
<groupId>org.jpmml</groupId>
<artifactId>pmml-python-testing</artifactId>
<version>1.1.15</version>
<version>1.1.17</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 5006cdd

Please sign in to comment.