Show / Hide Table of Contents

Class Ocjknn

One Class JKNN classifier based on: Khan, Shehroz Saeed. "Kernels for one-class nearest neighbour classification and comparison of chemical spectral data." College of Engineering and Informatics, National University of Ireland (2010). https://cs.uwaterloo.ca/~s255khan/files/Kernels_for_One-Class_Nearest_Neighbour_Classification_and_Comparison_of_Chemical_Spectral_Data-libre.pdf

Inheritance
System.Object
Ocjknn
Namespace: SigStat.Common.Algorithms.Classifiers
Assembly: SigStat.Common.dll
Syntax
public static class Ocjknn : object

Methods

| Improve this Doc View Source

Test<T>(T, IEnumerable<T>, Int32, Int32, Double, Func<T, T, Double>)

Step 1: find the j nearest neighbors of testItem in the set of targetItems. Step 2: for each neighbor, if (distance from test) / (average distance from k nearest neighbors) < threshold accept++ Steo 3: return accept / j

Declaration
public static double Test<T>(T testItem, IEnumerable<T> targetItems, int j, int k, double threshold, Func<T, T, double> distanceFunction)
Parameters
Type Name Description
T testItem

The item, that we want to classify

IEnumerable<T> targetItems

Items belonging to the target class

System.Int32 j

See algorithm description for details

System.Int32 k

See algorithm description for details

System.Double threshold

See algorithm description for details

Func<T, T, System.Double> distanceFunction

Calculates the distance between two items of type T

Returns
Type Description
System.Double

If the result is 0.5 or greater, then testItem should be accepted as a member of target class

Type Parameters
Name Description
T

Item type (typically a vector or a label, that distanceFunction can work with)

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX