congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SupportVectorMachineModel
Code IndexAdd Tabnine to your IDE (free)

How to use
SupportVectorMachineModel
in
org.dmg.pmml.support_vector_machine

Best Java code snippets using org.dmg.pmml.support_vector_machine.SupportVectorMachineModel (Showing top 19 results out of 315)

origin: jpmml/jpmml-model

@Override
public VisitorAction accept(Visitor visitor) {
  VisitorAction status = visitor.visit(this);
  if (status == VisitorAction.CONTINUE) {
    visitor.pushParent(this);
    if ((status == VisitorAction.CONTINUE)&&hasExtensions()) {
      status = PMMLObject.traverse(visitor, getExtensions());
    }
    if (status == VisitorAction.CONTINUE) {
      status = PMMLObject.traverse(visitor, getMiningSchema(), getOutput(), getModelStats(), getModelExplanation(), getTargets(), getLocalTransformations(), getKernel(), getVectorDictionary());
    }
    if ((status == VisitorAction.CONTINUE)&&hasSupportVectorMachines()) {
      status = PMMLObject.traverse(visitor, getSupportVectorMachines());
    }
    if (status == VisitorAction.CONTINUE) {
      status = PMMLObject.traverse(visitor, getModelVerification());
    }
    visitor.popParent();
  }
  if (status == VisitorAction.TERMINATE) {
    return VisitorAction.TERMINATE;
  }
  return VisitorAction.CONTINUE;
}
origin: org.jpmml/pmml-model

/**
 * Create an instance of {@link SupportVectorMachineModel }
 * 
 */
public SupportVectorMachineModel createSupportVectorMachineModel() {
  return new SupportVectorMachineModel();
}
origin: jpmml/jpmml-evaluator

public SupportVectorMachineModelEvaluator(PMML pmml, SupportVectorMachineModel supportVectorMachineModel){
  super(pmml, supportVectorMachineModel);
  boolean maxWins = supportVectorMachineModel.isMaxWins();
  if(maxWins){
    throw new UnsupportedAttributeException(supportVectorMachineModel, PMMLAttributes.SUPPORTVECTORMACHINEMODEL_MAXWINS, maxWins);
  }
  SupportVectorMachineModel.Representation representation = supportVectorMachineModel.getRepresentation();
  switch(representation){
    case SUPPORT_VECTORS:
      break;
    default:
      throw new UnsupportedAttributeException(supportVectorMachineModel, representation);
  }
  VectorDictionary vectorDictionary = supportVectorMachineModel.getVectorDictionary();
  if(vectorDictionary == null){
    throw new MissingElementException(supportVectorMachineModel, PMMLElements.SUPPORTVECTORMACHINEMODEL_VECTORDICTIONARY);
  }
  VectorFields vectorFields = vectorDictionary.getVectorFields();
  if(vectorFields == null){
    throw new MissingElementException(vectorDictionary, PMMLElements.VECTORDICTIONARY_VECTORFIELDS);
  } // End if
  if(!supportVectorMachineModel.hasSupportVectorMachines()){
    throw new MissingElementException(supportVectorMachineModel, PMMLElements.SUPPORTVECTORMACHINEMODEL_SUPPORTVECTORMACHINES);
  }
}
origin: jpmml/jpmml-sklearn

@Override
public SupportVectorMachineModel encodeModel(Schema schema){
  int[] shape = getSupportVectorsShape();
  int numberOfVectors = shape[0];
  int numberOfFeatures = shape[1];
  List<Integer> support = getSupport();
  List<? extends Number> supportVectors = getSupportVectors();
  List<Integer> supportSizes = getSupportSizes();
  List<? extends Number> dualCoef = getDualCoef();
  List<? extends Number> intercept = getIntercept();
  SupportVectorMachineModel supportVectorMachineModel = LibSVMUtil.createClassification(new CMatrix<>(ValueUtil.asDoubles(supportVectors), numberOfVectors, numberOfFeatures), supportSizes, SupportVectorMachineUtil.formatIds(support), ValueUtil.asDoubles(intercept), ValueUtil.asDoubles(dualCoef), schema)
    .setKernel(SupportVectorMachineUtil.createKernel(getKernel(), getDegree(), getGamma(), getCoef0()));
  List<SupportVectorMachine> supportVectorMachines = supportVectorMachineModel.getSupportVectorMachines();
  for(SupportVectorMachine supportVectorMachine : supportVectorMachines){
    String category = supportVectorMachine.getTargetCategory();
    // LibSVM: (decisionFunction > 0 ? first : second)
    // PMML: (decisionFunction < 0 ? first : second)
    supportVectorMachine.setTargetCategory(supportVectorMachine.getAlternateTargetCategory());
    supportVectorMachine.setAlternateTargetCategory(category);
  }
  return supportVectorMachineModel;
}
origin: jpmml/jpmml-evaluator

SupportVectorMachineModel supportVectorMachineModel = getModel();
List<SupportVectorMachine> supportVectorMachines = supportVectorMachineModel.getSupportVectorMachines();
String alternateBinaryTargetCategory = supportVectorMachineModel.getAlternateBinaryTargetCategory();
            threshold = supportVectorMachineModel.getThreshold();
origin: jpmml/jpmml-r

        .setOutput(ModelUtil.createPredictedOutput(FieldName.create("decisionFunction"), OpType.CONTINUOUS, DataType.DOUBLE, outlier));
        RDoubleVector yScaledScale = (RDoubleVector)yScale.getValue("scaled:scale");
        supportVectorMachineModel.setTargets(ModelUtil.createRescaleTargets(-1d * yScaledScale.asScalar(), yScaledCenter.asScalar(), (ContinuousLabel)schema.getLabel()));
supportVectorMachineModel.setKernel(svmKernel.createKernel(degree.asScalar(), gamma.asScalar(), coef0.asScalar()));
origin: org.jpmml/pmml-model

public SupportVectorMachineModel addSupportVectorMachines(SupportVectorMachine... supportVectorMachines) {
  getSupportVectorMachines().addAll(Arrays.asList(supportVectorMachines));
  return this;
}
origin: jpmml/jpmml-evaluator

List<SupportVectorMachine> supportVectorMachines = supportVectorMachineModel.getSupportVectorMachines();
String alternateBinaryTargetCategory = supportVectorMachineModel.getAlternateBinaryTargetCategory();
if(alternateBinaryTargetCategory != null){
origin: jpmml/jpmml-evaluator

private Object createInput(EvaluationContext context){
  SupportVectorMachineModel supportVectorMachineModel = getModel();
  VectorDictionary vectorDictionary = supportVectorMachineModel.getVectorDictionary();
origin: jpmml/jpmml-sklearn

  @Override
  public SupportVectorMachineModel encodeModel(Schema schema){
    Transformation outlier = new OutlierTransformation(){

      @Override
      public Expression createExpression(FieldRef fieldRef){
        return PMMLUtil.createApply("lessOrEqual", fieldRef, PMMLUtil.createConstant(0d));
      }
    };

    SupportVectorMachineModel supportVectorMachineModel = super.encodeModel(schema)
      .setOutput(ModelUtil.createPredictedOutput(FieldName.create("decisionFunction"), OpType.CONTINUOUS, DataType.DOUBLE, outlier));

    return supportVectorMachineModel;
  }
}
origin: jpmml/jpmml-evaluator

Kernel kernel = supportVectorMachineModel.getKernel();
if(kernel == null){
  throw new MissingElementException(MissingElementException.formatMessage(XPathUtil.formatElement(supportVectorMachineModel.getClass()) + "/<Kernel>"), supportVectorMachine);
origin: jpmml/jpmml-sklearn

@Override
public SupportVectorMachineModel encodeModel(Schema schema){
  int[] shape = getSupportVectorsShape();
  int numberOfVectors = shape[0];
  int numberOfFeatures = shape[1];
  List<Integer> support = getSupport();
  List<? extends Number> supportVectors = getSupportVectors();
  List<? extends Number> dualCoef = getDualCoef();
  List<? extends Number> intercept = getIntercept();
  SupportVectorMachineModel supportVectorMachineModel = LibSVMUtil.createRegression(new CMatrix<>(ValueUtil.asDoubles(supportVectors), numberOfVectors, numberOfFeatures), SupportVectorMachineUtil.formatIds(support), ValueUtil.asDouble(Iterables.getOnlyElement(intercept)), ValueUtil.asDoubles(dualCoef), schema)
    .setKernel(SupportVectorMachineUtil.createKernel(getKernel(), getDegree(), getGamma(), getCoef0()));
  return supportVectorMachineModel;
}
origin: org.jpmml/pmml-model

@Override
public SupportVectorMachineModel addExtensions(org.dmg.pmml.Extension... extensions) {
  getExtensions().addAll(Arrays.asList(extensions));
  return this;
}
origin: jpmml/jpmml-model

public SupportVectorMachineModel addSupportVectorMachines(SupportVectorMachine... supportVectorMachines) {
  getSupportVectorMachines().addAll(Arrays.asList(supportVectorMachines));
  return this;
}
origin: jpmml/jpmml-evaluator

static
private Map<String, Object> parseVectorDictionary(SupportVectorMachineModel supportVectorMachineModel){
  VectorDictionary vectorDictionary = supportVectorMachineModel.getVectorDictionary();
origin: jpmml/jpmml-model

@Override
public SupportVectorMachineModel addExtensions(org.dmg.pmml.Extension... extensions) {
  getExtensions().addAll(Arrays.asList(extensions));
  return this;
}
origin: org.jpmml/pmml-model

@Override
public VisitorAction accept(Visitor visitor) {
  VisitorAction status = visitor.visit(this);
  if (status == VisitorAction.CONTINUE) {
    visitor.pushParent(this);
    if ((status == VisitorAction.CONTINUE)&&hasExtensions()) {
      status = PMMLObject.traverse(visitor, getExtensions());
    }
    if (status == VisitorAction.CONTINUE) {
      status = PMMLObject.traverse(visitor, getMiningSchema(), getOutput(), getModelStats(), getModelExplanation(), getTargets(), getLocalTransformations(), getKernel(), getVectorDictionary());
    }
    if ((status == VisitorAction.CONTINUE)&&hasSupportVectorMachines()) {
      status = PMMLObject.traverse(visitor, getSupportVectorMachines());
    }
    if (status == VisitorAction.CONTINUE) {
      status = PMMLObject.traverse(visitor, getModelVerification());
    }
    visitor.popParent();
  }
  if (status == VisitorAction.TERMINATE) {
    return VisitorAction.TERMINATE;
  }
  return VisitorAction.CONTINUE;
}
origin: jpmml/jpmml-evaluator

@Override
protected <V extends Number> Map<FieldName, ?> evaluateRegression(ValueFactory<V> valueFactory, EvaluationContext context){
  SupportVectorMachineModel supportVectorMachineModel = getModel();
  List<SupportVectorMachine> supportVectorMachines = supportVectorMachineModel.getSupportVectorMachines();
  if(supportVectorMachines.size() != 1){
    throw new InvalidElementListException(supportVectorMachines);
  }
  SupportVectorMachine supportVectorMachine = supportVectorMachines.get(0);
  Object input = createInput(context);
  Value<V> result = evaluateSupportVectorMachine(valueFactory, supportVectorMachine, input);
  return TargetUtil.evaluateRegression(getTargetField(), result);
}
origin: jpmml/jpmml-model

/**
 * Create an instance of {@link SupportVectorMachineModel }
 * 
 */
public SupportVectorMachineModel createSupportVectorMachineModel() {
  return new SupportVectorMachineModel();
}
org.dmg.pmml.support_vector_machineSupportVectorMachineModel

Most used methods

  • getSupportVectorMachines
  • getKernel
  • getVectorDictionary
  • hasSupportVectorMachines
  • setKernel
  • setOutput
  • <init>
  • getAlternateBinaryTargetCategory
  • getExtensions
  • getLocalTransformations
  • getMathContext
  • getMiningSchema
  • getMathContext,
  • getMiningSchema,
  • getModelExplanation,
  • getModelStats,
  • getModelVerification,
  • getOutput,
  • getRepresentation,
  • getTargets,
  • getThreshold,
  • hasExtensions

Popular in Java

  • Parsing JSON documents to java classes using gson
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • getContentResolver (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now