25 #ifndef __SVM_TRAIN_H__
26 #define __SVM_TRAIN_H__
28 #include "algorithms/algorithm.h"
30 #include "algorithms/svm/svm_train_types.h"
31 #include "algorithms/classifier/classifier_training_batch.h"
56 template<
typename algorithmFPType, Method method, CpuType cpu>
57 class BatchContainer :
public TrainingContainerIface<batch>
65 BatchContainer(daal::services::Environment::env *daalEnv);
73 services::Status compute() DAAL_C11_OVERRIDE;
93 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = boser>
94 class DAAL_EXPORT Batch :
public classifier::training::interface1::Batch
97 typedef classifier::training::interface1::Batch super;
99 typedef typename super::InputType InputType;
100 typedef algorithms::svm::interface1::Parameter ParameterType;
101 typedef algorithms::svm::training::Result ResultType;
103 ParameterType parameter;
118 Batch(
const Batch<algorithmFPType, method> &other) : classifier::training::interface1::Batch(other),
119 parameter(other.parameter), input(other.input)
130 InputType * getInput() DAAL_C11_OVERRIDE {
return &input; }
136 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
142 interface1::ResultPtr getResult()
144 return ResultType::cast(_result);
150 services::Status resetResult() DAAL_C11_OVERRIDE
152 _result.reset(
new ResultType());
153 DAAL_CHECK(_result, services::ErrorNullResult);
155 return services::Status();
163 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
165 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
169 virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
171 return new Batch<algorithmFPType, method>(*this);
174 services::Status allocateResult() DAAL_C11_OVERRIDE
176 ResultPtr res = getResult();
177 DAAL_CHECK(res, services::ErrorNullResult);
178 services::Status s = res->template allocate<algorithmFPType>(&input, _par, (int) method);
179 _res = _result.get();
185 _ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
188 _result.reset(
new ResultType());
208 template<
typename algorithmFPType, Method method, CpuType cpu>
209 class BatchContainer :
public TrainingContainerIface<batch>
217 BatchContainer(daal::services::Environment::env *daalEnv);
225 services::Status compute() DAAL_C11_OVERRIDE;
245 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = boser>
246 class DAAL_EXPORT Batch :
public classifier::training::Batch
249 typedef classifier::training::Batch super;
251 typedef typename super::InputType InputType;
252 typedef algorithms::svm::Parameter ParameterType;
253 typedef algorithms::svm::training::Result ResultType;
255 ParameterType parameter;
270 Batch(
const Batch<algorithmFPType, method> &other) : classifier::training::Batch(other),
271 parameter(other.parameter), input(other.input)
282 InputType * getInput() DAAL_C11_OVERRIDE {
return &input; }
288 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
294 ResultPtr getResult()
296 return ResultType::cast(_result);
302 services::Status resetResult() DAAL_C11_OVERRIDE
304 _result.reset(
new ResultType());
305 DAAL_CHECK(_result, services::ErrorNullResult);
307 return services::Status();
315 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
317 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
321 virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
323 return new Batch<algorithmFPType, method>(*this);
326 services::Status allocateResult() DAAL_C11_OVERRIDE
328 ResultPtr res = getResult();
329 DAAL_CHECK(res, services::ErrorNullResult);
330 services::Status s = res->template allocate<algorithmFPType>(&input, _par, (int) method);
331 _res = _result.get();
337 _ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
340 _result.reset(
new ResultType());
345 using interface2::BatchContainer;
346 using interface2::Batch;
daal::algorithms::svm::training::interface2::Batch::Batch
Batch()
Definition: svm_train.h:259
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:198
daal::algorithms::svm::training::interface2::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: svm_train.h:270
daal::algorithms::svm::training::interface2::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: svm_train.h:282
daal::algorithms::svm::training::interface1::BatchContainer::~BatchContainer
~BatchContainer()
daal::batch
Definition: daal_defines.h:112
daal::algorithms::svm::training::interface2::BatchContainer::~BatchContainer
~BatchContainer()
daal::algorithms::classifier::training::interface1::Batch
Algorithm class for training the classifier model.
Definition: classifier_training_batch.h:58
daal::algorithms::svm::training::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svm_train.h:288
daal::algorithms::svm::training::interface2::Batch
Algorithm class to train the SVM model
Definition: svm_train.h:246
daal::algorithms::svm::training::interface1::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: svm_train.h:150
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::svm::training::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: svm_train.h:130
daal::algorithms::svm::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svm_train.h:136
daal::algorithms::svm::training::interface2::Batch::getResult
ResultPtr getResult()
Definition: svm_train.h:294
daal::algorithms::svm::training::interface1::Batch::input
InputType input
Definition: svm_train.h:104
daal::algorithms::svm::training::interface2::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::svm::training::interface1::Batch::Batch
Batch()
Definition: svm_train.h:107
daal::algorithms::svm::training::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::svm::training::interface2::BatchContainer
Class containing methods to compute results of the SVM training.
Definition: svm_train.h:209
daal::algorithms::classifier::interface1::Parameter
Base class for the parameters of the classification algorithm.
Definition: classifier_model.h:69
daal::algorithms::classifier::training::interface1::Input
Base class for the input objects in the training stage of the classification algorithms.
Definition: classifier_training_types.h:110
daal::algorithms::svm::training::interface2::Batch::input
InputType input
Definition: svm_train.h:256
daal::algorithms::svm::training::interface1::BatchContainer
Class containing methods to compute results of the SVM training.
Definition: svm_train.h:57
daal::algorithms::svm::interface1::Parameter
Optional parameters.
Definition: svm_model.h:66
daal::algorithms::svm::training::interface1::Batch::parameter
ParameterType parameter
Definition: svm_train.h:103
daal::algorithms::svm::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: svm_train.h:163
daal::algorithms::svm::training::interface1::Batch
Algorithm class to train the SVM model
Definition: svm_train.h:94
daal::algorithms::svm::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: svm_train.h:118
daal::algorithms::svm::training::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::svm::training::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: svm_train.h:315
daal::algorithms::svm::training::interface2::Batch::parameter
ParameterType parameter
Definition: svm_train.h:255
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:52
daal::algorithms::svm::training::interface1::Batch::getResult
interface1::ResultPtr getResult()
Definition: svm_train.h:142
daal::algorithms::svm::training::interface2::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::svm::training::interface2::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: svm_train.h:302