25 #ifndef __IMPLICIT_ALS_PREDICT_RATINGS_DISTRIBUTED_H__
26 #define __IMPLICIT_ALS_PREDICT_RATINGS_DISTRIBUTED_H__
28 #include "algorithms/algorithm.h"
29 #include "algorithms/implicit_als/implicit_als_predict_ratings_types.h"
35 namespace implicit_als
53 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
54 class DistributedContainer
62 template<
typename algorithmFPType, Method method, CpuType cpu>
63 class DistributedContainer<step1Local, algorithmFPType, method, cpu> :
public DistributedPredictionContainerIface
71 DistributedContainer(daal::services::Environment::env *daalEnv);
72 ~DistributedContainer();
78 services::Status compute() DAAL_C11_OVERRIDE;
83 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
103 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
104 class Distributed :
public daal::algorithms::DistributedPrediction {};
120 template<
typename algorithmFPType, Method method>
121 class Distributed<step1Local, algorithmFPType, method> :
public daal::algorithms::DistributedPrediction
124 typedef algorithms::implicit_als::prediction::ratings::DistributedInput<step1Local> InputType;
125 typedef algorithms::implicit_als::Parameter ParameterType;
126 typedef algorithms::implicit_als::prediction::ratings::Result ResultType;
127 typedef algorithms::implicit_als::prediction::ratings::PartialResult PartialResultType;
129 DistributedInput<step1Local> input;
130 ParameterType parameter;
146 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
151 virtual ~Distributed() {}
157 ResultPtr getResult()
159 return _partialResult->get(finalResult);
166 PartialResultPtr getPartialResult()
168 return _partialResult;
175 services::Status setResult(
const ResultPtr &result)
177 DAAL_CHECK(result, services::ErrorNullResult)
178 _partialResult->set(finalResult, result);
179 _pres = _partialResult.get();
180 return services::Status();
188 services::Status setPartialResult(
const PartialResultPtr& partialResult,
bool initFlag =
false)
190 DAAL_CHECK(partialResult, services::ErrorNullPartialResult)
191 DAAL_CHECK(partialResult->get(finalResult), services::ErrorNullResult)
192 _partialResult = partialResult;
193 _pres = _partialResult.get();
194 setInitFlag(initFlag);
195 return services::Status();
202 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
209 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
211 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
215 PartialResultPtr _partialResult;
217 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
219 return new Distributed<step1Local, algorithmFPType, method>(*this);
222 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
224 return services::Status();
227 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
229 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, (int)method);
230 _pres = _partialResult.get();
234 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
236 return services::Status();
241 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step1Local, algorithmFPType, method)(&_env);
244 _partialResult.reset(
new PartialResultType());
250 using interface1::DistributedContainer;
251 using interface1::Distributed;
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed()
Definition: implicit_als_predict_ratings_distributed.h:135
daal::step1Local
Definition: daal_defines.h:123
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: implicit_als_predict_ratings_distributed.h:146
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: implicit_als_predict_ratings_distributed.h:209
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: implicit_als_predict_ratings_distributed.h:157
daal::algorithms::DistributedPredictionContainerIface
Definition: prediction.h:44
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: implicit_als_predict_ratings_distributed.h:202
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: implicit_als_predict_ratings_distributed.h:166
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::implicit_als::prediction::ratings::interface1::DistributedContainer
Class that contains methods to run implicit ALS model-based prediction in the distributed processing ...
Definition: implicit_als_predict_ratings_distributed.h:54
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::input
DistributedInput< step1Local > input
Definition: implicit_als_predict_ratings_distributed.h:129
daal::algorithms::DistributedPrediction
Definition: prediction.h:54
daal::algorithms::implicit_als::prediction::ratings::interface1::DistributedInput< step1Local >
Input objects for the first step of the rating prediction stage of the implicit ALS algorithm in the ...
Definition: implicit_als_predict_ratings_types.h:202
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &result)
Definition: implicit_als_predict_ratings_distributed.h:175
daal::algorithms::implicit_als::prediction::ratings::finalResult
Definition: implicit_als_predict_ratings_types.h:97
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::parameter
ParameterType parameter
Definition: implicit_als_predict_ratings_distributed.h:130
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:107
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed
Runs implicit ALS model-based prediction in the distributed processing mode.
Definition: implicit_als_predict_ratings_distributed.h:104
daal::distributed
Definition: daal_defines.h:113
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag=false)
Definition: implicit_als_predict_ratings_distributed.h:188
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >
Performs implicit ALS model-based prediction in the first step of the distributed processing mode...
Definition: implicit_als_predict_ratings_distributed.h:121