mirror of https://github.com/apache/lucene.git
LUCENE-6045 - fixed javadocs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1677367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62b73edde1
commit
11c4a88e23
|
@ -64,6 +64,20 @@ public class BooleanPerceptronClassifier implements Classifier<Boolean> {
|
||||||
private final String textFieldName;
|
private final String textFieldName;
|
||||||
private FST<Long> fst;
|
private FST<Long> fst;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link BooleanPerceptronClassifier}
|
||||||
|
*
|
||||||
|
* @param leafReader the reader on the index to be used for classification
|
||||||
|
* @param textFieldName the name of the field used as input for the classifier
|
||||||
|
* @param classFieldName the name of the field used as the output for the classifier
|
||||||
|
* @param analyzer an {@link Analyzer} used to analyze unseen text
|
||||||
|
* @param query a {@link Query} to eventually filter the docs used for training the classifier, or {@code null}
|
||||||
|
* if all the indexed docs should be used
|
||||||
|
* @param batchSize the size of the batch of docs to use for updating the perceptron weights
|
||||||
|
* @param threshold the threshold used for class separation
|
||||||
|
* @throws IOException if the building of the underlying {@link FST} fails and / or {@link TermsEnum} for the text field
|
||||||
|
* cannot be found
|
||||||
|
*/
|
||||||
public BooleanPerceptronClassifier(LeafReader leafReader, String textFieldName, String classFieldName, Analyzer analyzer,
|
public BooleanPerceptronClassifier(LeafReader leafReader, String textFieldName, String classFieldName, Analyzer analyzer,
|
||||||
Query query, Integer batchSize, Double threshold) throws IOException {
|
Query query, Integer batchSize, Double threshold) throws IOException {
|
||||||
this.textTerms = MultiFields.getTerms(leafReader, textFieldName);
|
this.textTerms = MultiFields.getTerms(leafReader, textFieldName);
|
||||||
|
|
|
@ -59,8 +59,15 @@ public class CachingNaiveBayesClassifier extends SimpleNaiveBayesClassifier {
|
||||||
private int docsWithClassSize;
|
private int docsWithClassSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new NaiveBayes classifier with inside caching. If you want less memory usage you could
|
* Creates a new NaiveBayes classifier with inside caching. If you want less memory usage you could call
|
||||||
* call {@link #reInitCache(int, boolean) reInitCache()}.
|
* {@link #reInitCache(int, boolean) reInitCache()}.
|
||||||
|
*
|
||||||
|
* @param leafReader the reader on the index to be used for classification
|
||||||
|
* @param analyzer an {@link Analyzer} used to analyze unseen text
|
||||||
|
* @param query a {@link Query} to eventually filter the docs used for training the classifier, or {@code null}
|
||||||
|
* if all the indexed docs should be used
|
||||||
|
* @param classFieldName the name of the field used as the output for the classifier
|
||||||
|
* @param textFieldNames the name of the fields used as the inputs for the classifier
|
||||||
*/
|
*/
|
||||||
public CachingNaiveBayesClassifier(LeafReader leafReader, Analyzer analyzer, Query query, String classFieldName, String... textFieldNames) {
|
public CachingNaiveBayesClassifier(LeafReader leafReader, Analyzer analyzer, Query query, String classFieldName, String... textFieldNames) {
|
||||||
super(leafReader, analyzer, query, classFieldName, textFieldNames);
|
super(leafReader, analyzer, query, classFieldName, textFieldNames);
|
||||||
|
|
|
@ -53,6 +53,19 @@ public class KNearestNeighborClassifier implements Classifier<BytesRef> {
|
||||||
private final int k;
|
private final int k;
|
||||||
private final Query query;
|
private final Query query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link KNearestNeighborClassifier}.
|
||||||
|
*
|
||||||
|
* @param leafReader the reader on the index to be used for classification
|
||||||
|
* @param analyzer an {@link Analyzer} used to analyze unseen text
|
||||||
|
* @param query a {@link Query} to eventually filter the docs used for training the classifier, or {@code null}
|
||||||
|
* if all the indexed docs should be used
|
||||||
|
* @param k the no. of docs to select in the MLT results to find the nearest neighbor
|
||||||
|
* @param minDocsFreq {@link MoreLikeThis#minDocFreq} parameter
|
||||||
|
* @param minTermFreq {@link MoreLikeThis#minTermFreq} parameter
|
||||||
|
* @param classFieldName the name of the field used as the output for the classifier
|
||||||
|
* @param textFieldNames the name of the fields used as the inputs for the classifier
|
||||||
|
*/
|
||||||
public KNearestNeighborClassifier(LeafReader leafReader, Analyzer analyzer, Query query, int k, int minDocsFreq,
|
public KNearestNeighborClassifier(LeafReader leafReader, Analyzer analyzer, Query query, int k, int minDocsFreq,
|
||||||
int minTermFreq, String classFieldName, String... textFieldNames) {
|
int minTermFreq, String classFieldName, String... textFieldNames) {
|
||||||
this.textFieldNames = textFieldNames;
|
this.textFieldNames = textFieldNames;
|
||||||
|
|
|
@ -80,7 +80,13 @@ public class SimpleNaiveBayesClassifier implements Classifier<BytesRef> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new NaiveBayes classifier.
|
* Creates a new NaiveBayes classifier.
|
||||||
* classify any documents.
|
*
|
||||||
|
* @param leafReader the reader on the index to be used for classification
|
||||||
|
* @param analyzer an {@link Analyzer} used to analyze unseen text
|
||||||
|
* @param query a {@link Query} to eventually filter the docs used for training the classifier, or {@code null}
|
||||||
|
* if all the indexed docs should be used
|
||||||
|
* @param classFieldName the name of the field used as the output for the classifier
|
||||||
|
* @param textFieldNames the name of the fields used as the inputs for the classifier
|
||||||
*/
|
*/
|
||||||
public SimpleNaiveBayesClassifier(LeafReader leafReader, Analyzer analyzer, Query query, String classFieldName, String... textFieldNames) {
|
public SimpleNaiveBayesClassifier(LeafReader leafReader, Analyzer analyzer, Query query, String classFieldName, String... textFieldNames) {
|
||||||
this.leafReader = leafReader;
|
this.leafReader = leafReader;
|
||||||
|
@ -183,7 +189,7 @@ public class SimpleNaiveBayesClassifier implements Classifier<BytesRef> {
|
||||||
q.add(query, BooleanClause.Occur.MUST);
|
q.add(query, BooleanClause.Occur.MUST);
|
||||||
}
|
}
|
||||||
indexSearcher.search(q,
|
indexSearcher.search(q,
|
||||||
totalHitCountCollector);
|
totalHitCountCollector);
|
||||||
docCount = totalHitCountCollector.getTotalHits();
|
docCount = totalHitCountCollector.getTotalHits();
|
||||||
}
|
}
|
||||||
return docCount;
|
return docCount;
|
||||||
|
|
Loading…
Reference in New Issue