Documentation of 'jsat.regression.RegressionDataSet' Java class
RegressionDataSet
jsat.regression

Class RegressionDataSet



  • public class RegressionDataSet
    extends DataSet<RegressionDataSet>
    A RegressionDataSet is a data set specifically for the task of performing regression. Each data point is paired with s double value that indicates its true regression value. An example of a regression problem would be mapping the inputs of a function to its outputs, and attempting to learn the function from the samples.
    • Constructor Detail

      • RegressionDataSet

        public RegressionDataSet(int numerical,
                                 CategoricalData[] categories)
        Creates a new empty data set for regression
        Parameters:
        numerical - the number of numerical attributes that will be used, excluding the regression value
        categories - an array of length equal to the number of categorical attributes, each object describing the attribute in question
      • RegressionDataSet

        public RegressionDataSet(java.util.List<DataPoint> data,
                                 int predicting)
        Creates a new data set for the given list of data points. The data points will be copied, changes in one will not effect the other.
        Parameters:
        data - the list of data point to create a data set from
        predicting - which of the numerical attributes is the regression target. Categorical attributes are ignored in the count of attributes for this value.
      • RegressionDataSet

        public RegressionDataSet(java.util.List<DataPointPair<java.lang.Double>> list)
        Creates a new regression data set by copying all the data points in the given list. Alterations to this list will not effect this DataSet.
        Parameters:
        list - source of data points to copy
    • Method Detail

      • addDataPoint

        public void addDataPoint(Vec numerical,
                                 double val)
        Creates a new data point with no categorical variables to be added to the data set. The arguments will be used directly, modifying them after will effect the data set.
        Parameters:
        numerical - the numerical values 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 numerical,
                                 int[] categories,
                                 double val)
        Creates a new data point to be added to the data set. The arguments will be used directly, modifying them after will effect the data set.
        Parameters:
        numerical - the numerical values for the data point
        categories - the categorical values for the data point
        val - the target value to predict
        Throws:
        java.lang.IllegalArgumentException - if the given values are inconsistent with the data this class stores.
      • addDataPoint

        public void addDataPoint(DataPoint dp,
                                 double val)
      • addDataPointPair

        public void addDataPointPair(DataPointPair<java.lang.Double> pair)
      • getDataPoint

        public DataPoint getDataPoint(int i)
        Description copied from class: DataSet
        Returns the i'th data point in this set. The order will never chance so long as no data points are added or removed from the set.
        Specified by:
        getDataPoint in class DataSet<RegressionDataSet>
        Parameters:
        i - the i'th data point in this set
        Returns:
        the i'th data point in this set
      • getDataPointPair

        public DataPointPair<java.lang.Double> getDataPointPair(int i)
        Returns the i'th data point in the data set paired with its target regressor value. Modifying the DataPointPair will effect the data set.
        Parameters:
        i - the index of the data point to obtain
        Returns:
        the i'th DataPOintPair
      • getAsDPPList

        public java.util.List<DataPointPair<java.lang.Double>> getAsDPPList()
        Returns a new list containing copies of the data points in this data set, paired with their regression target values. MModifications to the list or data points will not effect this data set
        Returns:
        a list of copies of the data points in this set
      • getDPPList

        public java.util.List<DataPointPair<java.lang.Double>> getDPPList()
        Returns a new list containing the data points in this data set, paired with their regression target values. Modifications to the list will not effect the data set, but modifying the points will. For a copy of the points, use the getAsDPPList() method.
        Returns:
        a list of the data points in this set
      • 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<RegressionDataSet>
        Parameters:
        i - the i'th dataPoint to set.
        dp - the data point to set at the specified index
      • setTargetValue

        public void setTargetValue(int i,
                                   double val)
        Sets the target regression value associated with a given data point
        Parameters:
        i - the index in the data set
        val - the new target value
        Throws:
        java.lang.ArithmeticException - if val is infinite or NaN
      • 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<RegressionDataSet>
        Returns:
        the number of data points in this data set
      • getTargetValues

        public Vec getTargetValues()
        Returns a vector containing the target regression values for each data point. The vector is a copy, and modifications to it will not effect the data set.
        Returns:
        a vector containing the target values for each data point
      • getTargetValue

        public double getTargetValue(int i)
        Returns the target regression value for the i'th data point in the data set.
        Parameters:
        i - the data point to get the regression value of
        Returns:
        the target regression value
      • usingDPPList

        public static RegressionDataSet usingDPPList(java.util.List<DataPointPair<java.lang.Double>> list)
        Creates a new data set that uses the given list as its backing list. No copying is done, and changes to this list will be reflected in this data set, and the other way.
        Parameters:
        list - the list of datapoint to back a new data set with
        Returns:
        a new data set
      • shallowClone

        public RegressionDataSet shallowClone()
        Description copied from class: DataSet
        Returns a new version of this data set that is of the same type, and contains a different list pointing to the same data points.
        Specified by:
        shallowClone in class DataSet<RegressionDataSet>
        Returns:
        a shallow copy of this data set
      • getTwiceShallowClone

        public RegressionDataSet 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<RegressionDataSet>
        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.