22 #ifndef __RIDGE_REGRESSION_TRAINING_DISTRIBUTED_H__
23 #define __RIDGE_REGRESSION_TRAINING_DISTRIBUTED_H__
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "services/daal_memory.h"
29 #include "algorithms/ridge_regression/ridge_regression_training_types.h"
30 #include "algorithms/ridge_regression/ridge_regression_training_online.h"
31 #include "algorithms/ridge_regression/ridge_regression_model.h"
37 namespace ridge_regression
52 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
53 class DAAL_EXPORT DistributedContainer
60 template<
typename algorithmFPType, Method method, CpuType cpu>
61 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> :
public TrainingContainerIface<distributed>
68 DistributedContainer(daal::services::Environment::env *daalEnv);
71 ~DistributedContainer();
78 services::Status compute() DAAL_C11_OVERRIDE;
85 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
106 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = normEqDense>
107 class DAAL_EXPORT Distributed :
public Training<distributed> {};
126 template<
typename algorithmFPType, Method method>
127 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
130 typedef Online<algorithmFPType, method> super;
132 typedef typename super::InputType InputType;
133 typedef typename super::ParameterType ParameterType;
134 typedef typename super::ResultType ResultType;
135 typedef typename super::PartialResultType PartialResultType;
138 Distributed<step1Local, algorithmFPType, method>() : Online<algorithmFPType, method>()
146 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : Online<algorithmFPType, method>(other)
156 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
158 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
162 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
164 return new Distributed<step1Local, algorithmFPType, method>(*this);
185 template<
typename algorithmFPType, Method method>
186 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public Training<distributed>
189 typedef algorithms::ridge_regression::training::DistributedInput<step2Master> InputType;
190 typedef algorithms::ridge_regression::TrainParameter ParameterType;
191 typedef algorithms::ridge_regression::training::Result ResultType;
192 typedef algorithms::ridge_regression::training::PartialResult PartialResultType;
205 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
216 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
224 services::Status setPartialResult(
const PartialResultPtr& partialResult)
226 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
227 _partialResult = partialResult;
228 _pres = _partialResult.get();
229 return services::Status();
236 PartialResultPtr getPartialResult() {
return _partialResult; }
244 services::Status setResult(
const ResultPtr& res)
246 DAAL_CHECK(res, services::ErrorNullResult)
248 _res = _result.get();
249 return services::Status();
256 ResultPtr getResult() {
return _result; }
263 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
265 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
268 DistributedInput<step2Master> input;
269 ParameterType parameter;
272 PartialResultPtr _partialResult;
275 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
277 return new Distributed<step2Master, algorithmFPType, method>(*this);
280 services::Status allocateResult() DAAL_C11_OVERRIDE
282 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, method);
283 _res = _result.get();
287 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
289 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, method);
290 _pres = _partialResult.get();
294 services::Status initializePartialResult() DAAL_C11_OVERRIDE
296 return services::Status();
301 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
304 _partialResult.reset(
new PartialResultType());
305 _result.reset(
new ResultType());
312 using interface1::DistributedContainer;
313 using interface1::Distributed;
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: ridge_regression_training_distributed.h:195
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: ridge_regression_training_distributed.h:244
daal
Definition: algorithm_base_common.h:31
daal::algorithms::ridge_regression::training::interface1::DistributedContainer
Class containing methods for ridge regression model-based training in the distributed processing mode...
Definition: ridge_regression_training_distributed.h:53
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: ridge_regression_training_distributed.h:236
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >
Performs ridge regression model-based training in the the second step of distributed processing mode...
Definition: ridge_regression_training_distributed.h:186
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: ridge_regression_training_distributed.h:263
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:105
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: ridge_regression_training_distributed.h:256
daal::algorithms::ridge_regression::training::interface1::Online
Provides methods for ridge regression model-based training in the online processing mode...
Definition: ridge_regression_training_online.h:95
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedInput< step2Master > input
Definition: ridge_regression_training_distributed.h:268
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:205
daal::algorithms::kmeans::init::interface2::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_init_distributed.h:275
daal::distributed
Definition: daal_defines.h:111
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_training_distributed.h:216
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: ridge_regression_training_distributed.h:269
daal::algorithms::ridge_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >
Performs ridge regression model-based training in the the first step of the distributed processing mo...
Definition: ridge_regression_training_distributed.h:127
daal::algorithms::ridge_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: ridge_regression_training_distributed.h:156
daal::algorithms::kmeans::interface1::DistributedContainer
class DAAL_EXPORT DistributedContainer
Provides methods to run implementations of the K-Means algorithm. This class is associated with the d...
Definition: kmeans_distributed.h:55
daal::step1Local
Definition: daal_defines.h:121
daal::step2Master
Definition: daal_defines.h:122
daal::algorithms::ridge_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:146
daal::algorithms::ridge_regression::training::interface1::Distributed
Provides methods for ridge regression model-based training in the distributed processing mode...
Definition: ridge_regression_training_distributed.h:107
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult)
Definition: ridge_regression_training_distributed.h:224
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
daal::algorithms::Training
Provides methods to train models that depend on the data provided. For example, these methods enable ...
Definition: training.h:60