Show / Hide Table of Contents

    Class KNearestNeighborClassifier

    A k-Nearest Neighbor classifier (see

    http://en.wikipedia.org/wiki/K-nearest_neighbors
    ) based on MoreLikeThis

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    KNearestNeighborClassifier
    Implements
    IClassifier<BytesRef>
    Namespace: Lucene.Net.Classification
    Assembly: Lucene.Net.Classification.dll
    Syntax
    public class KNearestNeighborClassifier : object, IClassifier<BytesRef>

    Constructors

    | Improve this Doc View Source

    KNearestNeighborClassifier(Int32)

    Create a IClassifier<T> using kNN algorithm

    Declaration
    public KNearestNeighborClassifier(int k)
    Parameters
    Type Name Description
    System.Int32 k

    the number of neighbors to analyze as an

    | Improve this Doc View Source

    KNearestNeighborClassifier(Int32, Int32, Int32)

    Create a IClassifier<T> using kNN algorithm

    Declaration
    public KNearestNeighborClassifier(int k, int minDocsFreq, int minTermFreq)
    Parameters
    Type Name Description
    System.Int32 k

    the number of neighbors to analyze as an

    System.Int32 minDocsFreq

    the minimum number of docs frequency for MLT to be set with MinDocFreq

    System.Int32 minTermFreq

    the minimum number of term frequency for MLT to be set with MinTermFreq

    Methods

    | Improve this Doc View Source

    AssignClass(String)

    Assign a class (with score) to the given text string

    Declaration
    public virtual ClassificationResult<BytesRef> AssignClass(string text)
    Parameters
    Type Name Description
    System.String text

    a string containing text to be classified

    Returns
    Type Description
    ClassificationResult<BytesRef>

    a ClassificationResult<T> holding assigned class of type BytesRef and score

    | Improve this Doc View Source

    Train(AtomicReader, String, String, Analyzer)

    Train the classifier using the underlying Lucene index

    Declaration
    public virtual void Train(AtomicReader atomicReader, string textFieldName, string classFieldName, Analyzer analyzer)
    Parameters
    Type Name Description
    AtomicReader atomicReader

    the reader to use to access the Lucene index

    System.String textFieldName

    the name of the field used to compare documents

    System.String classFieldName

    the name of the field containing the class assigned to documents

    Analyzer analyzer

    the analyzer used to tokenize / filter the unseen text

    | Improve this Doc View Source

    Train(AtomicReader, String, String, Analyzer, Query)

    Train the classifier using the underlying Lucene index

    Declaration
    public virtual void Train(AtomicReader atomicReader, string textFieldName, string classFieldName, Analyzer analyzer, Query query)
    Parameters
    Type Name Description
    AtomicReader atomicReader

    the reader to use to access the Lucene index

    System.String textFieldName

    the name of the field used to compare documents

    System.String classFieldName

    the name of the field containing the class assigned to documents

    Analyzer analyzer

    the analyzer used to tokenize / filter the unseen text

    Query query

    the query to filter which documents use for training

    | Improve this Doc View Source

    Train(AtomicReader, String[], String, Analyzer, Query)

    Train the classifier using the underlying Lucene index

    Declaration
    public virtual void Train(AtomicReader atomicReader, string[] textFieldNames, string classFieldName, Analyzer analyzer, Query query)
    Parameters
    Type Name Description
    AtomicReader atomicReader

    the reader to use to access the Lucene index

    System.String[] textFieldNames

    the names of the fields to be used to compare documents

    System.String classFieldName

    the name of the field containing the class assigned to documents

    Analyzer analyzer

    the analyzer used to tokenize / filter the unseen text

    Query query

    the query to filter which documents use for training

    Implements

    IClassifier<T>
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)