Turi Create  4.0
unity_kmeans.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_UNITY_KMEANS_H
7 #define TURI_UNITY_KMEANS_H
8 
9 #include <vector>
10 
11 #include <model_server/lib/toolkit_function_specification.hpp>
12 #include <model_server/lib/variant.hpp>
13 
14 namespace turi {
15 namespace kmeans {
16 
17 /**
18  * Get the current set of options.
19  *
20  * \param[in] params dictionary with function arguments
21  * \returns Dictionary with current options.
22  *
23  * Params dictionary keys
24  * \property[in] model KMeans model object.
25  * \property[in] model_name Name of the model.
26  */
27 variant_map_type get_current_options(variant_map_type& params);
28 
29 /**
30  * Get any value from the model.
31  *
32  * \param[in] params dictionary with function arguments
33  * \returns Dictionary
34  *
35  * Params dictionary keys
36  * \property[in] model KMeans model object.
37  * \property[in] model_name Name of the model.
38  * \property[out] "value" Value of the key.
39  *
40  */
41 variant_map_type get_value(variant_map_type& params);
42 
43 /**
44  * Creation function for KMeans clustering model. Checks for errors
45  * in inputs and makes sure all options provided by the user overwrite default
46  * options.
47  *
48  * \param[in] params dictionary with function arguments
49  * \returns Dictionary with new model.
50  *
51  * Params dictionary keys
52  * \property[in,out] model KMeans model object.
53  * \property[in] model_name Name of the model.
54  */
55 variant_map_type train(variant_map_type& params);
56 
57 /**
58  * Predict function for the Kmeans model.
59  *
60  * \param params dictionary with function arguments
61  * \return toolkit function response
62  *
63  * Params dictionary keys
64  * \property[in] model KMeans model object.
65  * \property[in] model_name Name of the model.
66  */
67 variant_map_type predict(variant_map_type& params);
68 
69 /**
70  * Obtain registration for the KMeans model toolkit.
71  */
72 std::vector<toolkit_function_specification> get_toolkit_function_registration();
73 
74 } // namespace kmeans
75 } // namespace turi
76 
77 #endif