jsat.classifiers
Class CategoricalData
- java.lang.Object
-
- jsat.classifiers.CategoricalData
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class CategoricalData extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description CategoricalData(int n)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalDataclone()static CategoricalData[]copyOf(CategoricalData[] orig)java.lang.StringgetCategoryName()intgetNumOfCategories()java.lang.StringgetOptionName(int i)booleanisValidCategory(int i)Returns true if the given input is a valid category index for this object.voidsetCategoryName(java.lang.String categoryName)booleansetOptionName(java.lang.String name, int i)Sets the name of one of the value options.
-
-
-
Constructor Detail
-
CategoricalData
public CategoricalData(int n)
- Parameters:
n- the number of categories
-
-
Method Detail
-
getNumOfCategories
public int getNumOfCategories()
- Returns:
- the number of possible categories there are for this category
-
isValidCategory
public boolean isValidCategory(int i)
Returns true if the given input is a valid category index for this object. Missing values (negative categories) do not count.- Parameters:
i- the index for a category in this object- Returns:
trueif it was a valid category,falseotherwise.
-
getOptionName
public java.lang.String getOptionName(int i)
-
getCategoryName
public java.lang.String getCategoryName()
-
setCategoryName
public void setCategoryName(java.lang.String categoryName)
-
setOptionName
public boolean setOptionName(java.lang.String name, int i)Sets the name of one of the value options. Duplicate names are not allowed. Trying to set the name of a non existent option will result in false being returned.
All names will be converted to lower case- Parameters:
name- the name to givei- the ith index to set.- Returns:
- true if the name was set. False if the name could not be set.
-
clone
public CategoricalData clone()
- Overrides:
clonein classjava.lang.Object
-
copyOf
public static CategoricalData[] copyOf(CategoricalData[] orig)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG