Documentation of 'jsat.classifiers.DataPoint' Java class
DataPoint
jsat.classifiers

Class DataPoint

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class DataPoint
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    This is the general class object for representing a singular data point in a data set. Every data point is made up of either categorical variables, numerical variables, or a combination of the two.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      DataPoint(Vec numericalValues)
      Creates a new data point that has no categorical variables and a weight of 1.0
      DataPoint(Vec numericalValues, double weight)
      Creates a new data point that has no categorical variables
      DataPoint(Vec numericalValues, int[] categoricalValues, CategoricalData[] categoricalData)
      Creates a new data point with the default weight of 1.0
      DataPoint(Vec numericalValues, int[] categoricalValues, CategoricalData[] categoricalData, double weight)
      Creates a new data point
    • Constructor Detail

      • DataPoint

        public DataPoint(Vec numericalValues,
                         int[] categoricalValues,
                         CategoricalData[] categoricalData)
        Creates a new data point with the default weight of 1.0
        Parameters:
        numericalValues - a vector containing the numerical values for this data point
        categoricalValues - an array of the category values for this data point
        categoricalData - an array of the category information of this data point
      • DataPoint

        public DataPoint(Vec numericalValues,
                         int[] categoricalValues,
                         CategoricalData[] categoricalData,
                         double weight)
        Creates a new data point
        Parameters:
        numericalValues - a vector containing the numerical values for this data point
        categoricalValues - an array of the category values for this data point
        categoricalData - an array of the category information of this data point
        weight - a double indicating how much weight this data point has, 1.0 being the standard weight. Not all algorithms make use of data points that have different weights.
      • DataPoint

        public DataPoint(Vec numericalValues,
                         double weight)
        Creates a new data point that has no categorical variables
        Parameters:
        numericalValues - a vector containing the numerical values for this data point
        weight - a double indicating how much weight this data point has, 1.0 being the standard weight. Not all algorithms make use of data points that have different weights.
      • DataPoint

        public DataPoint(Vec numericalValues)
        Creates a new data point that has no categorical variables and a weight of 1.0
        Parameters:
        numericalValues - a vector containing the numerical values for this data point
    • Method Detail

      • getWeight

        public double getWeight()
        Returns the weight that this data point carries.
        Returns:
        the weight that this data point carries.
      • setWeight

        public void setWeight(double weight)
        Set the weight that this data point should carry. The norm is 1.0
        Parameters:
        weight - the new weight value
        Throws:
        java.lang.ArithmeticException - if the weight value is not a number > 0
      • containsCategoricalData

        public boolean containsCategoricalData()
        Returns true if this data point contains any categorical variables, false otherwise.
        Returns:
        true if this data point contains any categorical variables, false otherwise.
      • getNumericalValues

        public Vec getNumericalValues()
        Returns the vector containing the numerical values. Altering this vector will effect this data point. If changes are going to be made, a clone of the vector should be made by the caller.
        Returns:
        the vector containing the numerical values.
      • containsNumericalData

        public boolean containsNumericalData()
        Returns true if the data point contains any numerical variables, false otherwise.
        Returns:
        true if the data point contains any numerical variables, false otherwise.
      • numNumericalValues

        public int numNumericalValues()
        Returns the number of numerical variables in this data point.
        Returns:
        the number of numerical variables in this data point.
      • getCategoricalValues

        public int[] getCategoricalValues()
        Returns the array of values for each category. Altering this array will effect this data point. If changes are going to be made, a clone of the array should be made by the caller.
        Returns:
        the array of values for each category.
      • numCategoricalValues

        public int numCategoricalValues()
        Returns the number of categorical variables in this data point.
        Returns:
        the number of categorical variables in this data point.
      • getCategoricalValue

        public int getCategoricalValue(int i)
        Parameters:
        i - the i'th categorical variable
        Returns:
        the value of the i'th categorical variable
      • getCategoricalData

        public CategoricalData[] getCategoricalData()
        Returns the array of Categorical Data information
        Returns:
        the array of Categorical Data information
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • clone

        public DataPoint clone()
        Creates a deep clone of this data point, such that altering either data point does not effect the other one.
        Overrides:
        clone in class java.lang.Object
        Returns:
        a deep clone of this data point.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.