|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.android.activityminer.logic.classification.KNN
public class KNN
| Field Summary | |
|---|---|
private String[] |
attributeNames
The attribute names per point index of a trained KNN instance |
private boolean |
doNormalize
The normalization configuration flag. |
private KdTree<Long> |
kdTree
The k-dimensional tree. |
private int |
neighborCount
The count of neighbors. |
private Normalizer |
normalizer
The attribute value normalizer. |
| Constructor Summary | |
|---|---|
KNN(int neighborCount,
boolean doNormalize)
Constructor |
|
KNN(List<ModelElement> pmmlModelElements,
ActivityMinerExtension extension)
Constructor |
|
| Method Summary | |
|---|---|
protected void |
addPoint(double[] point,
long cId)
Does add a data point to the tree. |
PredictionResult |
classify(Activity activity)
Does classify the given sample |
private void |
fromPMMLModel(NearestNeighborModel nearestNeighborModel)
Method to create the classifier model from a PMML nearest neighbor model. |
void |
fromPMMLModelElements(List<ModelElement> modelElements,
ActivityMinerExtension extension)
Method to create the classifier model from PMML model elements. |
String[] |
getAttributeNames()
Getter for the known attribute names |
String |
getDescription(Context context)
Getter for a significant description of the configured classifier. |
static String |
getDescription(Context context,
int neighborCount,
boolean normalized)
Getter for a significant description of a classifier with the given configuration parameters. |
KdTree<Long> |
getKdTree()
Getter for the k-dimensional tree |
int |
getNeighborCount()
Getter for the neighbor count |
Normalizer |
getNormalizer()
Getter for the normalizer |
protected void |
prepare(String[] attributeNames,
int size)
Does prepare the classifier. |
List<ModelElement> |
toPMMLModelElements(Context context,
DataDictionary dataDictionary)
Getter for the PMML model elements. |
void |
train(Set<? extends Activity> trainingSet)
Does initialize and train the classifier (internal model creation) |
private void |
trainPMMLModel(List<Row> rows,
String[] orderedAttributeCols)
Does train the classifier model from PMML data |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private KdTree<Long> kdTree
private String[] attributeNames
private int neighborCount
private boolean doNormalize
private Normalizer normalizer
| Constructor Detail |
|---|
public KNN(int neighborCount,
boolean doNormalize)
neighborCount - the count of nearest neighbors to use for decisiondoNormalize - if true attributes will be normalized to the range of [0,1]
public KNN(List<ModelElement> pmmlModelElements,
ActivityMinerExtension extension)
pmmlModelElements - the PMML model elements to build fromextension - the activity mine specific extensions| Method Detail |
|---|
public final String[] getAttributeNames()
public final int getNeighborCount()
public final KdTree<Long> getKdTree()
public Normalizer getNormalizer()
public final void train(Set<? extends Activity> trainingSet)
Classifier
train in interface ClassifiertrainingSet - the training set
protected final void prepare(String[] attributeNames,
int size)
attributeNames - the attribute names for the point dimensionssize - the tree size
protected final void addPoint(double[] point,
long cId)
point - the data point to addcId - the class identifierpublic final PredictionResult classify(Activity activity)
Classifier
classify in interface Classifieractivity - the activity to classify
public final String getDescription(Context context)
Classifier
getDescription in interface Classifiercontext - the context
public static final String getDescription(Context context,
int neighborCount,
boolean normalized)
context - the contextneighborCount - the neighbor countnormalized - normalization flag
public final List<ModelElement> toPMMLModelElements(Context context,
DataDictionary dataDictionary)
Classifiermining schema
and the output fields can be ignored, they will be
overridden by the calling
instance based on the actual configuration.
toPMMLModelElements in interface Classifiercontext - the contextdataDictionary - the data dictionary
public final void fromPMMLModelElements(List<ModelElement> modelElements,
ActivityMinerExtension extension)
Classifier
fromPMMLModelElements in interface ClassifiermodelElements - the model elements to build model fromextension - the activity mine specific extensionsprivate final void fromPMMLModel(NearestNeighborModel nearestNeighborModel)
nearestNeighborModel - the knn model
private void trainPMMLModel(List<Row> rows,
String[] orderedAttributeCols)
rows - the rows with the training dataorderedAttributeCols - the column names in the order of corresponding attribute names
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||