public class DataPoint extends Object implements Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
protected CategoricalData[] |
categoricalData |
protected int[] |
categoricalValues |
protected Vec |
numericalValues |
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
|
Modifier and Type | Method and Description |
---|---|
DataPoint |
clone()
Creates a deep clone of this data point, such that altering either data point does not effect the other one.
|
boolean |
containsCategoricalData()
Returns true if this data point contains any categorical variables, false otherwise.
|
boolean |
containsNumericalData()
Returns true if the data point contains any numerical variables, false otherwise.
|
CategoricalData[] |
getCategoricalData()
Returns the array of Categorical Data information
|
int |
getCategoricalValue(int i) |
int[] |
getCategoricalValues()
Returns the array of values for each category.
|
Vec |
getNumericalValues()
Returns the vector containing the numerical values.
|
double |
getWeight()
Returns the weight that this data point carries.
|
int |
numCategoricalValues()
Returns the number of categorical variables in this data point.
|
int |
numNumericalValues()
Returns the number of numerical variables in this data point.
|
void |
setWeight(double weight)
Set the weight that this data point should carry.
|
String |
toString() |
protected Vec numericalValues
protected int[] categoricalValues
protected CategoricalData[] categoricalData
public DataPoint(Vec numericalValues, int[] categoricalValues, CategoricalData[] categoricalData)
numericalValues
- a vector containing the numerical values for this data pointcategoricalValues
- an array of the category values for this data pointcategoricalData
- an array of the category information of this data pointpublic DataPoint(Vec numericalValues, int[] categoricalValues, CategoricalData[] categoricalData, double weight)
numericalValues
- a vector containing the numerical values for this data pointcategoricalValues
- an array of the category values for this data pointcategoricalData
- an array of the category information of this data pointweight
- 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.public DataPoint(Vec numericalValues, double weight)
numericalValues
- a vector containing the numerical values for this data pointweight
- 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.public DataPoint(Vec numericalValues)
numericalValues
- a vector containing the numerical values for this data pointpublic double getWeight()
public void setWeight(double weight)
weight
- the new weight valueArithmeticException
- if the weight value is not a number > 0public boolean containsCategoricalData()
public Vec getNumericalValues()
public boolean containsNumericalData()
public int numNumericalValues()
public int[] getCategoricalValues()
public int numCategoricalValues()
public int getCategoricalValue(int i)
i
- the i'th categorical variablepublic CategoricalData[] getCategoricalData()
Copyright © 2017. All rights reserved.