jsat.regression
Class RegressionDataSet
- java.lang.Object
-
- jsat.DataSet<RegressionDataSet>
-
- jsat.regression.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 Summary
Constructors Constructor and Description RegressionDataSet(int numerical, CategoricalData[] categories)Creates a new empty data set for regressionRegressionDataSet(java.util.List<DataPoint> data, int predicting)Creates a new data set for the given list of data points.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddDataPoint(DataPoint dp, double val)voidaddDataPoint(Vec numerical, double val)Creates a new data point with no categorical variables to be added to the data set.voidaddDataPoint(Vec numerical, int[] categories, double val)Creates a new data point to be added to the data set.voidaddDataPointPair(DataPointPair<java.lang.Double> pair)static RegressionDataSetcomineAllBut(java.util.List<RegressionDataSet> list, int exception)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.DataPointgetDataPoint(int i)Returns the i'th data point in this set.DataPointPair<java.lang.Double>getDataPointPair(int i)Returns the i'th data point in the data set paired with its target regressor value.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.intgetSampleSize()Returns the number of data points in this data setdoublegetTargetValue(int i)Returns the target regression value for the i'th data point in the data set.VecgetTargetValues()Returns a vector containing the target regression values for each data point.RegressionDataSetgetTwiceShallowClone()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.voidsetDataPoint(int i, DataPoint dp)Replaces an already existing data point with the one given.voidsetTargetValue(int i, double val)Sets the target regression value associated with a given data pointRegressionDataSetshallowClone()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.static RegressionDataSetusingDPPList(java.util.List<DataPointPair<java.lang.Double>> list)Creates a new data set that uses the given list as its backing list.-
Methods inherited from class jsat.DataSet
applyTransform, applyTransform, applyTransform, applyTransform, countMissingValues, cvSet, cvSet, getCategories, getCategoryName, getColumnMeanVariance, getDataMatrix, getDataMatrixView, getDataPointIterator, getDataPoints, getDataVectors, getDataWeights, getMissingDropped, getNumCategoricalVars, getNumericColumn, getNumericColumns, getNumericColumns, getNumericName, getNumFeatures, getNumNumericalVars, getOnlineColumnStats, getOnlineDenseStats, getSparsityStats, randomSplit, randomSplit, replaceNumericFeatures, setNumericName
-
-
-
-
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 valuecategories- 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 frompredicting- 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
-
comineAllBut
public static RegressionDataSet comineAllBut(java.util.List<RegressionDataSet> list, int exception)
-
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 pointcategories- the categorical values for the data pointval- 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:DataSetReturns 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:
getDataPointin classDataSet<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 thegetAsDPPList()method.- Returns:
- a list of the data points in this set
-
setDataPoint
public void setDataPoint(int i, DataPoint dp)Description copied from class:DataSetReplaces 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:
setDataPointin classDataSet<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 setval- the new target value- Throws:
java.lang.ArithmeticException- if val is infinite or NaN
-
getSampleSize
public int getSampleSize()
Description copied from class:DataSetReturns the number of data points in this data set- Specified by:
getSampleSizein classDataSet<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:DataSetReturns 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:
shallowClonein classDataSet<RegressionDataSet>- Returns:
- a shallow copy of this data set
-
getTwiceShallowClone
public RegressionDataSet getTwiceShallowClone()
Description copied from class:DataSetReturns 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:
getTwiceShallowClonein classDataSet<RegressionDataSet>- Returns:
- a shallow copy of shallow data point copies for this data set.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG