Turi Create  4.0
ml_data_missing_values.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_ML2_DATA_MISSING_VALUES_H_
7 #define TURI_ML2_DATA_MISSING_VALUES_H_
8 
9 #include <map>
10 #include <string>
11 #include <core/data/flexible_type/flexible_type.hpp>
12 
13 #ifdef ERROR
14 #undef ERROR
15 #endif
16 
17 
18 namespace turi { namespace v2 { namespace ml_data_internal {
19 
20 /*********************************************************************************
21  *
22  * Missing Value Action
23  * ================================================================================
24  *
25  * IMPUTE
26  * ------
27  * Imputes the data with the mean. Do not use this during creation time because
28  * the means will change over time. Imnputation only makes sense when you
29  * do it during predict/evaluate time.
30  *
31  *
32  * ERROR
33  * ------
34  * Error out when a missing value occurs in a numeric columns. Keys (categorical
35  * variables of dictionary keys) can accept missing values.
36  *
37  */
38 enum class missing_value_action {IMPUTE, ERROR};
39 
40 
41 /** Returns the enum giving the missing_value_action based on the
42  * options.
43  */
44 missing_value_action get_missing_value_action(
45  const std::map<std::string, flexible_type>& options,
46  bool training_mode);
47 
48 }}}
49 
50 #endif /* TURI_ML2_DATA_MISSING_VALUES_H_ */