6 #ifndef __AGGREGATE_K_MEANS_H__ 7 #define __AGGREGATE_K_MEANS_H__ 39 options(std::map<std::string, std::string>())
162 AggregateKMeansRequest(
const std::string& tableName_,
const std::vector<std::string>& columnNames_,
const int32_t k_,
const double tolerance_,
const std::map<std::string, std::string>& options_):
274 template<>
struct codec_traits<
gpudb::AggregateKMeansRequest>
280 ::avro::encode(e, v.
k);
287 if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
289 const std::vector<size_t> fo = rd->fieldOrder();
291 for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
304 ::avro::decode(d, v.
k);
324 ::avro::decode(d, v.
k);
346 means(std::vector<std::vector<double> >()),
347 counts(std::vector<int64_t>()),
353 info(std::map<std::string, std::string>())
360 std::vector<std::vector<double> >
means;
407 std::map<std::string, std::string>
info;
413 template<>
struct codec_traits<
gpudb::AggregateKMeansResponse>
417 ::avro::encode(e, v.
means);
418 ::avro::encode(e, v.
counts);
420 ::avro::encode(e, v.
count);
424 ::avro::encode(e, v.
info);
429 if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
431 const std::vector<size_t> fo = rd->fieldOrder();
433 for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
438 ::avro::decode(d, v.
means);
442 ::avro::decode(d, v.
counts);
450 ::avro::decode(d, v.
count);
466 ::avro::decode(d, v.
info);
476 ::avro::decode(d, v.
means);
477 ::avro::decode(d, v.
counts);
479 ::avro::decode(d, v.
count);
483 ::avro::decode(d, v.
info);
489 #endif // __AGGREGATE_K_MEANS_H__
AggregateKMeansResponse()
Constructs an AggregateKMeansResponse object with default parameters.
AggregateKMeansRequest(const std::string &tableName_, const std::vector< std::string > &columnNames_, const int32_t k_, const double tolerance_, const std::map< std::string, std::string > &options_)
Constructs an AggregateKMeansRequest object with the specified parameters.
double rmsDist
The sum of all the rms_dists - the value the k-means algorithm is attempting to minimize.
double tolerance
The distance between the last two iterations of the algorithm before it quit.
std::string tableName
Name of the table on which the operation will be performed.
A set of parameters for GPUdb::aggregateKMeans.
std::map< std::string, std::string > options
Optional parameters.
std::vector< std::string > columnNames
List of column names on which the operation would be performed.
std::vector< std::vector< double > > means
The k-mean values found.
std::map< std::string, std::string > info
Additional information.
A set of results returned by GPUdb::aggregateKMeans.
std::vector< int64_t > counts
The number of elements in the cluster closest the corresponding k-means values.
int32_t numIters
The number of iterations the algorithm executed before it quit.
int32_t k
The number of mean points to be determined by the algorithm.
std::vector< double > rmsDists
The root mean squared distance of the elements in the cluster for each of the k-means values.
AggregateKMeansRequest()
Constructs an AggregateKMeansRequest object with default parameters.
double tolerance
Stop iterating when the distances between successive points is less than the given tolerance.
int64_t count
The total count of all the clusters - will be the size of the input table.