48 #ifndef __KDTREE_KNN_CLASSIFICATION_TRAINING_BATCH_H__ 49 #define __KDTREE_KNN_CLASSIFICATION_TRAINING_BATCH_H__ 51 #include "algorithms/algorithm.h" 52 #include "algorithms/k_nearest_neighbors/kdtree_knn_classification_training_types.h" 53 #include "algorithms/k_nearest_neighbors/kdtree_knn_classification_model.h" 54 #include "algorithms/classifier/classifier_training_batch.h" 60 namespace kdtree_knn_classification
76 template <
typename algorithmFPType, Method method, CpuType cpu>
77 class DAAL_EXPORT BatchContainer :
public TrainingContainerIface<batch>
84 BatchContainer(daal::services::Environment::env * daalEnv);
92 services::Status compute() DAAL_C11_OVERRIDE;
110 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
111 class DAAL_EXPORT Batch :
public classifier::training::Batch
114 typedef classifier::training::Batch super;
116 typedef typename super::InputType InputType;
117 typedef algorithms::kdtree_knn_classification::Parameter ParameterType;
118 typedef algorithms::kdtree_knn_classification::training::Result ResultType;
120 ParameterType parameter;
135 Batch(
const Batch<algorithmFPType, method> & other) : classifier::training::Batch(other),
136 parameter(other.parameter), input(other.input)
145 InputType * getInput() DAAL_C11_OVERRIDE {
return &input; }
151 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
157 ResultPtr getResult() {
return Result::cast(_result); }
162 services::Status resetResult() DAAL_C11_OVERRIDE
164 _result.reset(
new ResultType());
165 DAAL_CHECK(_result, services::ErrorNullResult);
167 return services::Status();
176 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const 178 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
182 virtual Batch<algorithmFPType, method> * cloneImpl()
const DAAL_C11_OVERRIDE
184 return new Batch<algorithmFPType, method>(*this);
187 services::Status allocateResult() DAAL_C11_OVERRIDE
189 const ResultPtr res = getResult();
190 DAAL_CHECK(_result, services::ErrorNullResult);
191 services::Status s = res->template allocate<algorithmFPType>((classifier::training::InputIface *)(&input), ¶meter, (int)method);
192 _res = _result.get();
198 _ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
201 _result.reset(
new ResultType());
208 using interface1::BatchContainer;
209 using interface1::Batch;
daal::algorithms::kdtree_knn_classification::interface1::Parameter
KD-tree based kNN algorithm parameters.
Definition: kdtree_knn_classification_model.h:98
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::classifier::interface1::Parameter
Base class for the parameters of the classification algorithm.
Definition: classifier_model.h:81
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::input
InputType input
Definition: kdtree_knn_classification_training_batch.h:121
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:111
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: kdtree_knn_classification_training_batch.h:157
daal::batch
Definition: daal_defines.h:132
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::kdtree_knn_classification::training::interface1::Result
Provides methods to access the result obtained with the compute() method of KD-tree based kNN model-b...
Definition: kdtree_knn_classification_training_types.h:98
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: kdtree_knn_classification_training_batch.h:176
daal::algorithms::classifier::training::interface1::Batch
Algorithm class for training the classifier model.
Definition: classifier_training_batch.h:82
daal::algorithms::classifier::training::interface1::Result
Provides methods to access final results obtained with the compute() method in the batch processing m...
Definition: classifier_training_types.h:222
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:77
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::Batch
Batch()
Definition: kdtree_knn_classification_training_batch.h:124
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::parameter
ParameterType parameter
Definition: kdtree_knn_classification_training_batch.h:120
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: kdtree_knn_classification_training_batch.h:145
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: kdtree_knn_classification_training_batch.h:151
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: kdtree_knn_classification_training_batch.h:162
daal::algorithms::kdtree_knn_classification::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: kdtree_knn_classification_training_batch.h:135
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:76