22 #ifndef __KMEANS_TYPES_H__
23 #define __KMEANS_TYPES_H__
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "data_management/data/homogen_numeric_table.h"
28 #include "services/daal_defines.h"
61 lastDistanceType = euclidean
72 lastInputId = inputCentroids
82 lastMasterInputId = partialResults
93 partialObjectiveFunction,
94 partialGoalFunction = partialObjectiveFunction,
96 partialCandidatesDistances,
97 partialCandidatesCentroids,
98 lastPartialResultId = partialCandidatesCentroids
110 goalFunction = objectiveFunction,
112 lastResultId = nIterations
129 struct DAAL_EXPORT Parameter :
public daal::algorithms::Parameter
136 Parameter(
size_t _nClusters,
size_t _maxIterations);
142 Parameter(
const Parameter &other);
145 size_t maxIterations;
146 double accuracyThreshold;
148 DistanceType distanceType;
151 services::Status check() const DAAL_C11_OVERRIDE;
159 class DAAL_EXPORT InputIface : public daal::algorithms::Input
162 InputIface(
size_t nElements) : daal::algorithms::Input(nElements) {};
164 virtual size_t getNumberOfFeatures()
const = 0;
171 class DAAL_EXPORT Input :
public InputIface
182 data_management::NumericTablePtr
get(InputId id)
const;
189 void set(InputId
id,
const data_management::NumericTablePtr &ptr);
196 size_t getNumberOfFeatures()
const DAAL_C11_OVERRIDE;
203 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
210 class DAAL_EXPORT PartialResult :
public daal::algorithms::PartialResult
213 DECLARE_SERIALIZABLE_CAST(PartialResult);
216 virtual ~PartialResult() {};
224 template <
typename algorithmFPType>
225 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
232 data_management::NumericTablePtr
get(PartialResultId id)
const;
239 void set(PartialResultId
id,
const data_management::NumericTablePtr &ptr);
246 size_t getNumberOfFeatures()
const;
254 services::Status check(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
261 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
265 template<
typename Archive,
bool onDeserialize>
266 services::Status serialImpl(Archive *arch)
268 return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
271 typedef services::SharedPtr<PartialResult> PartialResultPtr;
277 class DAAL_EXPORT Result :
public daal::algorithms::Result
280 DECLARE_SERIALIZABLE_CAST(Result);
283 virtual ~Result() {};
291 template <
typename algorithmFPType>
292 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
300 template <
typename algorithmFPType>
301 DAAL_EXPORT services::Status allocate(
const daal::algorithms::PartialResult *partialResult,
const daal::algorithms::Parameter *parameter,
const int method);
308 data_management::NumericTablePtr
get(ResultId id)
const;
315 void set(ResultId
id,
const data_management::NumericTablePtr &ptr);
323 services::Status check(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
331 services::Status check(
const daal::algorithms::PartialResult *pres,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
335 template<
typename Archive,
bool onDeserialize>
336 services::Status serialImpl(Archive *arch)
338 return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
341 typedef services::SharedPtr<Result> ResultPtr;
347 class DAAL_EXPORT DistributedStep2MasterInput :
public InputIface
350 DistributedStep2MasterInput();
352 virtual ~DistributedStep2MasterInput() {}
359 data_management::DataCollectionPtr
get(MasterInputId id)
const;
366 void set(MasterInputId
id,
const data_management::DataCollectionPtr &ptr);
374 void add(MasterInputId
id,
const PartialResultPtr &value);
381 size_t getNumberOfFeatures()
const DAAL_C11_OVERRIDE;
388 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
391 using interface1::Parameter;
392 using interface1::InputIface;
393 using interface1::Input;
394 using interface1::PartialResult;
395 using interface1::PartialResultPtr;
396 using interface1::Result;
397 using interface1::ResultPtr;
398 using interface1::DistributedStep2MasterInput;
daal::algorithms::kmeans::partialAssignments
Definition: kmeans_types.h:95
daal::algorithms::kmeans::interface1::Parameter
Parameters for the K-Means algorithm.
Definition: kmeans_types.h:129
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:277
daal
Definition: algorithm_base_common.h:31
daal::algorithms::kmeans::interface1::Parameter::assignFlag
bool assignFlag
Definition: kmeans_types.h:149
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:210
daal::algorithms::kmeans::lloydCSR
Definition: kmeans_types.h:51
daal::algorithms::kmeans::MasterInputId
MasterInputId
Available identifiers of input objects for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_types.h:79
daal::algorithms::kmeans::PartialResultId
PartialResultId
Available identifiers of partial results of the K-Means algorithm in the distributed processing mode...
Definition: kmeans_types.h:89
daal::algorithms::kmeans::assignments
Definition: kmeans_types.h:108
daal::algorithms::kmeans::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: kmeans_types.h:146
daal::algorithms::kmeans::nIterations
Definition: kmeans_types.h:111
daal::algorithms::kmeans::interface1::Parameter::nClusters
size_t nClusters
Definition: kmeans_types.h:144
daal::algorithms::kmeans::interface1::Parameter::gamma
double gamma
Definition: kmeans_types.h:147
daal::algorithms::kmeans::inputCentroids
Definition: kmeans_types.h:71
daal::algorithms::kmeans::partialObjectiveFunction
Definition: kmeans_types.h:93
daal::algorithms::kmeans::lloydDense
Definition: kmeans_types.h:49
daal::algorithms::kmeans::data
Definition: kmeans_types.h:70
daal::algorithms::kmeans::defaultDense
Definition: kmeans_types.h:50
daal::algorithms::kmeans::InputId
InputId
Available identifiers of input objects for the K-Means algorithm.
Definition: kmeans_types.h:68
daal::algorithms::kmeans::nObservations
Definition: kmeans_types.h:91
daal::algorithms::kmeans::ResultId
ResultId
Available identifiers of results of the K-Means algorithm.
Definition: kmeans_types.h:105
daal::algorithms::kmeans::goalFunction
Definition: kmeans_types.h:110
daal::algorithms::kmeans::partialGoalFunction
Definition: kmeans_types.h:94
daal::algorithms::kmeans::interface1::Parameter::maxIterations
size_t maxIterations
Definition: kmeans_types.h:145
daal::algorithms::kmeans::partialCandidatesCentroids
Definition: kmeans_types.h:97
daal::algorithms::kmeans::DistanceType
DistanceType
Definition: kmeans_types.h:58
daal::algorithms::kmeans::partialResults
Definition: kmeans_types.h:81
daal::algorithms::kmeans::partialCandidatesDistances
Definition: kmeans_types.h:96
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::algorithms::kmeans::Method
Method
Definition: kmeans_types.h:47
daal::algorithms::kmeans::euclidean
Definition: kmeans_types.h:60
daal::algorithms::kmeans::partialSums
Definition: kmeans_types.h:92
daal::algorithms::kmeans::objectiveFunction
Definition: kmeans_types.h:109
daal::algorithms::kmeans::interface1::Parameter::distanceType
DistanceType distanceType
Definition: kmeans_types.h:148
daal::algorithms::kmeans::centroids
Definition: kmeans_types.h:107