Class VectorInstance

  • All Implemented Interfaces:
    Serializable

    public class VectorInstance
    extends Object
    implements Serializable
    Class encapsulating a PMML VectorInstance construct
    Version:
    $Revision$
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    See Also:
    Serialized Form
    • Constructor Detail

      • VectorInstance

        public VectorInstance​(Array values,
                              List<FieldRef> vectorFields)
        Constructor
        Parameters:
        values - the Array of values for this vector instance
        vectorFields - the mining fields indexed by this vector instance
      • VectorInstance

        public VectorInstance​(Element vecElement,
                              List<FieldRef> vectorFields)
                       throws Exception
        Constructor
        Parameters:
        vecElement - PMML element containing this vector instance
        vectorFields - the mining fields indexed by this vector instance
        Throws:
        Exception - if something goes wrong
    • Method Detail

      • getID

        public String getID()
        Get the ID of this vector instance
        Returns:
        the ID of this vector instance
      • getValues

        public Array getValues()
        Get the Array of values encapsulated in this vector instance
        Returns:
        the Array of values encapsulated in this vector instance
      • getVectorFields

        public List<FieldRef> getVectorFields()
        Get the mining fields that are indexed by this vector instance
        Returns:
        the mining fields that are indexed by this vector instance
      • subtract

        public VectorInstance subtract​(double[] other)
                                throws Exception
        Subtract the values in the supplied array from this vector instance
        Parameters:
        other - an array of values
        Returns:
        a new VectorInstance containing the result of the subtraction
        Throws:
        Exception - if something goes wrong
      • subtract

        public VectorInstance subtract​(VectorInstance other)
                                throws Exception
        Subtract the supplied VectorInstance from this one and return the result as a new VectorInstance
        Parameters:
        other - the vector instance to subtract
        Returns:
        a new VectorInstance containing the result of the subtraction
        Throws:
        Exception - if something goes wrong
      • dotProduct

        public double dotProduct​(VectorInstance other)
                          throws Exception
        Computes the dot product between this vector instance and the argument
        Parameters:
        other - the vector instance to perform the dot product with
        Returns:
        the dot product of this and the supplied vector instance
        Throws:
        Exception - if something goes wrong
      • dotProduct

        public double dotProduct​(double[] other)
                          throws Exception
        Computes the dot product between this vector instance and the supplied array of values
        Parameters:
        other - an array of values to perform the dot product with
        Returns:
        the dot product of this vector instance with the argument
        Throws:
        Exception - if something goes wrong