Codota Logo
ModelUtil.createMiningSchema
Code IndexAdd Codota to your IDE (free)

How to use
createMiningSchema
method
in
org.jpmml.converter.ModelUtil

Best Java code snippets using org.jpmml.converter.ModelUtil.createMiningSchema (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: cheng-li/pyramid

static
public MiningModel createModelChain(List<? extends Model> models, Schema schema){
  if(models.size() < 1){
    throw new IllegalArgumentException();
  }
  Segmentation segmentation = createSegmentation(Segmentation.MultipleModelMethod.MODEL_CHAIN, models);
  Model lastModel = Iterables.getLast(models);
  MiningModel miningModel = new MiningModel(lastModel.getMiningFunction(), ModelUtil.createMiningSchema(schema.getLabel()))
      .setMathContext(ModelUtil.simplifyMathContext(lastModel.getMathContext()))
      .setSegmentation(segmentation);
  return miningModel;
}
origin: org.jpmml/jpmml-h2o

static
public TreeModel encodeTreeModel(byte[] compressedTree, PredicateManager predicateManager, Schema schema){
  Label label = new ContinuousLabel(null, DataType.DOUBLE);
  AtomicInteger idSequence = new AtomicInteger(1);
  ByteBufferWrapper buffer = new ByteBufferWrapper(compressedTree);
  Node root = encodeNode(new True(), idSequence, compressedTree, buffer, predicateManager, new CategoryManager(), schema);
  TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(label), root)
    .setMissingValueStrategy(TreeModel.MissingValueStrategy.DEFAULT_CHILD);
  return treeModel;
}
origin: jpmml/jpmml-sparkml

  @Override
  public MiningModel encodeModel(Schema schema){
    List<TreeModel> treeModels = TreeModelUtil.encodeDecisionTreeEnsemble(this, schema);

    MiningModel miningModel = new MiningModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(schema.getLabel()))
      .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.AVERAGE, treeModels));

    return miningModel;
  }
}
origin: jpmml/jpmml-sparkml

  @Override
  public MiningModel encodeModel(Schema schema){
    List<TreeModel> treeModels = TreeModelUtil.encodeDecisionTreeEnsemble(this, schema);

    MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()))
      .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.AVERAGE, treeModels));

    return miningModel;
  }
}
origin: jpmml/jpmml-r

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;
}
origin: jpmml/jpmml-sklearn

  static
  public <E extends Estimator & HasEstimatorEnsemble<T> & HasTreeOptions, T extends Estimator & HasTree> MiningModel encodeBaseForest(E estimator, Segmentation.MultipleModelMethod multipleModelMethod, MiningFunction miningFunction, Schema schema){
    List<TreeModel> treeModels = TreeModelUtil.encodeTreeModelSegmentation(estimator, miningFunction, schema);

    MiningModel miningModel = new MiningModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()))
      .setSegmentation(MiningModelUtil.createSegmentation(multipleModelMethod, treeModels));

    return TreeModelUtil.transform(estimator, miningModel);
  }
}
origin: org.jpmml/jpmml-xgboost

public TreeModel encodeTreeModel(PredicateManager predicateManager, Schema schema){
  org.dmg.pmml.tree.Node root = encodeNode(new True(), predicateManager, 0, schema);
  TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT)
    .setMissingValueStrategy(TreeModel.MissingValueStrategy.DEFAULT_CHILD)
    .setMathContext(MathContext.FLOAT);
  return treeModel;
}
origin: jpmml/jpmml-xgboost

public TreeModel encodeTreeModel(PredicateManager predicateManager, Schema schema){
  org.dmg.pmml.tree.Node root = encodeNode(new True(), predicateManager, 0, schema);
  TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT)
    .setMissingValueStrategy(TreeModel.MissingValueStrategy.DEFAULT_CHILD)
    .setMathContext(MathContext.FLOAT);
  return treeModel;
}
origin: jpmml/jpmml-r

  @Override
  public Model encodeModel(RDoubleVector a0, RExp beta, int column, Schema schema){
    Double intercept = a0.getValue(column);
    List<Double> coefficients = getCoefficients((S4Object)beta, column);

    GeneralRegressionModel generalRegressionModel = new GeneralRegressionModel(GeneralRegressionModel.ModelType.GENERAL_LINEAR, MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), null, null, null)
      .setDistribution(GeneralRegressionModel.Distribution.NORMAL);

    GeneralRegressionModelUtil.encodeRegressionTable(generalRegressionModel, schema.getFeatures(), coefficients, intercept, null);

    return generalRegressionModel;
  }
}
origin: jpmml/jpmml-lightgbm

public TreeModel encodeTreeModel(PredicateManager predicateManager, Schema schema){
  Node root = encodeNode(new True(), predicateManager, new CategoryManager(), 0, schema);
  TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT)
    .setMissingValueStrategy(TreeModel.MissingValueStrategy.DEFAULT_CHILD);
  return treeModel;
}
origin: jpmml/jpmml-r

private TreeModel encodeTreeModel(MiningFunction miningFunction, RGenericVector tree, RGenericVector c_splits, Schema schema){
  Node root = encodeNode(new True(), 0, tree, c_splits, new FlagManager(), new CategoryManager(), schema);
  TreeModel treeModel = new TreeModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.MULTI_SPLIT);
  return treeModel;
}
origin: jpmml/jpmml-r

  @Override
  public Model encodeModel(RDoubleVector a0, RExp beta, int column, Schema schema){
    Double intercept = a0.getValue(column);
    List<Double> coefficients = getCoefficients((S4Object)beta, column);

    GeneralRegressionModel generalRegressionModel = new GeneralRegressionModel(GeneralRegressionModel.ModelType.GENERAL_LINEAR, MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), null, null, null)
      .setDistribution(GeneralRegressionModel.Distribution.POISSON);

    GeneralRegressionModelUtil.encodeRegressionTable(generalRegressionModel, schema.getFeatures(), coefficients, intercept, null);

    return generalRegressionModel;
  }
}
origin: jpmml/jpmml-sklearn

  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);
  }
}
origin: jpmml/jpmml-sparkml

  @Override
  public MiningModel encodeModel(Schema schema){
    GBTRegressionModel model = getTransformer();

    List<TreeModel> treeModels = TreeModelUtil.encodeDecisionTreeEnsemble(this, schema);

    MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()))
      .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.WEIGHTED_SUM, treeModels, Doubles.asList(model.treeWeights())));

    return miningModel;
  }
}
origin: jpmml/jpmml-r

private TreeModel encodeTreeModel(MiningFunction miningFunction, ScoreEncoder scoreEncoder, RGenericVector childNodeIDs, RNumberVector<?> splitVarIDs, RNumberVector<?> splitValues, RGenericVector terminalClassCounts, Schema schema){
  RNumberVector<?> leftChildIDs = (RNumberVector<?>)childNodeIDs.getValue(0);
  RNumberVector<?> rightChildIDs = (RNumberVector<?>)childNodeIDs.getValue(1);
  Node root = encodeNode(new True(), 0, scoreEncoder, leftChildIDs, rightChildIDs, splitVarIDs, splitValues, terminalClassCounts, new CategoryManager(), schema);
  TreeModel treeModel = new TreeModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT);
  return treeModel;
}
origin: jpmml/jpmml-sparkml

static
private <M extends Model<M> & DecisionTreeModel> TreeModel encodeTreeModel(M model, PredicateManager predicateManager, MiningFunction miningFunction, ScoreEncoder scoreEncoder, Schema schema){
  Node root = new Node()
    .setPredicate(new True());
  encodeNode(root, model.rootNode(), predicateManager, new CategoryManager(), scoreEncoder, schema);
  TreeModel treeModel = new TreeModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT);
  return treeModel;
}
origin: cheng-li/pyramid

public TreeModel encodeTreeModel(Schema schema){
  org.dmg.pmml.tree.Node root = new org.dmg.pmml.tree.Node()
      .setPredicate(new True());
  encodeNode(root, 0, schema);
  TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), root)
      .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT)
      .setMissingValueStrategy(TreeModel.MissingValueStrategy.NONE)
      .setMathContext(MathContext.FLOAT);
  return treeModel;
}
origin: jpmml/jpmml-r

  @Override
  public Model encodeModel(Schema schema){
    RGenericVector bagging = getObject();

    RGenericVector trees = (RGenericVector)bagging.getValue("trees");

    CategoricalLabel categoricalLabel = (CategoricalLabel)schema.getLabel();

    List<TreeModel> treeModels = encodeTreeModels(trees);

    MiningModel miningModel = new MiningModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(categoricalLabel))
      .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.MAJORITY_VOTE, treeModels))
      .setOutput(ModelUtil.createProbabilityOutput(DataType.DOUBLE, categoricalLabel));

    return miningModel;
  }
}
origin: jpmml/jpmml-r

private <P extends Number> TreeModel encodeTreeModel(MiningFunction miningFunction, ScoreEncoder<P> scoreEncoder, List<? extends Number> leftDaughter, List<? extends Number> rightDaughter, List<P> nodepred, List<? extends Number> bestvar, List<Double> xbestsplit, Schema schema){
  RGenericVector randomForest = getObject();
  Node root = encodeNode(new True(), 0, scoreEncoder, leftDaughter, rightDaughter, bestvar, xbestsplit, nodepred, new CategoryManager(), schema);
  TreeModel treeModel = new TreeModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()), root)
    .setMissingValueStrategy(TreeModel.MissingValueStrategy.NULL_PREDICTION)
    .setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT);
  if(this.compact){
    Visitor visitor = new RandomForestCompactor();
    visitor.applyTo(treeModel);
  }
  return treeModel;
}
origin: jpmml/jpmml-r

@Override
public Model encodeModel(Schema schema){
  RGenericVector ada = getObject();
  RGenericVector model = (RGenericVector)ada.getValue("model");
  RGenericVector trees = (RGenericVector)model.getValue("trees");
  RDoubleVector alpha = (RDoubleVector)model.getValue("alpha");
  List<TreeModel> treeModels = encodeTreeModels(trees);
  MiningModel miningModel = new MiningModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(null))
    .setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.WEIGHTED_SUM, treeModels, alpha.getValues()))
    .setOutput(ModelUtil.createPredictedOutput(FieldName.create("adaValue"), OpType.CONTINUOUS, DataType.DOUBLE, new SigmoidTransformation(-2d)));
  return MiningModelUtil.createBinaryLogisticClassification(miningModel, 1d, 0d, RegressionModel.NormalizationMethod.NONE, true, schema);
}
org.jpmml.converterModelUtilcreateMiningSchema

Popular methods of ModelUtil

  • createPredictedOutput
  • createRescaleTargets
  • createPredictedField
  • createProbabilityField
  • createProbabilityOutput
  • createModelVerification
  • createVerificationField
  • ensureOutput
  • createEntityIdField
  • createProbabilityFields
  • simplifyMathContext
  • simplifyMathContext

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JPanel (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now