OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MLModelMetadata.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 HEAVY.AI, 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 
19 #include "MLModelType.h"
20 
21 #include <string>
22 #include <vector>
23 
25  public:
26  MLModelMetadata(const std::string& model_name,
27  const MLModelType model_type,
28  const std::string& model_type_str,
29  const int64_t num_logical_features,
30  const int64_t num_features,
31  const int64_t num_categorical_features,
32  const int64_t num_numeric_features,
33  const std::string& model_metadata_json)
34  : model_name_(model_name)
35  , model_type_(model_type)
36  , model_type_str_(model_type_str)
37  , num_logical_features_(num_logical_features)
38  , num_features_(num_features)
39  , num_categorical_features_(num_categorical_features)
40  , num_numeric_features_(num_numeric_features) {
41  extractModelMetadata(model_metadata_json, num_logical_features);
42  }
43 
44  void extractModelMetadata(const std::string& model_metadata_json,
45  const int64_t num_logical_features);
46 
47  const std::string& getModelName() const { return model_name_; }
48  const MLModelType getModelType() const { return model_type_; }
49  const std::string& getModelTypeStr() const { return model_type_str_; }
50  int64_t getNumLogicalFeatures() const { return num_logical_features_; }
51  int64_t getNumFeatures() const { return num_features_; }
53  int64_t getNumNumericFeatures() const { return num_numeric_features_; }
54  const std::string& getPredicted() const { return predicted_; }
55  const std::vector<std::string>& getFeatures() const { return features_; }
56  const std::string& getTrainingQuery() const { return training_query_; }
59  const std::vector<int64_t>& getFeaturePermutations() const {
60  return feature_permutations_;
61  }
62 
63  private:
64  const std::string model_name_;
66  const std::string model_type_str_;
67  const int64_t num_logical_features_;
68  const int64_t num_features_;
70  const int64_t num_numeric_features_;
71  std::string predicted_;
72  std::vector<std::string> features_;
73  std::string training_query_;
76  std::vector<int64_t> feature_permutations_;
77 };
double data_split_eval_fraction_
std::string training_query_
const int64_t num_categorical_features_
const std::string & getModelName() const
const std::string & getTrainingQuery() const
const int64_t num_numeric_features_
double data_split_train_fraction_
void extractModelMetadata(const std::string &model_metadata_json, const int64_t num_logical_features)
const std::vector< std::string > & getFeatures() const
std::vector< std::string > features_
MLModelType
Definition: MLModelType.h:25
const int64_t num_features_
const std::string model_type_str_
MLModelMetadata(const std::string &model_name, const MLModelType model_type, const std::string &model_type_str, const int64_t num_logical_features, const int64_t num_features, const int64_t num_categorical_features, const int64_t num_numeric_features, const std::string &model_metadata_json)
const MLModelType model_type_
double getDataSplitTrainFraction() const
std::vector< int64_t > feature_permutations_
const std::string & getPredicted() const
std::string predicted_
int64_t getNumFeatures() const
const std::vector< int64_t > & getFeaturePermutations() const
int64_t getNumCategoricalFeatures() const
const int64_t num_logical_features_
const std::string & getModelTypeStr() const
const std::string model_name_
int64_t getNumLogicalFeatures() const
double getDataSplitEvalFraction() const
int64_t getNumNumericFeatures() const
const MLModelType getModelType() const