public class ConditionalProbabilityTable extends Object implements Classifier
Constructor and Description |
---|
ConditionalProbabilityTable() |
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
Classifier |
clone() |
int |
dataPointToCord(DataPointPair<Integer> dataPoint,
int targetClass,
int[] cord)
Converts a data point pair into a coordinate.
|
int |
getDimensionSize()
Returns the number of dimensions in the CPT
|
double |
query(int targetClass,
DataPointPair<Integer> dataPoint)
Queries the CPT for the probability that the class value of targetClas would occur with the given DataPointPair.
|
double |
query(int targetClass,
int targetValue,
int[] cord)
Queries the CPT for the probability of the target class occurring with the specified value given the class values of the other attributes
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
Set<Integer> categoriesToUse)
Creates a CPT using only a subset of the features specified by categoriesToUse.
|
public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic int getDimensionSize()
public int dataPointToCord(DataPointPair<Integer> dataPoint, int targetClass, int[] cord)
dataPoint
- the DataPointPair to converttargetClass
- the index in the original data set of the category that we would like to predictcord
- the array to store the coordinate in.ArithmeticException
- if the cord array does not match the dimension
of the CPTpublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic void trainC(ClassificationDataSet dataSet, Set<Integer> categoriesToUse)
dataSet
- the data set to train fromcategoriesToUse
- the attributes to use in training. Each value corresponds to the categorical
index in dataSet, and adding the value DataSet.getNumCategoricalVars()
, which is
not a valid index, indicates to used the predicting class
of the data set in the CPT.public double query(int targetClass, DataPointPair<Integer> dataPoint)
targetClass
- the index in the original data set of the class that we want the probability ofdataPoint
- the data point of values paired with the value of the predicting attribute in the original training setpublic double query(int targetClass, int targetValue, int[] cord)
targetClass
- the index in the original data set of the class that we want to probability oftargetValue
- the value of the targetClass that we want to probability of occurringcord
- the coordinate array that corresponds the the class values for the CPT, where the coordinate of the targetClass may contain any value.dataPointToCord(jsat.classifiers.DataPointPair, int, int[])
public boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
public Classifier clone()
clone
in interface Classifier
clone
in class Object
Copyright © 2017. All rights reserved.