OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MLTableFunctionsCommon.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc., Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
20 
21 #include <map>
22 
24 
25 MLFramework get_ml_framework(const std::string& ml_framework_str) {
26  const auto upper_ml_framework_str = to_upper(ml_framework_str);
27  const static std::map<std::string, MLFramework> ml_framework_map = {
28  {"DEFAULT", MLFramework::DEFAULT},
29  {"ONEDAL", MLFramework::ONEDAL},
30  {"MLPACK", MLFramework::MLPACK}};
31  const auto itr = ml_framework_map.find(upper_ml_framework_str);
32  if (itr == ml_framework_map.end()) {
33  return MLFramework::INVALID;
34  }
35  return itr->second;
36 }
37 
39 
40 KMeansInitStrategy get_kmeans_init_type(const std::string& init_type_str) {
41  const auto upper_init_type_str = to_upper(init_type_str);
42  const static std::map<std::string, KMeansInitStrategy> kmeans_init_type_map = {
43  {"DEFAULT", KMeansInitStrategy::DEFAULT},
44  {"DETERMINISTIC", KMeansInitStrategy::DETERMINISTIC},
45  {"RANDOM", KMeansInitStrategy::RANDOM},
46  {"PLUS_PLUS", KMeansInitStrategy::PLUS_PLUS}};
47  const auto itr = kmeans_init_type_map.find(upper_init_type_str);
48  if (itr == kmeans_init_type_map.end()) {
50  }
51  return itr->second;
52 }
KMeansInitStrategy get_kmeans_init_type(const std::string &init_type_str)
MLFramework get_ml_framework(const std::string &ml_framework_str)
KMeansInitStrategy
std::string to_upper(const std::string &str)