Class VectorInstance

  • All Implemented Interfaces:
    java.io.Serializable

    public class VectorInstance
    extends java.lang.Object
    implements java.io.Serializable
    Class encapsulating a PMML VectorInstance construct
    Version:
    $Revision: 8034 $
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double dotProduct​(double[] other)
      Computes the dot product between this vector instance and the supplied array of values
      double dotProduct​(VectorInstance other)
      Computes the dot product between this vector instance and the argument
      java.lang.String getID()
      Get the ID of this vector instance
      Array getValues()
      Get the Array of values encapsulated in this vector instance
      java.util.List<FieldRef> getVectorFields()
      Get the mining fields that are indexed by this vector instance
      VectorInstance subtract​(double[] other)
      Subtract the values in the supplied array from this vector instance
      VectorInstance subtract​(VectorInstance other)
      Subtract the supplied VectorInstance from this one and return the result as a new VectorInstance
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VectorInstance

        public VectorInstance​(Array values,
                              java.util.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​(org.w3c.dom.Element vecElement,
                              java.util.List<FieldRef> vectorFields)
                       throws java.lang.Exception
        Constructor
        Parameters:
        vecElement - PMML element containing this vector instance
        vectorFields - the mining fields indexed by this vector instance
        Throws:
        java.lang.Exception - if something goes wrong
    • Method Detail

      • getID

        public java.lang.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 java.util.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 java.lang.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:
        java.lang.Exception - if something goes wrong
      • subtract

        public VectorInstance subtract​(VectorInstance other)
                                throws java.lang.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:
        java.lang.Exception - if something goes wrong
      • dotProduct

        public double dotProduct​(VectorInstance other)
                          throws java.lang.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:
        java.lang.Exception - if something goes wrong
      • dotProduct

        public double dotProduct​(double[] other)
                          throws java.lang.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:
        java.lang.Exception - if something goes wrong