23 #ifndef __SVM_TRAIN_H__
24 #define __SVM_TRAIN_H__
26 #include "algorithms/algorithm.h"
28 #include "algorithms/svm/svm_train_types.h"
29 #include "algorithms/classifier/classifier_training_batch.h"
54 template<
typename algorithmFPType, Method method, CpuType cpu>
55 class DAAL_EXPORT BatchContainer :
public TrainingContainerIface<batch>
63 BatchContainer(daal::services::Environment::env *daalEnv);
71 services::Status compute() DAAL_C11_OVERRIDE;
91 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = boser>
92 class DAAL_EXPORT Batch :
public classifier::training::Batch
95 typedef classifier::training::Batch super;
97 typedef typename super::InputType InputType;
98 typedef algorithms::svm::Parameter ParameterType;
99 typedef algorithms::svm::training::Result ResultType;
101 ParameterType parameter;
116 Batch(
const Batch<algorithmFPType, method> &other) : classifier::training::Batch(other),
117 parameter(other.parameter), input(other.input)
128 InputType * getInput() DAAL_C11_OVERRIDE {
return &input; }
134 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
140 ResultPtr getResult()
142 return ResultType::cast(_result);
148 services::Status resetResult() DAAL_C11_OVERRIDE
150 _result.reset(
new ResultType());
151 DAAL_CHECK(_result, services::ErrorNullResult);
153 return services::Status();
161 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
163 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
167 virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
169 return new Batch<algorithmFPType, method>(*this);
172 services::Status allocateResult() DAAL_C11_OVERRIDE
174 ResultPtr res = getResult();
175 DAAL_CHECK(res, services::ErrorNullResult);
176 services::Status s = res->template allocate<algorithmFPType>(&input, _par, (int) method);
177 _res = _result.get();
183 _ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
186 _result.reset(
new ResultType());
191 using interface1::BatchContainer;
192 using interface1::Batch;
daal
Definition: algorithm_base_common.h:31
daal::algorithms::svm::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: svm_train.h:161
daal::algorithms::svm::training::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: svm_train.h:128
daal::algorithms::svm::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svm_train.h:134
daal::algorithms::svm::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: svm_train.h:116
daal::algorithms::svm::training::interface1::BatchContainer
Class containing methods to compute results of the SVM training.
Definition: svm_train.h:55
daal::batch
Definition: daal_defines.h:106
daal::algorithms::svm::training::interface1::Batch::Batch
Batch()
Definition: svm_train.h:105
daal::algorithms::svm::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: svm_train.h:140
daal::algorithms::svm::training::interface1::Batch::parameter
ParameterType parameter
Definition: svm_train.h:101
daal::algorithms::svm::training::interface1::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: svm_train.h:148
daal::algorithms::svm::training::interface1::Batch
Algorithm class to train the SVM model
Definition: svm_train.h:92
daal::algorithms::svm::training::interface1::Batch::input
InputType input
Definition: svm_train.h:102
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