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

Class ClassificationDataSet



  • public class ClassificationDataSet
    extends DataSet<ClassificationDataSet>
    ClassificationDataSet is a data set meant specifically for classification problems. The true class of each data point is stored separately from the data point, so that it can be feed into a learning algorithm and not interfere.
    Additional functionality specific to classification problems is also available.
    • Constructor Detail

      • ClassificationDataSet

        public ClassificationDataSet(DataSet dataSet,
                                     int predicting)
        Creates a new data set for classification problems.
        Parameters:
        dataSet - the source data set
        predicting - the categorical attribute to use as the target class
      • ClassificationDataSet

        public ClassificationDataSet(java.util.List<DataPoint> data,
                                     int predicting)
        Creates a new data set for classification problems from the given list of data points. It is assume the data points are consistent.
        Parameters:
        data - the list of data points for the problem.
        predicting - the categorical attribute to use as the target class
      • ClassificationDataSet

        public ClassificationDataSet(java.util.List<DataPointPair<java.lang.Integer>> data,
                                     CategoricalData predicting)
        Creates a new data set for classification problems from the given list of data points. The class value is paired with each data point.
        Parameters:
        data - the list of data points, paired with their class values
        predicting - the information about the target class
      • ClassificationDataSet

        public ClassificationDataSet(int numerical,
                                     CategoricalData[] categories,
                                     CategoricalData predicting)
        Creates a new, empty, data set for classification problems.
        Parameters:
        numerical - the number of numerical attributes for the problem
        categories - the information about each categorical variable in the problem.
        predicting - the information about the target class
    • Method Detail

      • getClassSize

        public int getClassSize()
        Returns the number of target classes in this classification data set. This value can also be obtained by calling getPredicting(). getNumOfCategories()
        Returns:
        the number of target classes for prediction
      • comineAllBut

        public static ClassificationDataSet comineAllBut(java.util.List<ClassificationDataSet> list,
                                                         int exception)
        A helper method meant to be used with DataSet.cvSet(int), this combines all classification data sets in a given list, but holding out the indicated list.
        Parameters:
        list - a list of data sets
        exception - the one data set in the list NOT to combine into one file
        Returns:
        a combination of all the data sets in list except the one at index exception
      • getDataPoint

        public DataPoint getDataPoint(int i)
        Returns the i'th data point from the data set
        Specified by:
        getDataPoint in class DataSet<ClassificationDataSet>
        Parameters:
        i - the i'th data point in this set
        Returns:
        the ith data point in this set
      • getDataPointPair

        public DataPointPair<java.lang.Integer> getDataPointPair(int i)
        Returns the i'th data point from the data set, paired with the integer indicating its true class
        Parameters:
        i - the i'th data point in this set
        Returns:
        the i'th data point from the data set, paired with the integer indicating its true class
      • setDataPoint

        public void setDataPoint(int i,
                                 DataPoint dp)
        Description copied from class: DataSet
        Replaces an already existing data point with the one given. Any values associated with the data point, but not apart of it, will remain intact.
        Specified by:
        setDataPoint in class DataSet<ClassificationDataSet>
        Parameters:
        i - the i'th dataPoint to set.
        dp - the data point to set at the specified index
      • getDataPointCategory

        public int getDataPointCategory(int i)
        Returns the integer value corresponding to the true category of the i'th data point.
        Parameters:
        i - the i'th data point.
        Returns:
        the integer value for the category of the i'th data point.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index into the data set.
      • addDataPoint

        public void addDataPoint(Vec v,
                                 int[] classes,
                                 int classification)
        Creates a new data point and adds it to this data set.
        Parameters:
        v - the numerical values for the data point
        classes - the categorical values for the data point
        classification - the true class value for the data point
        Throws:
        java.lang.IllegalArgumentException - if the given values are inconsistent with the data this class stores.
      • addDataPoint

        public void addDataPoint(Vec v,
                                 int classification)
        Creates a new data point with no categorical variables and adds it to this data set.
        Parameters:
        v - the numerical values for the data point
        classification - the true class value for the data point
        Throws:
        java.lang.IllegalArgumentException - if the given values are inconsistent with the data this class stores.
      • addDataPoint

        public void addDataPoint(Vec v,
                                 int classification,
                                 double weight)
        Creates a new data point with no categorical variables and adds it to this data set.
        Parameters:
        v - the numerical values for the data point
        classification - the true class value for the data point
        weight - the weight value to give to the data point
        Throws:
        java.lang.IllegalArgumentException - if the given values are inconsistent with the data this class stores.
      • addDataPoint

        public void addDataPoint(Vec v,
                                 int[] classes,
                                 int classification,
                                 double weight)
        Creates a new data point and add its to this data set.
        Parameters:
        v - the numerical values for the data point
        classes - the categorical values for the data point
        classification - the true class value for the data point
        weight - the weight value to give to the data point
        Throws:
        java.lang.IllegalArgumentException - if the given values are inconsistent with the data this class stores.
      • addDataPoint

        public void addDataPoint(DataPoint dp,
                                 int classification)
        Creates a new data point and add it
        Parameters:
        dp - the data point to add to this set
        classification - the label for this data point
      • getSamples

        public java.util.List<DataPoint> getSamples(int category)
        Returns the list of all examples that belong to the given category.
        Parameters:
        category - the category desired
        Returns:
        all given examples that belong to the given category
      • getSampleVariableVector

        public Vec getSampleVariableVector(int category,
                                           int n)
        This method is a counter part to DataSet.getNumericColumn(int). Instead of returning all values for a given attribute, all values for the attribute that are members of a specific class are returned.
        Parameters:
        category - the category desired
        n - the n'th numerical variable
        Returns:
        a vector of all the values for the n'th numerical variable for the given category
      • getAsDPPList

        public java.util.List<DataPointPair<java.lang.Integer>> getAsDPPList()
        Returns the data set as a list of DataPointPair. Each data point is paired with it's true class value. Altering the data points will effect the data set. Altering the list will not.
        The list of data points will come in the same order they would be retrieved in using getDataPoint(int)
        Returns:
        a list of each data point paired with its class value
      • getAsFloatDPPList

        public java.util.List<DataPointPair<java.lang.Double>> getAsFloatDPPList()
        Returns the data set as a list of DataPointPair. Each data point is paired with it's true class value, which is stored in a double. Altering the data points will effect the data set. Altering the list will not.
        The list of data points will come in the same order they would be retrieved in using getDataPoint(int)
        Returns:
        a list of each data point paired with its class value stored in a double
      • getPriors

        public double[] getPriors()
        Computes the prior probabilities of each class, and returns an array containing the values.
        Returns:
        the array of prior probabilities
      • classSampleCount

        public int classSampleCount(int targetClass)
        Returns the number of data points that belong to the specified class, irrespective of the weights of the individual points.
        Parameters:
        targetClass - the target class
        Returns:
        how many data points belong to the given class
      • getSampleSize

        public int getSampleSize()
        Description copied from class: DataSet
        Returns the number of data points in this data set
        Specified by:
        getSampleSize in class DataSet<ClassificationDataSet>
        Returns:
        the number of data points in this data set
      • getTwiceShallowClone

        public ClassificationDataSet getTwiceShallowClone()
        Description copied from class: DataSet
        Returns a new version of this data set that is of the same type, and contains a different listing pointing to shallow data point copies. Because the data point object contains the weight itself, the weight is not shared - while the vector and array information is. This allows altering the weights of the data points while preserving the original weights.
        Altering the list or weights of the returned data set will not be reflected in the original. Altering the feature values will.
        Overrides:
        getTwiceShallowClone in class DataSet<ClassificationDataSet>
        Returns:
        a shallow copy of shallow data point copies for this data set.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.