24 #ifndef __RIDGE_REGRESSION_TRAINING_DISTRIBUTED_H__
25 #define __RIDGE_REGRESSION_TRAINING_DISTRIBUTED_H__
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/numeric_table.h"
29 #include "services/daal_defines.h"
30 #include "services/daal_memory.h"
31 #include "algorithms/ridge_regression/ridge_regression_training_types.h"
32 #include "algorithms/ridge_regression/ridge_regression_training_online.h"
33 #include "algorithms/ridge_regression/ridge_regression_model.h"
39 namespace ridge_regression
54 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
55 class DistributedContainer
62 template<
typename algorithmFPType, Method method, CpuType cpu>
63 class DistributedContainer<step2Master, algorithmFPType, method, cpu> :
public TrainingContainerIface<distributed>
70 DistributedContainer(daal::services::Environment::env *daalEnv);
73 ~DistributedContainer();
80 services::Status compute() DAAL_C11_OVERRIDE;
87 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
108 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = normEqDense>
109 class DAAL_EXPORT Distributed :
public Training<distributed> {};
128 template<
typename algorithmFPType, Method method>
129 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
132 typedef Online<algorithmFPType, method> super;
134 typedef typename super::InputType InputType;
135 typedef typename super::ParameterType ParameterType;
136 typedef typename super::ResultType ResultType;
137 typedef typename super::PartialResultType PartialResultType;
140 Distributed<step1Local, algorithmFPType, method>() : Online<algorithmFPType, method>()
148 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : Online<algorithmFPType, method>(other)
158 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
160 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
164 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
166 return new Distributed<step1Local, algorithmFPType, method>(*this);
187 template<
typename algorithmFPType, Method method>
188 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public Training<distributed>
191 typedef algorithms::ridge_regression::training::DistributedInput<step2Master> InputType;
192 typedef algorithms::ridge_regression::TrainParameter ParameterType;
193 typedef algorithms::ridge_regression::training::Result ResultType;
194 typedef algorithms::ridge_regression::training::PartialResult PartialResultType;
207 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
218 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
226 services::Status setPartialResult(
const PartialResultPtr& partialResult)
228 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
229 _partialResult = partialResult;
230 _pres = _partialResult.get();
231 return services::Status();
238 PartialResultPtr getPartialResult() {
return _partialResult; }
246 services::Status setResult(
const ResultPtr& res)
248 DAAL_CHECK(res, services::ErrorNullResult)
250 _res = _result.get();
251 return services::Status();
258 ResultPtr getResult() {
return _result; }
265 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
267 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
270 DistributedInput<step2Master> input;
271 ParameterType parameter;
274 PartialResultPtr _partialResult;
277 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
279 return new Distributed<step2Master, algorithmFPType, method>(*this);
282 services::Status allocateResult() DAAL_C11_OVERRIDE
284 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, method);
285 _res = _result.get();
289 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
291 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, method);
292 _pres = _partialResult.get();
296 services::Status initializePartialResult() DAAL_C11_OVERRIDE
298 return services::Status();
303 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
306 _partialResult.reset(
new PartialResultType());
307 _result.reset(
new ResultType());
314 using interface1::DistributedContainer;
315 using interface1::Distributed;
daal::step1Local
Definition: daal_defines.h:123
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:265
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:97
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: ridge_regression_training_distributed.h:258
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:129
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:55
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:188
daal::step2Master
Definition: daal_defines.h:124
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::kmeans::init::interface2::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for K-Means algorithm in the distributed processing mode.
Definition: kmeans_init_distributed.h:277
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedInput< step2Master > input
Definition: ridge_regression_training_distributed.h:270
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: ridge_regression_training_distributed.h:271
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: ridge_regression_training_distributed.h:197
daal::algorithms::Training
Provides methods to train models that depend on the data provided. For example, these methods enable ...
Definition: training.h:62
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_training_distributed.h:218
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:158
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: ridge_regression_training_distributed.h:238
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: ridge_regression_training_distributed.h:246
daal::algorithms::ridge_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:148
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:207
daal::algorithms::ridge_regression::training::interface1::DistributedInput< step2Master >
Input object for ridge regression model-based training in the second step of the distributed processi...
Definition: ridge_regression_training_types.h:280
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult)
Definition: ridge_regression_training_distributed.h:226
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:107
daal::distributed
Definition: daal_defines.h:113
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:52
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:109