48 #ifndef __KMEANS_TYPES_H__
49 #define __KMEANS_TYPES_H__
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "data_management/data/homogen_numeric_table.h"
54 #include "services/daal_defines.h"
87 lastDistanceType = euclidean
98 lastInputId = inputCentroids
108 lastMasterInputId = partialResults
119 partialObjectiveFunction,
120 partialGoalFunction = partialObjectiveFunction,
122 lastPartialResultId = partialAssignments
134 goalFunction = objectiveFunction,
136 lastResultId = nIterations
153 struct DAAL_EXPORT Parameter :
public daal::algorithms::Parameter
160 Parameter(
size_t _nClusters,
size_t _maxIterations);
166 Parameter(
const Parameter &other);
169 size_t maxIterations;
170 double accuracyThreshold;
172 DistanceType distanceType;
175 services::Status check() const DAAL_C11_OVERRIDE;
183 class DAAL_EXPORT InputIface : public daal::algorithms::Input
186 InputIface(
size_t nElements) : daal::algorithms::Input(nElements) {};
188 virtual size_t getNumberOfFeatures()
const = 0;
195 class DAAL_EXPORT Input :
public InputIface
206 data_management::NumericTablePtr
get(InputId id)
const;
213 void set(InputId
id,
const data_management::NumericTablePtr &ptr);
220 size_t getNumberOfFeatures()
const DAAL_C11_OVERRIDE;
227 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
234 class DAAL_EXPORT PartialResult :
public daal::algorithms::PartialResult
237 DECLARE_SERIALIZABLE_CAST(PartialResult);
240 virtual ~PartialResult() {};
248 template <
typename algorithmFPType>
249 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
256 data_management::NumericTablePtr
get(PartialResultId id)
const;
263 void set(PartialResultId
id,
const data_management::NumericTablePtr &ptr);
270 size_t getNumberOfFeatures()
const;
278 services::Status check(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
285 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
289 template<
typename Archive,
bool onDeserialize>
290 services::Status serialImpl(Archive *arch)
292 return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
295 typedef services::SharedPtr<PartialResult> PartialResultPtr;
301 class DAAL_EXPORT Result :
public daal::algorithms::Result
304 DECLARE_SERIALIZABLE_CAST(Result);
307 virtual ~Result() {};
315 template <
typename algorithmFPType>
316 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
324 template <
typename algorithmFPType>
325 DAAL_EXPORT services::Status allocate(
const daal::algorithms::PartialResult *partialResult,
const daal::algorithms::Parameter *parameter,
const int method);
332 data_management::NumericTablePtr
get(ResultId id)
const;
339 void set(ResultId
id,
const data_management::NumericTablePtr &ptr);
347 services::Status check(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
355 services::Status check(
const daal::algorithms::PartialResult *pres,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
359 template<
typename Archive,
bool onDeserialize>
360 services::Status serialImpl(Archive *arch)
362 return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
365 typedef services::SharedPtr<Result> ResultPtr;
371 class DAAL_EXPORT DistributedStep2MasterInput :
public InputIface
374 DistributedStep2MasterInput();
376 virtual ~DistributedStep2MasterInput() {}
383 data_management::DataCollectionPtr
get(MasterInputId id)
const;
390 void set(MasterInputId
id,
const data_management::DataCollectionPtr &ptr);
398 void add(MasterInputId
id,
const PartialResultPtr &value);
405 size_t getNumberOfFeatures()
const DAAL_C11_OVERRIDE;
412 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
415 using interface1::Parameter;
416 using interface1::InputIface;
417 using interface1::Input;
418 using interface1::PartialResult;
419 using interface1::PartialResultPtr;
420 using interface1::Result;
421 using interface1::ResultPtr;
422 using interface1::DistributedStep2MasterInput;
daal::algorithms::kmeans::partialAssignments
Definition: kmeans_types.h:121
daal::algorithms::kmeans::interface1::Parameter
Parameters for the K-Means algorithm.
Definition: kmeans_types.h:153
daal::algorithms::kmeans::interface1::Result
Results obtained with the compute() method of the K-Means algorithm in the batch processing mode...
Definition: kmeans_types.h:301
daal
Definition: algorithm_base_common.h:57
daal::algorithms::kmeans::interface1::Parameter::assignFlag
bool assignFlag
Definition: kmeans_types.h:173
daal::algorithms::kmeans::interface1::PartialResult
Partial results obtained with the compute() method of the K-Means algorithm in the batch processing m...
Definition: kmeans_types.h:234
daal::algorithms::kmeans::lloydCSR
Definition: kmeans_types.h:77
daal::algorithms::kmeans::MasterInputId
MasterInputId
Available identifiers of input objects for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_types.h:105
daal::algorithms::kmeans::PartialResultId
PartialResultId
Available identifiers of partial results of the K-Means algorithm in the distributed processing mode...
Definition: kmeans_types.h:115
daal::algorithms::kmeans::assignments
Definition: kmeans_types.h:132
daal::algorithms::kmeans::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: kmeans_types.h:170
daal::algorithms::kmeans::nIterations
Definition: kmeans_types.h:135
daal::algorithms::kmeans::interface1::Parameter::nClusters
size_t nClusters
Definition: kmeans_types.h:168
daal::algorithms::kmeans::interface1::Parameter::gamma
double gamma
Definition: kmeans_types.h:171
daal::algorithms::kmeans::inputCentroids
Definition: kmeans_types.h:97
daal::algorithms::kmeans::partialObjectiveFunction
Definition: kmeans_types.h:119
daal::algorithms::kmeans::lloydDense
Definition: kmeans_types.h:75
daal::algorithms::kmeans::data
Definition: kmeans_types.h:96
daal::algorithms::kmeans::defaultDense
Definition: kmeans_types.h:76
daal::algorithms::kmeans::InputId
InputId
Available identifiers of input objects for the K-Means algorithm.
Definition: kmeans_types.h:94
daal::algorithms::kmeans::nObservations
Definition: kmeans_types.h:117
daal::algorithms::kmeans::ResultId
ResultId
Available identifiers of results of the K-Means algorithm.
Definition: kmeans_types.h:129
daal::algorithms::kmeans::goalFunction
Definition: kmeans_types.h:134
daal::algorithms::kmeans::partialGoalFunction
Definition: kmeans_types.h:120
daal::algorithms::kmeans::interface1::Parameter::maxIterations
size_t maxIterations
Definition: kmeans_types.h:169
daal::algorithms::kmeans::DistanceType
DistanceType
Definition: kmeans_types.h:84
daal::algorithms::kmeans::partialResults
Definition: kmeans_types.h:107
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::kmeans::Method
Method
Definition: kmeans_types.h:73
daal::algorithms::kmeans::euclidean
Definition: kmeans_types.h:86
daal::algorithms::kmeans::partialSums
Definition: kmeans_types.h:118
daal::algorithms::kmeans::objectiveFunction
Definition: kmeans_types.h:133
daal::algorithms::kmeans::interface1::Parameter::distanceType
DistanceType distanceType
Definition: kmeans_types.h:172
daal::algorithms::kmeans::centroids
Definition: kmeans_types.h:131