49 #ifndef __LINEAR_REGRESSION_TRAINING_DISTRIBUTED_H__
50 #define __LINEAR_REGRESSION_TRAINING_DISTRIBUTED_H__
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "services/daal_memory.h"
56 #include "algorithms/linear_regression/linear_regression_training_types.h"
57 #include "algorithms/linear_regression/linear_regression_training_online.h"
59 #include "algorithms/linear_regression/linear_regression_model.h"
65 namespace linear_regression
81 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
82 class DAAL_EXPORT DistributedContainer
90 template<
typename algorithmFPType, Method method, CpuType cpu>
91 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> :
public
92 TrainingContainerIface<distributed>
100 DistributedContainer(daal::services::Environment::env *daalEnv);
102 ~DistributedContainer();
110 services::Status compute() DAAL_C11_OVERRIDE;
117 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
139 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = normEqDense>
140 class DAAL_EXPORT Distributed :
public Training<distributed> {};
161 template<
typename algorithmFPType, Method method>
162 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
166 Distributed<step1Local, algorithmFPType, method>()
175 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
176 Online<algorithmFPType, method>(other)
185 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
187 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
191 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
193 return new Distributed<step1Local, algorithmFPType, method>(*this);
214 template<
typename algorithmFPType, Method method>
215 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public Training<distributed>
230 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other)
233 input.set(partialModels, other.input.get(partialModels));
234 parameter = other.parameter;
243 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
251 services::Status setPartialResult(
const PartialResultPtr& partialResult)
253 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
254 _partialResult = partialResult;
255 _pres = _partialResult.get();
256 return services::Status();
263 PartialResultPtr getPartialResult() {
return _partialResult; }
271 services::Status setResult(
const ResultPtr& res)
273 DAAL_CHECK(res, services::ErrorNullResult)
275 _res = _result.get();
276 return services::Status();
285 ResultPtr getResult() {
return _result; }
293 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
295 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
298 DistributedInput<step2Master> input;
302 PartialResultPtr _partialResult;
305 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
307 return new Distributed<step2Master, algorithmFPType, method>(*this);
310 services::Status allocateResult() DAAL_C11_OVERRIDE
312 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, method);
313 _res = _result.get();
317 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
319 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, method);
320 _pres = _partialResult.get();
324 services::Status initializePartialResult() DAAL_C11_OVERRIDE
326 return services::Status();
331 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
334 _partialResult.reset(
new PartialResult());
335 _result.reset(
new Result());
341 using interface1::DistributedContainer;
342 using interface1::Distributed;
daal::algorithms::linear_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: linear_regression_training_distributed.h:185
daal
Definition: algorithm_base_common.h:57
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: linear_regression_training_distributed.h:230
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: linear_regression_training_distributed.h:293
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
Parameter parameter
Definition: linear_regression_training_distributed.h:299
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: linear_regression_training_distributed.h:219
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: linear_regression_training_distributed.h:263
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: linear_regression_training_distributed.h:271
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::linear_regression::training::partialModels
Definition: linear_regression_training_types.h:105
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: linear_regression_training_distributed.h:285
daal::algorithms::linear_regression::training::interface1::Distributed
Provides methods for linear regression model-based training in the distributed processing mode...
Definition: linear_regression_training_distributed.h:140
daal::algorithms::linear_regression::training::interface1::DistributedContainer
Class containing methods for linear regression model-based training in the distributed processing mod...
Definition: linear_regression_training_distributed.h:82
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult)
Definition: linear_regression_training_distributed.h:251
daal::algorithms::linear_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: linear_regression_training_distributed.h:175
daal::algorithms::linear_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >
Performs linear regression model-based training in the the first step of the distributed processing m...
Definition: linear_regression_training_distributed.h:162
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedInput< step2Master > input
Definition: linear_regression_training_distributed.h:298
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >
Performs linear regression model-based training in the the second step of distributed processing mode...
Definition: linear_regression_training_distributed.h:215
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::linear_regression::training::interface1::Online
Provides methods for linear regression model-based training in the online processing mode...
Definition: linear_regression_training_online.h:125
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
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: linear_regression_training_distributed.h:243