.setMathContext(MathContext.FLOAT) .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.SUM, treeModels)) .setTargets(ModelUtil.createRescaleTargets(null, ValueUtil.floatToDouble(base_score), continuousLabel));
.setMathContext(MathContext.FLOAT) .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.SUM, treeModels)) .setTargets(ModelUtil.createRescaleTargets(null, ValueUtil.floatToDouble(base_score), continuousLabel));
static private MiningModel createMiningModel(List<TreeModel> treeModels, Double initF, Schema schema){ ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel(); MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel)) .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.SUM, treeModels)) .setTargets(ModelUtil.createRescaleTargets(null, initF, continuousLabel)); return miningModel; }
static protected MiningModel createMiningModel(List<RegressionTree> regTrees, float base_score, Schema schema){ ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel(); Schema segmentSchema = schema.toAnonymousSchema(); List<TreeModel> treeModels = new ArrayList<>(); for(RegressionTree regTree : regTrees){ TreeModel treeModel = regTree.encodeTreeModel(segmentSchema); treeModels.add(treeModel); } MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel)) .setMathContext(MathContext.FLOAT) .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.SUM, treeModels)) .setTargets(ModelUtil.createRescaleTargets(null, ValueUtil.floatToDouble(base_score), continuousLabel)); return miningModel; }
static protected MiningModel createMiningModel(List<RegressionTree> regTrees, float base_score, Schema schema){ ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel(); Schema segmentSchema = schema.toAnonymousSchema(); List<TreeModel> treeModels = new ArrayList<>(); for(RegressionTree regTree : regTrees){ TreeModel treeModel = regTree.encodeTreeModel(segmentSchema); treeModels.add(treeModel); } MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel)) .setMathContext(MathContext.FLOAT) .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.SUM, treeModels)) .setTargets(ModelUtil.createRescaleTargets(null, ValueUtil.floatToDouble(base_score), continuousLabel)); return miningModel; }
static public <E extends Estimator & HasEstimatorEnsemble<TreeRegressor> & HasTreeOptions> MiningModel encodeGradientBoosting(E estimator, Number initialPrediction, Number learningRate, Schema schema){ ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel(); List<TreeModel> treeModels = TreeModelUtil.encodeTreeModelSegmentation(estimator, MiningFunction.REGRESSION, schema); MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel)) .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.SUM, treeModels)) .setTargets(ModelUtil.createRescaleTargets(learningRate, initialPrediction, continuousLabel)); return TreeModelUtil.transform(estimator, miningModel); } }
.setTargets(ModelUtil.createRescaleTargets(null, (double)model._init_f, continuousLabel)); .setTargets(ModelUtil.createRescaleTargets(null, (double)model._init_f, continuousLabel)) .setOutput(ModelUtil.createPredictedOutput(FieldName.create("gbmValue"), OpType.CONTINUOUS, DataType.DOUBLE));
RDoubleVector yScaledScale = (RDoubleVector)yScale.getValue("scaled:scale"); supportVectorMachineModel.setTargets(ModelUtil.createRescaleTargets(-1d * yScaledScale.asScalar(), yScaledCenter.asScalar(), (ContinuousLabel)schema.getLabel()));