All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dmg.pmml.clustering.ClusteringModel Maven / Gradle / Ivy


package org.dmg.pmml.clustering;

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.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.dmg.pmml.ComparisonMeasure;
import org.dmg.pmml.Extension;
import org.dmg.pmml.HasExtensions;
import org.dmg.pmml.LocalTransformations;
import org.dmg.pmml.MiningFunction;
import org.dmg.pmml.MiningSchema;
import org.dmg.pmml.Model;
import org.dmg.pmml.ModelExplanation;
import org.dmg.pmml.ModelStats;
import org.dmg.pmml.ModelVerification;
import org.dmg.pmml.Output;
import org.dmg.pmml.PMMLObject;
import org.dmg.pmml.Visitor;
import org.dmg.pmml.VisitorAction;
import org.jpmml.schema.Added;
import org.jpmml.schema.Removed;
import org.jpmml.schema.Required;
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_3}Extension" maxOccurs="unbounded" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}MiningSchema"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}Output" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}ModelStats" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}ModelExplanation" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}LocalTransformations" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}ComparisonMeasure"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}ClusteringField" maxOccurs="unbounded"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}CenterFields" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}MissingValueWeights" minOccurs="0"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}Cluster" maxOccurs="unbounded"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}ModelVerification" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="modelName" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="functionName" use="required" type="{http://www.dmg.org/PMML-4_3}MINING-FUNCTION" />
 *       <attribute name="algorithmName" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="modelClass" use="required">
 *         <simpleType>
 *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *             <enumeration value="centerBased"/>
 *             <enumeration value="distributionBased"/>
 *           </restriction>
 *         </simpleType>
 *       </attribute>
 *       <attribute name="numberOfClusters" use="required" type="{http://www.dmg.org/PMML-4_3}INT-NUMBER" />
 *       <attribute name="isScorable" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "extensions", "miningSchema", "output", "modelStats", "modelExplanation", "localTransformations", "comparisonMeasure", "clusteringFields", "centerFields", "missingValueWeights", "clusters", "modelVerification" }) @XmlRootElement(name = "ClusteringModel", namespace = "http://www.dmg.org/PMML-4_3") public class ClusteringModel extends Model implements HasExtensions { @XmlAttribute(name = "modelName") private String modelName; @XmlAttribute(name = "functionName", required = true) private MiningFunction miningFunction; @XmlAttribute(name = "algorithmName") private String algorithmName; @XmlAttribute(name = "modelClass", required = true) private ClusteringModel.ModelClass modelClass; @XmlAttribute(name = "numberOfClusters", required = true) private int numberOfClusters; @XmlAttribute(name = "isScorable") @Added(Version.PMML_4_1) private Boolean scorable; @XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_3") private List extensions; @XmlElement(name = "MiningSchema", namespace = "http://www.dmg.org/PMML-4_3", required = true) private MiningSchema miningSchema; @XmlElement(name = "Output", namespace = "http://www.dmg.org/PMML-4_3") private Output output; @XmlElement(name = "ModelStats", namespace = "http://www.dmg.org/PMML-4_3") private ModelStats modelStats; @XmlElement(name = "ModelExplanation", namespace = "http://www.dmg.org/PMML-4_3") @Added(Version.PMML_4_0) private ModelExplanation modelExplanation; @XmlElement(name = "LocalTransformations", namespace = "http://www.dmg.org/PMML-4_3") private LocalTransformations localTransformations; @XmlElement(name = "ComparisonMeasure", namespace = "http://www.dmg.org/PMML-4_3", required = true) private ComparisonMeasure comparisonMeasure; @XmlElement(name = "ClusteringField", namespace = "http://www.dmg.org/PMML-4_3", required = true) @Required(Version.PMML_4_2) private List clusteringFields; @XmlElement(name = "CenterFields", namespace = "http://www.dmg.org/PMML-4_3") @Removed(Version.PMML_3_2) private CenterFields centerFields; @XmlElement(name = "MissingValueWeights", namespace = "http://www.dmg.org/PMML-4_3") private MissingValueWeights missingValueWeights; @XmlElement(name = "Cluster", namespace = "http://www.dmg.org/PMML-4_3", required = true) private List clusters; @XmlElement(name = "ModelVerification", namespace = "http://www.dmg.org/PMML-4_3") private ModelVerification modelVerification; private final static Boolean DEFAULT_SCORABLE = true; public ClusteringModel() { super(); } public ClusteringModel(final MiningFunction miningFunction, final ClusteringModel.ModelClass modelClass, final int numberOfClusters, final MiningSchema miningSchema, final ComparisonMeasure comparisonMeasure, final List clusteringFields, final List clusters) { super(); this.miningFunction = miningFunction; this.modelClass = modelClass; this.numberOfClusters = numberOfClusters; this.miningSchema = miningSchema; this.comparisonMeasure = comparisonMeasure; this.clusteringFields = clusteringFields; this.clusters = clusters; } /** * Gets the value of the modelName property. * * @return * possible object is * {@link String } * */ public String getModelName() { return modelName; } /** * Sets the value of the modelName property. * * @param modelName * allowed object is * {@link String } * */ public ClusteringModel setModelName(String modelName) { this.modelName = modelName; return this; } /** * Gets the value of the miningFunction property. * * @return * possible object is * {@link MiningFunction } * */ public MiningFunction getMiningFunction() { return miningFunction; } /** * Sets the value of the miningFunction property. * * @param miningFunction * allowed object is * {@link MiningFunction } * */ public ClusteringModel setMiningFunction(MiningFunction miningFunction) { this.miningFunction = miningFunction; return this; } /** * Gets the value of the algorithmName property. * * @return * possible object is * {@link String } * */ public String getAlgorithmName() { return algorithmName; } /** * Sets the value of the algorithmName property. * * @param algorithmName * allowed object is * {@link String } * */ public ClusteringModel setAlgorithmName(String algorithmName) { this.algorithmName = algorithmName; return this; } /** * Gets the value of the modelClass property. * * @return * possible object is * {@link ClusteringModel.ModelClass } * */ public ClusteringModel.ModelClass getModelClass() { return modelClass; } /** * Sets the value of the modelClass property. * * @param modelClass * allowed object is * {@link ClusteringModel.ModelClass } * */ public ClusteringModel setModelClass(ClusteringModel.ModelClass modelClass) { this.modelClass = modelClass; return this; } /** * Gets the value of the numberOfClusters property. * */ public int getNumberOfClusters() { return numberOfClusters; } /** * Sets the value of the numberOfClusters property. * */ public ClusteringModel setNumberOfClusters(int numberOfClusters) { this.numberOfClusters = numberOfClusters; return this; } /** * Gets the value of the scorable property. * * @return * possible object is * {@link Boolean } * */ public boolean isScorable() { if (scorable == null) { return DEFAULT_SCORABLE; } else { return scorable; } } /** * Sets the value of the scorable property. * * @param scorable * allowed object is * {@link Boolean } * */ public ClusteringModel setScorable(Boolean scorable) { this.scorable = scorable; 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 miningSchema property. * * @return * possible object is * {@link MiningSchema } * */ public MiningSchema getMiningSchema() { return miningSchema; } /** * Sets the value of the miningSchema property. * * @param miningSchema * allowed object is * {@link MiningSchema } * */ public ClusteringModel setMiningSchema(MiningSchema miningSchema) { this.miningSchema = miningSchema; return this; } /** * Gets the value of the output property. * * @return * possible object is * {@link Output } * */ public Output getOutput() { return output; } /** * Sets the value of the output property. * * @param output * allowed object is * {@link Output } * */ public ClusteringModel setOutput(Output output) { this.output = output; return this; } /** * Gets the value of the modelStats property. * * @return * possible object is * {@link ModelStats } * */ public ModelStats getModelStats() { return modelStats; } /** * Sets the value of the modelStats property. * * @param modelStats * allowed object is * {@link ModelStats } * */ public ClusteringModel setModelStats(ModelStats modelStats) { this.modelStats = modelStats; return this; } /** * Gets the value of the modelExplanation property. * * @return * possible object is * {@link ModelExplanation } * */ public ModelExplanation getModelExplanation() { return modelExplanation; } /** * Sets the value of the modelExplanation property. * * @param modelExplanation * allowed object is * {@link ModelExplanation } * */ public ClusteringModel setModelExplanation(ModelExplanation modelExplanation) { this.modelExplanation = modelExplanation; return this; } /** * Gets the value of the localTransformations property. * * @return * possible object is * {@link LocalTransformations } * */ public LocalTransformations getLocalTransformations() { return localTransformations; } /** * Sets the value of the localTransformations property. * * @param localTransformations * allowed object is * {@link LocalTransformations } * */ public ClusteringModel setLocalTransformations(LocalTransformations localTransformations) { this.localTransformations = localTransformations; return this; } /** * Gets the value of the comparisonMeasure property. * * @return * possible object is * {@link ComparisonMeasure } * */ public ComparisonMeasure getComparisonMeasure() { return comparisonMeasure; } /** * Sets the value of the comparisonMeasure property. * * @param comparisonMeasure * allowed object is * {@link ComparisonMeasure } * */ public ClusteringModel setComparisonMeasure(ComparisonMeasure comparisonMeasure) { this.comparisonMeasure = comparisonMeasure; return this; } /** * Gets the value of the clusteringFields 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 clusteringFields property. * *

* For example, to add a new item, do as follows: *

     *    getClusteringFields().add(newItem);
     * 
* * *

* Objects of the following type(s) are allowed in the list * {@link ClusteringField } * * */ public List getClusteringFields() { if (clusteringFields == null) { clusteringFields = new ArrayList(); } return this.clusteringFields; } /** * Gets the value of the centerFields property. * * @return * possible object is * {@link CenterFields } * */ public CenterFields getCenterFields() { return centerFields; } /** * Sets the value of the centerFields property. * * @param centerFields * allowed object is * {@link CenterFields } * */ public ClusteringModel setCenterFields(CenterFields centerFields) { this.centerFields = centerFields; return this; } /** * Gets the value of the missingValueWeights property. * * @return * possible object is * {@link MissingValueWeights } * */ public MissingValueWeights getMissingValueWeights() { return missingValueWeights; } /** * Sets the value of the missingValueWeights property. * * @param missingValueWeights * allowed object is * {@link MissingValueWeights } * */ public ClusteringModel setMissingValueWeights(MissingValueWeights missingValueWeights) { this.missingValueWeights = missingValueWeights; return this; } /** * Gets the value of the clusters 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 clusters property. * *

* For example, to add a new item, do as follows: *

     *    getClusters().add(newItem);
     * 
* * *

* Objects of the following type(s) are allowed in the list * {@link Cluster } * * */ public List getClusters() { if (clusters == null) { clusters = new ArrayList(); } return this.clusters; } /** * Gets the value of the modelVerification property. * * @return * possible object is * {@link ModelVerification } * */ public ModelVerification getModelVerification() { return modelVerification; } /** * Sets the value of the modelVerification property. * * @param modelVerification * allowed object is * {@link ModelVerification } * */ public ClusteringModel setModelVerification(ModelVerification modelVerification) { this.modelVerification = modelVerification; return this; } public boolean hasExtensions() { return ((this.extensions!= null)&&(this.extensions.size()> 0)); } public ClusteringModel addExtensions(Extension... extensions) { getExtensions().addAll(Arrays.asList(extensions)); return this; } public boolean hasClusteringFields() { return ((this.clusteringFields!= null)&&(this.clusteringFields.size()> 0)); } public ClusteringModel addClusteringFields(ClusteringField... clusteringFields) { getClusteringFields().addAll(Arrays.asList(clusteringFields)); return this; } public boolean hasClusters() { return ((this.clusters!= null)&&(this.clusters.size()> 0)); } public ClusteringModel addClusters(Cluster... clusters) { getClusters().addAll(Arrays.asList(clusters)); 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 = PMMLObject.traverse(visitor, getExtensions()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getMiningSchema(), getOutput(), getModelStats(), getModelExplanation(), getLocalTransformations(), getComparisonMeasure()); } if ((status == VisitorAction.CONTINUE)&&hasClusteringFields()) { status = PMMLObject.traverse(visitor, getClusteringFields()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getCenterFields(), getMissingValueWeights()); } if ((status == VisitorAction.CONTINUE)&&hasClusters()) { status = PMMLObject.traverse(visitor, getClusters()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getModelVerification()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; } /** *

Java class for null. * *

The following schema fragment specifies the expected content contained within this class. *

*

     * <simpleType>
     *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
     *     <enumeration value="centerBased"/>
     *     <enumeration value="distributionBased"/>
     *   </restriction>
     * </simpleType>
     * 
* */ @XmlType(name = "") @XmlEnum public enum ModelClass { @XmlEnumValue("centerBased") CENTER_BASED("centerBased"), @XmlEnumValue("distributionBased") DISTRIBUTION_BASED("distributionBased"); private final String value; ModelClass(String v) { value = v; } public String value() { return value; } public static ClusteringModel.ModelClass fromValue(String v) { for (ClusteringModel.ModelClass c: ClusteringModel.ModelClass.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy