48 #ifndef __RIDGE_REGRESSION_TRAINING_DISTRIBUTED_H__
49 #define __RIDGE_REGRESSION_TRAINING_DISTRIBUTED_H__
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "services/daal_defines.h"
54 #include "services/daal_memory.h"
55 #include "algorithms/ridge_regression/ridge_regression_training_types.h"
56 #include "algorithms/ridge_regression/ridge_regression_training_online.h"
57 #include "algorithms/ridge_regression/ridge_regression_model.h"
63 namespace ridge_regression
78 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
79 class DAAL_EXPORT DistributedContainer
86 template<
typename algorithmFPType, Method method, CpuType cpu>
87 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> :
public TrainingContainerIface<distributed>
94 DistributedContainer(daal::services::Environment::env *daalEnv);
97 ~DistributedContainer();
104 services::Status compute() DAAL_C11_OVERRIDE;
111 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
132 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = normEqDense>
133 class DAAL_EXPORT Distributed :
public Training<distributed> {};
152 template<
typename algorithmFPType, Method method>
153 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
157 Distributed<step1Local, algorithmFPType, method>() : Online<algorithmFPType, method>()
165 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : Online<algorithmFPType, method>(other)
175 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
177 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
181 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
183 return new Distributed<step1Local, algorithmFPType, method>(*this);
204 template<
typename algorithmFPType, Method method>
205 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public Training<distributed>
219 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
230 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
238 services::Status setPartialResult(
const PartialResultPtr& partialResult)
240 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
241 _partialResult = partialResult;
242 _pres = _partialResult.get();
243 return services::Status();
250 PartialResultPtr getPartialResult() {
return _partialResult; }
258 services::Status setResult(
const ResultPtr& res)
260 DAAL_CHECK(res, services::ErrorNullResult)
262 _res = _result.get();
263 return services::Status();
270 ResultPtr getResult() {
return _result; }
277 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
279 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
282 DistributedInput<step2Master> input;
283 TrainParameter parameter;
286 PartialResultPtr _partialResult;
289 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
291 return new Distributed<step2Master, algorithmFPType, method>(*this);
294 services::Status allocateResult() DAAL_C11_OVERRIDE
296 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, method);
297 _res = _result.get();
301 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
303 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, method);
304 _pres = _partialResult.get();
308 services::Status initializePartialResult() DAAL_C11_OVERRIDE
310 return services::Status();
315 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
318 _partialResult.reset(
new PartialResult());
319 _result.reset(
new Result());
326 using interface1::DistributedContainer;
327 using interface1::Distributed;
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: ridge_regression_training_distributed.h:209
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: ridge_regression_training_distributed.h:258
daal
Definition: algorithm_base_common.h:57
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:79
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: ridge_regression_training_distributed.h:250
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:205
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:277
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: ridge_regression_training_distributed.h:270
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:121
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedInput< step2Master > input
Definition: ridge_regression_training_distributed.h:282
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:219
daal::algorithms::kmeans::init::interface1::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_init_distributed.h:281
daal::distributed
Definition: daal_defines.h:132
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_training_distributed.h:230
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:153
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
TrainParameter parameter
Definition: ridge_regression_training_distributed.h:283
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:175
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:81
daal::step1Local
Definition: daal_defines.h:142
daal::step2Master
Definition: daal_defines.h:143
daal::algorithms::ridge_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:165
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:133
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult)
Definition: ridge_regression_training_distributed.h:238
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
daal::algorithms::Training
Provides methods to train models that depend on the data provided. For example, these methods enable ...
Definition: training.h:86