
org.dmg.pmml.SupportVectorMachine Maven / Gradle / Ivy
package org.dmg.pmml;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jpmml.schema.Added;
import org.jpmml.schema.Version;
/**
* Java class for anonymous complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.dmg.org/PMML-4_2}Extension" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_2}SupportVectors" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_2}Coefficients"/>
* </sequence>
* <attribute name="targetCategory" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="alternateTargetCategory" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="threshold" type="{http://www.dmg.org/PMML-4_2}REAL-NUMBER" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"supportVectors",
"coefficients"
})
@XmlRootElement(name = "SupportVectorMachine", namespace = "http://www.dmg.org/PMML-4_2")
public class SupportVectorMachine
extends org.dmg.pmml.PMMLObject
implements HasExtensions
{
@XmlAttribute(name = "targetCategory")
@Added(Version.PMML_3_1)
private String targetCategory;
@XmlAttribute(name = "alternateTargetCategory")
@Added(Version.PMML_4_0)
private String alternateTargetCategory;
@XmlAttribute(name = "threshold")
@Added(Version.PMML_4_0)
private Double threshold;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_2")
private List extensions;
@XmlElement(name = "SupportVectors", namespace = "http://www.dmg.org/PMML-4_2")
private SupportVectors supportVectors;
@XmlElement(name = "Coefficients", namespace = "http://www.dmg.org/PMML-4_2", required = true)
private Coefficients coefficients;
public SupportVectorMachine() {
super();
}
public SupportVectorMachine(final Coefficients coefficients) {
super();
this.coefficients = coefficients;
}
/**
* Gets the value of the targetCategory property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTargetCategory() {
return targetCategory;
}
/**
* Sets the value of the targetCategory property.
*
* @param targetCategory
* allowed object is
* {@link String }
*
*/
public SupportVectorMachine setTargetCategory(String targetCategory) {
this.targetCategory = targetCategory;
return this;
}
/**
* Gets the value of the alternateTargetCategory property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAlternateTargetCategory() {
return alternateTargetCategory;
}
/**
* Sets the value of the alternateTargetCategory property.
*
* @param alternateTargetCategory
* allowed object is
* {@link String }
*
*/
public SupportVectorMachine setAlternateTargetCategory(String alternateTargetCategory) {
this.alternateTargetCategory = alternateTargetCategory;
return this;
}
/**
* Gets the value of the threshold property.
*
* @return
* possible object is
* {@link Double }
*
*/
public Double getThreshold() {
return threshold;
}
/**
* Sets the value of the threshold property.
*
* @param threshold
* allowed object is
* {@link Double }
*
*/
public SupportVectorMachine setThreshold(Double threshold) {
this.threshold = threshold;
return this;
}
/**
* Gets the value of the extensions property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the extensions property.
*
*
* For example, to add a new item, do as follows:
*
* getExtensions().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Extension }
*
*
*/
public List getExtensions() {
if (extensions == null) {
extensions = new ArrayList();
}
return this.extensions;
}
/**
* Gets the value of the supportVectors property.
*
* @return
* possible object is
* {@link SupportVectors }
*
*/
public SupportVectors getSupportVectors() {
return supportVectors;
}
/**
* Sets the value of the supportVectors property.
*
* @param supportVectors
* allowed object is
* {@link SupportVectors }
*
*/
public SupportVectorMachine setSupportVectors(SupportVectors supportVectors) {
this.supportVectors = supportVectors;
return this;
}
/**
* Gets the value of the coefficients property.
*
* @return
* possible object is
* {@link Coefficients }
*
*/
public Coefficients getCoefficients() {
return coefficients;
}
/**
* Sets the value of the coefficients property.
*
* @param coefficients
* allowed object is
* {@link Coefficients }
*
*/
public SupportVectorMachine setCoefficients(Coefficients coefficients) {
this.coefficients = coefficients;
return this;
}
public boolean hasExtensions() {
return ((this.extensions!= null)&&(this.extensions.size()> 0));
}
public SupportVectorMachine addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
@Override
public VisitorAction accept(Visitor visitor) {
VisitorAction status = visitor.visit(this);
if (status == VisitorAction.CONTINUE) {
visitor.pushParent(this);
if ((status == VisitorAction.CONTINUE)&&hasExtensions()) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getExtensions());
}
if (status == VisitorAction.CONTINUE) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getSupportVectors(), getCoefficients());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}