49 #ifndef __IMPLICIT_ALS_PREDICT_RATINGS_DISTRIBUTED_H__
50 #define __IMPLICIT_ALS_PREDICT_RATINGS_DISTRIBUTED_H__
52 #include "algorithms/algorithm.h"
53 #include "algorithms/implicit_als/implicit_als_predict_ratings_types.h"
59 namespace implicit_als
77 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
78 class DAAL_EXPORT DistributedContainer
86 template<
typename algorithmFPType, Method method, CpuType cpu>
87 class DAAL_EXPORT DistributedContainer<step1Local, algorithmFPType, method, cpu> :
public DistributedPredictionContainerIface
95 DistributedContainer(daal::services::Environment::env *daalEnv);
96 ~DistributedContainer();
102 services::Status compute() DAAL_C11_OVERRIDE;
107 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
127 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
128 class Distributed :
public daal::algorithms::DistributedPrediction {};
144 template<
typename algorithmFPType, Method method>
145 class Distributed<step1Local, algorithmFPType, method> :
public daal::algorithms::DistributedPrediction
148 DistributedInput<step1Local> input;
165 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
170 virtual ~Distributed() {}
176 ResultPtr getResult()
178 return _partialResult->get(finalResult);
185 PartialResultPtr getPartialResult()
187 return _partialResult;
194 services::Status setResult(
const ResultPtr &result)
196 DAAL_CHECK(result, services::ErrorNullResult)
197 _partialResult->set(finalResult, result);
198 _pres = _partialResult.get();
199 return services::Status();
207 services::Status setPartialResult(
const PartialResultPtr& partialResult,
bool initFlag =
false)
209 DAAL_CHECK(partialResult, services::ErrorNullPartialResult)
210 DAAL_CHECK(partialResult->get(finalResult), services::ErrorNullResult)
211 _partialResult = partialResult;
212 _pres = _partialResult.get();
213 setInitFlag(initFlag);
214 return services::Status();
221 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
228 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
230 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
234 PartialResultPtr _partialResult;
236 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
238 return new Distributed<step1Local, algorithmFPType, method>(*this);
241 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
243 return services::Status();
246 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
248 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, (int)method);
249 _pres = _partialResult.get();
253 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
255 return services::Status();
260 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step1Local, algorithmFPType, method)(&_env);
263 _partialResult.reset(
new PartialResult());
269 using interface1::DistributedContainer;
270 using interface1::Distributed;
daal::algorithms::DistributedPrediction
Definition: prediction.h:78
daal
Definition: algorithm_base_common.h:57
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:194
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::parameter
Parameter parameter
Definition: implicit_als_predict_ratings_distributed.h:149
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:207
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::implicit_als::prediction::ratings::interface1::Distributed
Runs implicit ALS model-based prediction in the distributed processing mode.
Definition: implicit_als_predict_ratings_distributed.h:128
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed()
Definition: implicit_als_predict_ratings_distributed.h:154
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: implicit_als_predict_ratings_distributed.h:176
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:145
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:228
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:165
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:102
daal::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::input
DistributedInput< step1Local > input
Definition: implicit_als_predict_ratings_distributed.h:148
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:78
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:221
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::algorithms::implicit_als::prediction::ratings::interface1::Distributed< step1Local, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: implicit_als_predict_ratings_distributed.h:185
daal::algorithms::DistributedPredictionContainerIface
Definition: prediction.h:68
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::implicit_als::prediction::ratings::finalResult
Definition: implicit_als_predict_ratings_types.h:121