Class ClassificationScheme

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:
  • Constructor Details

    • ClassificationScheme

      public ClassificationScheme()
  • Method Details

    • 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