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>
165 typedef Online<algorithmFPType, method> super;
167 typedef typename super::InputType InputType;
168 typedef typename super::ParameterType ParameterType;
169 typedef typename super::ResultType ResultType;
170 typedef typename super::PartialResultType PartialResultType;
173 Distributed<step1Local, algorithmFPType, method>()
182 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
183 Online<algorithmFPType, method>(other)
192 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const 194 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
198 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl()
const DAAL_C11_OVERRIDE
200 return new Distributed<step1Local, algorithmFPType, method>(*this);
221 template<
typename algorithmFPType, Method method>
222 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public Training<distributed>
225 typedef algorithms::linear_regression::training::DistributedInput<step2Master> InputType;
226 typedef algorithms::linear_regression::Parameter ParameterType;
227 typedef algorithms::linear_regression::training::Result ResultType;
228 typedef algorithms::linear_regression::training::PartialResult PartialResultType;
242 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other)
245 input.set(partialModels, other.input.get(partialModels));
246 parameter = other.parameter;
255 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
263 services::Status setPartialResult(
const PartialResultPtr& partialResult)
265 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
266 _partialResult = partialResult;
267 _pres = _partialResult.get();
268 return services::Status();
275 PartialResultPtr getPartialResult() {
return _partialResult; }
283 services::Status setResult(
const ResultPtr& res)
285 DAAL_CHECK(res, services::ErrorNullResult)
287 _res = _result.get();
288 return services::Status();
297 ResultPtr getResult() {
return _result; }
305 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const 307 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
310 DistributedInput<step2Master> input;
311 ParameterType parameter;
314 PartialResultPtr _partialResult;
317 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
319 return new Distributed<step2Master, algorithmFPType, method>(*this);
322 services::Status allocateResult() DAAL_C11_OVERRIDE
324 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, method);
325 _res = _result.get();
329 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
331 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, method);
332 _pres = _partialResult.get();
336 services::Status initializePartialResult() DAAL_C11_OVERRIDE
338 return services::Status();
343 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
346 _partialResult.reset(
new PartialResultType());
347 _result.reset(
new ResultType());
353 using interface1::DistributedContainer;
354 using interface1::Distributed;
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: linear_regression_training_distributed.h:311
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
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:242
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:305
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:231
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: linear_regression_training_distributed.h:275
daal::algorithms::linear_model::training::interface1::Result
Provides methods to access the result obtained with the compute() method of the regression model-base...
Definition: linear_model_training_types.h:174
daal::algorithms::linear_model::interface1::Parameter
Parameters for the regression algorithm.
Definition: linear_model_model.h:85
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: linear_regression_training_distributed.h:283
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:192
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:133
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:297
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
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::Result
Provides methods to access the result obtained with the compute() method of linear regression model-b...
Definition: linear_regression_training_types.h:361
daal::services::interface1::SharedPtr::get
T * get() const
Definition: daal_shared_ptr.h:332
daal::algorithms::linear_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult)
Definition: linear_regression_training_distributed.h:263
daal::services::interface1::SharedPtr::reset
void reset()
Definition: daal_shared_ptr.h:265
daal::algorithms::linear_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: linear_regression_training_distributed.h:182
daal::algorithms::linear_model::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of the linear model-ba...
Definition: linear_model_training_types.h:135
daal::algorithms::linear_regression::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of linear regression m...
Definition: linear_regression_training_types.h:218
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:310
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:222
daal::algorithms::linear_regression::interface1::Parameter
Parameters for the linear regression algorithm.
Definition: linear_regression_model.h:82
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:143
daal::step2Master
Definition: daal_defines.h:144
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:255