22 #ifndef __KDTREE_KNN_CLASSIFICATION_TRAINING_BATCH_H__
23 #define __KDTREE_KNN_CLASSIFICATION_TRAINING_BATCH_H__
25 #include "algorithms/algorithm.h"
26 #include "algorithms/k_nearest_neighbors/kdtree_knn_classification_training_types.h"
27 #include "algorithms/k_nearest_neighbors/kdtree_knn_classification_model.h"
28 #include "algorithms/classifier/classifier_training_batch.h"
34 namespace kdtree_knn_classification
50 template <
typename algorithmFPType, Method method, CpuType cpu>
51 class DAAL_EXPORT BatchContainer :
public TrainingContainerIface<batch>
58 BatchContainer(daal::services::Environment::env * daalEnv);
66 services::Status compute() DAAL_C11_OVERRIDE;
84 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
85 class DAAL_EXPORT Batch :
public classifier::training::Batch
88 typedef classifier::training::Batch super;
90 typedef typename super::InputType InputType;
91 typedef algorithms::kdtree_knn_classification::Parameter ParameterType;
92 typedef algorithms::kdtree_knn_classification::training::Result ResultType;
94 ParameterType parameter;
109 Batch(
const Batch<algorithmFPType, method> & other) : classifier::training::Batch(other),
110 parameter(other.parameter), input(other.input)
119 InputType * getInput() DAAL_C11_OVERRIDE {
return &input; }
125 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
131 ResultPtr getResult() {
return Result::cast(_result); }
136 services::Status resetResult() DAAL_C11_OVERRIDE
138 _result.reset(
new ResultType());
139 DAAL_CHECK(_result, services::ErrorNullResult);
141 return services::Status();
150 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
152 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
156 virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
158 return new Batch<algorithmFPType, method>(*this);
161 services::Status allocateResult() DAAL_C11_OVERRIDE
163 const ResultPtr res = getResult();
164 DAAL_CHECK(_result, services::ErrorNullResult);
165 services::Status s = res->template allocate<algorithmFPType>((classifier::training::InputIface *)(&input), ¶meter, (int)method);
166 _res = _result.get();
172 _ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
175 _result.reset(
new ResultType());
182 using interface1::BatchContainer;
183 using interface1::Batch;
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: kdtree_knn_classification_training_batch.h:150
daal
Definition: algorithm_base_common.h:31
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::input
InputType input
Definition: kdtree_knn_classification_training_batch.h:95
daal::algorithms::kdtree_knn_classification::training::interface1::Batch
Provides methods for KD-tree based kNN model-based training in the batch processing mode...
Definition: kdtree_knn_classification_training_batch.h:85
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: kdtree_knn_classification_training_batch.h:131
daal::batch
Definition: daal_defines.h:106
daal::algorithms::kdtree_knn_classification::training::interface1::BatchContainer
Class containing methods for KD-tree based kNN model-based training using algorithmFPType precision a...
Definition: kdtree_knn_classification_training_batch.h:51
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::Batch
Batch()
Definition: kdtree_knn_classification_training_batch.h:98
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::parameter
ParameterType parameter
Definition: kdtree_knn_classification_training_batch.h:94
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: kdtree_knn_classification_training_batch.h:119
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: kdtree_knn_classification_training_batch.h:125
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: kdtree_knn_classification_training_batch.h:136
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: kdtree_knn_classification_training_batch.h:109
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:50