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>
156 typedef Online<algorithmFPType, method> super;
158 typedef typename super::InputType InputType;
159 typedef typename super::ParameterType ParameterType;
160 typedef typename super::ResultType ResultType;
161 typedef typename super::PartialResultType PartialResultType;
164 Distributed<step1Local, algorithmFPType, method>() : Online<algorithmFPType, method>()
172 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : Online<algorithmFPType, method>(other)
182 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const 184 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
188 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl()
const DAAL_C11_OVERRIDE
190 return new Distributed<step1Local, algorithmFPType, method>(*this);
211 template<
typename algorithmFPType, Method method>
212 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public Training<distributed>
215 typedef algorithms::ridge_regression::training::DistributedInput<step2Master> InputType;
216 typedef algorithms::ridge_regression::TrainParameter ParameterType;
217 typedef algorithms::ridge_regression::training::Result ResultType;
218 typedef algorithms::ridge_regression::training::PartialResult PartialResultType;
231 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
242 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
250 services::Status setPartialResult(
const PartialResultPtr& partialResult)
252 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
253 _partialResult = partialResult;
254 _pres = _partialResult.get();
255 return services::Status();
262 PartialResultPtr getPartialResult() {
return _partialResult; }
270 services::Status setResult(
const ResultPtr& res)
272 DAAL_CHECK(res, services::ErrorNullResult)
274 _res = _result.get();
275 return services::Status();
282 ResultPtr getResult() {
return _result; }
289 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const 291 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
294 DistributedInput<step2Master> input;
295 ParameterType parameter;
298 PartialResultPtr _partialResult;
301 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
303 return new Distributed<step2Master, algorithmFPType, method>(*this);
306 services::Status allocateResult() DAAL_C11_OVERRIDE
308 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, method);
309 _res = _result.get();
313 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
315 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, method);
316 _pres = _partialResult.get();
320 services::Status initializePartialResult() DAAL_C11_OVERRIDE
322 return services::Status();
327 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
330 _partialResult.reset(
new PartialResultType());
331 _result.reset(
new ResultType());
338 using interface1::DistributedContainer;
339 using interface1::Distributed;
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: ridge_regression_training_distributed.h:221
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: ridge_regression_training_distributed.h:270
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::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:262
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:212
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:289
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:282
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:294
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:231
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:182
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::ridge_regression::interface1::TrainParameter
Parameters for the ridge regression algorithm.
Definition: ridge_regression_model.h:94
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::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_training_distributed.h:242
daal::algorithms::ridge_regression::training::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: ridge_regression_training_distributed.h:295
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::ridge_regression::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of ridge regression mo...
Definition: ridge_regression_training_types.h:216
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::services::interface1::SharedPtr::get
T * get() const
Definition: daal_shared_ptr.h:332
daal::services::interface1::SharedPtr::reset
void reset()
Definition: daal_shared_ptr.h:265
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::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::ridge_regression::training::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: ridge_regression_training_distributed.h:172
daal::algorithms::ridge_regression::training::interface1::Result
Provides methods to access the result obtained with the compute() method of ridge regression model-ba...
Definition: ridge_regression_training_types.h:358
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:250
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