Class KNNTrainer<T extends Output<T>>
java.lang.Object
org.tribuo.common.nearest.KNNTrainer<T>
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>,Trainer<T>
A
Trainer for k-nearest neighbour models.-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionKNNTrainer(int k, int numThreads, EnsembleCombiner<T> combiner, KNNModel.Backend backend, NeighboursQueryFactory neighboursQueryFactory) Creates a K-NN trainer using the supplied parameters.KNNTrainer(int k, KNNTrainer.Distance distance, int numThreads, EnsembleCombiner<T> combiner, KNNModel.Backend backend) Deprecated.This Constructor is deprecated in version 4.3.KNNTrainer(int k, Distance dist, int numThreads, EnsembleCombiner<T> combiner, KNNModel.Backend backend, NeighboursQueryFactoryType nqFactoryType) Creates a K-NN trainer using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionintvoidUsed by the OLCUT configuration system, and should not be called by external code.voidsetInvocationCount(int invocationCount) toString()train(Dataset<T> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) train(Dataset<T> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance, int invocationCount)
-
Constructor Details
-
KNNTrainer
public KNNTrainer(int k, Distance dist, int numThreads, EnsembleCombiner<T> combiner, KNNModel.Backend backend, NeighboursQueryFactoryType nqFactoryType) Creates a K-NN trainer using the supplied parameters.- Parameters:
k- The number of nearest neighbours to consider.dist- The distance function.numThreads- The number of threads to use.combiner- The combination function to aggregate the k predictions.backend- The computational backend.nqFactoryType- The nearest neighbour implementation factory to use.
-
KNNTrainer
@Deprecated public KNNTrainer(int k, KNNTrainer.Distance distance, int numThreads, EnsembleCombiner<T> combiner, KNNModel.Backend backend) Deprecated.This Constructor is deprecated in version 4.3.Creates a K-NN trainer using the supplied parameters.neighboursQueryFactorydefaults toNeighboursBruteForceFactory.- Parameters:
k- The number of nearest neighbours to consider.distance- The distance function.numThreads- The number of threads to use.combiner- The combination function to aggregate the k predictions.backend- The computational backend.
-
KNNTrainer
public KNNTrainer(int k, int numThreads, EnsembleCombiner<T> combiner, KNNModel.Backend backend, NeighboursQueryFactory neighboursQueryFactory) Creates a K-NN trainer using the supplied parameters.- Parameters:
k- The number of nearest neighbours to consider.numThreads- The number of threads to use.combiner- The combination function to aggregate the k predictions.backend- The computational backend.neighboursQueryFactory- The nearest neighbour implementation factory to use.
-
-
Method Details
-
postConfig
Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
train
-
train
-
toString
-
getInvocationCount
- Specified by:
getInvocationCountin interfaceTrainer<T extends Output<T>>
-
setInvocationCount
- Specified by:
setInvocationCountin interfaceTrainer<T extends Output<T>>
-
getProvenance
-
DistanceType