GPUdb C++ API  Version 7.2.2.4
aggregate_k_means.h
Go to the documentation of this file.
1 /*
2  * This file was autogenerated by the Kinetica schema processor.
3  *
4  * DO NOT EDIT DIRECTLY.
5  */
6 #ifndef __AGGREGATE_K_MEANS_H__
7 #define __AGGREGATE_K_MEANS_H__
8 
9 namespace gpudb
10 {
30  {
35  tableName(std::string()),
36  columnNames(std::vector<std::string>()),
37  k(int32_t()),
38  tolerance(double()),
39  options(std::map<std::string, std::string>())
40  {
41  }
42 
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_):
163  tableName( tableName_ ),
164  columnNames( columnNames_ ),
165  k( k_ ),
166  tolerance( tolerance_ ),
167  options( options_ )
168  {
169  }
170 
177  std::string tableName;
178 
184  std::vector<std::string> columnNames;
185 
189  int32_t k;
190 
195  double tolerance;
196 
268  std::map<std::string, std::string> options;
269  };
270 } // end namespace gpudb
271 
272 namespace avro
273 {
274  template<> struct codec_traits<gpudb::AggregateKMeansRequest>
275  {
276  static void encode(Encoder& e, const gpudb::AggregateKMeansRequest& v)
277  {
278  ::avro::encode(e, v.tableName);
279  ::avro::encode(e, v.columnNames);
280  ::avro::encode(e, v.k);
281  ::avro::encode(e, v.tolerance);
282  ::avro::encode(e, v.options);
283  }
284 
285  static void decode(Decoder& d, gpudb::AggregateKMeansRequest& v)
286  {
287  if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
288  {
289  const std::vector<size_t> fo = rd->fieldOrder();
290 
291  for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
292  {
293  switch (*it)
294  {
295  case 0:
296  ::avro::decode(d, v.tableName);
297  break;
298 
299  case 1:
300  ::avro::decode(d, v.columnNames);
301  break;
302 
303  case 2:
304  ::avro::decode(d, v.k);
305  break;
306 
307  case 3:
308  ::avro::decode(d, v.tolerance);
309  break;
310 
311  case 4:
312  ::avro::decode(d, v.options);
313  break;
314 
315  default:
316  break;
317  }
318  }
319  }
320  else
321  {
322  ::avro::decode(d, v.tableName);
323  ::avro::decode(d, v.columnNames);
324  ::avro::decode(d, v.k);
325  ::avro::decode(d, v.tolerance);
326  ::avro::decode(d, v.options);
327  }
328  }
329  };
330 } // end namespace avro
331 
332 namespace gpudb
333 {
340  {
346  means(std::vector<std::vector<double> >()),
347  counts(std::vector<int64_t>()),
348  rmsDists(std::vector<double>()),
349  count(int64_t()),
350  rmsDist(double()),
351  tolerance(double()),
352  numIters(int32_t()),
353  info(std::map<std::string, std::string>())
354  {
355  }
356 
360  std::vector<std::vector<double> > means;
361 
366  std::vector<int64_t> counts;
367 
372  std::vector<double> rmsDists;
373 
378  int64_t count;
379 
384  double rmsDist;
385 
390  double tolerance;
391 
395  int32_t numIters;
396 
407  std::map<std::string, std::string> info;
408  };
409 } // end namespace gpudb
410 
411 namespace avro
412 {
413  template<> struct codec_traits<gpudb::AggregateKMeansResponse>
414  {
415  static void encode(Encoder& e, const gpudb::AggregateKMeansResponse& v)
416  {
417  ::avro::encode(e, v.means);
418  ::avro::encode(e, v.counts);
419  ::avro::encode(e, v.rmsDists);
420  ::avro::encode(e, v.count);
421  ::avro::encode(e, v.rmsDist);
422  ::avro::encode(e, v.tolerance);
423  ::avro::encode(e, v.numIters);
424  ::avro::encode(e, v.info);
425  }
426 
427  static void decode(Decoder& d, gpudb::AggregateKMeansResponse& v)
428  {
429  if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
430  {
431  const std::vector<size_t> fo = rd->fieldOrder();
432 
433  for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
434  {
435  switch (*it)
436  {
437  case 0:
438  ::avro::decode(d, v.means);
439  break;
440 
441  case 1:
442  ::avro::decode(d, v.counts);
443  break;
444 
445  case 2:
446  ::avro::decode(d, v.rmsDists);
447  break;
448 
449  case 3:
450  ::avro::decode(d, v.count);
451  break;
452 
453  case 4:
454  ::avro::decode(d, v.rmsDist);
455  break;
456 
457  case 5:
458  ::avro::decode(d, v.tolerance);
459  break;
460 
461  case 6:
462  ::avro::decode(d, v.numIters);
463  break;
464 
465  case 7:
466  ::avro::decode(d, v.info);
467  break;
468 
469  default:
470  break;
471  }
472  }
473  }
474  else
475  {
476  ::avro::decode(d, v.means);
477  ::avro::decode(d, v.counts);
478  ::avro::decode(d, v.rmsDists);
479  ::avro::decode(d, v.count);
480  ::avro::decode(d, v.rmsDist);
481  ::avro::decode(d, v.tolerance);
482  ::avro::decode(d, v.numIters);
483  ::avro::decode(d, v.info);
484  }
485  }
486  };
487 } // end namespace avro
488 
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.