- java.lang.Object
-
- com.pervasive.datarush.analytics.knn.ClassificationScheme
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
VotingClassification
public abstract class ClassificationScheme extends Object implements Serializable
Determines how to classify a query record based on its nearest neighbors.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ClassificationScheme.Classifier
Resolves the class of a query record from a set of neighbors.static class
ClassificationScheme.Distance
Representation of the distance between two points.
-
Constructor Summary
Constructors Constructor Description ClassificationScheme()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ClassificationScheme
avg()
Resolves the class of the query record by doing a straight average of all neighbors.abstract boolean
isValidTargetType(ScalarTokenType type)
Indicates whether the classification method is valid for the specified type.abstract ClassificationScheme.Classifier
newClassifier(int k)
Creates a new classifier for use.static ClassificationScheme
vote()
Resolves the class of the query records by simple plurality of all neighbors (alternatively, the mode of the neighbors).
-
-
-
Method Detail
-
isValidTargetType
public abstract boolean isValidTargetType(ScalarTokenType type)
Indicates whether the classification method is valid for the specified type. Some classifiers may only be applicable to continuous data.- Parameters:
type
- the type of the class data- Returns:
true
if the data type is compatible,false
otherwise.
-
newClassifier
public abstract ClassificationScheme.Classifier newClassifier(int k)
Creates a new classifier for use.- Parameters:
k
- the number of neighbors to expect.- Returns:
- a new classifier
-
avg
public static ClassificationScheme avg()
Resolves the class of the query record by doing a straight average of all neighbors.This scheme is only applicable when the target feature is a continuous data type.
- Returns:
- a method which averages the neighbors
-
vote
public static ClassificationScheme vote()
Resolves the class of the query records by simple plurality of all neighbors (alternatively, the mode of the neighbors). In case of a tie, the class of the nearest neighbor is returned.- Returns:
- a method which decides by a vote of neighbors
-
-