Single dataset column descriptor: name, role, type, scaler, and optional categories. More...
#include <variable.h>
Public Member Functions | |
| Variable (const string &={}, const string &="None", const VariableType &=VariableType::Numeric, const string &="MeanStandardDeviation", const vector< string > &={}) | |
| Constructs a Variable with optional name, role, type, scaler and category list. | |
| void | set (const string &={}, const string &="None", const VariableType &=VariableType::Numeric, const string &="MeanStandardDeviation", const vector< string > &={}) |
| Resets the Variable fields to the supplied values. | |
| const string & | get_role () const |
| VariableRole | get_role_type () const |
| const string & | get_scaler () const |
| ScalerMethod | get_scaler_type () const |
| const string & | get_type_string () const |
| Returns the canonical string name of the Variable type. | |
| Index | get_categories_number () const |
| Returns the number of categories for categorical variables (zero otherwise). | |
| void | set_scaler (const string &new_scaler) |
| void | set_scaler (ScalerMethod new_scaler) |
| void | set_role (const string &new_role) |
| void | set_role (VariableRole new_role) |
| void | set_type (const string &) |
| Sets the Variable type from its canonical string name. | |
| void | set_categories (const vector< string > &new_categories) |
| void | from_JSON (const JsonDocument &) |
| Loads Variable fields from a JSON document. | |
| void | to_JSON (JsonWriter &) const |
| Writes Variable fields to a JSON writer. | |
| bool | is_binary () const |
| Returns true if the Variable type is Binary. | |
| bool | is_categorical () const |
| Returns true if the Variable type is Categorical. | |
| bool | is_used () const |
| Returns true if the Variable has an active role other than Time. | |
| Index | feature_count () const |
| Returns the number of features generated by this Variable (categories or one). | |
| vector< string > | get_names () const |
| Returns the expanded feature names (one per category for categorical variables). | |
Public Attributes | |
| string | name |
| VariableRole | role = VariableRole::None |
| VariableType | type = VariableType::None |
| vector< string > | categories |
| ScalerMethod | scaler = ScalerMethod::None |
Detailed Description
Single dataset column descriptor: name, role, type, scaler, and optional categories.
Constructor & Destructor Documentation
◆ Variable()
| opennn::Variable::Variable | ( | const string & | = {}, |
| const string & | = "None", | ||
| const VariableType & | = VariableType::Numeric, | ||
| const string & | = "MeanStandardDeviation", | ||
| const vector< string > & | = {} ) |
Constructs a Variable with optional name, role, type, scaler and category list.
Member Function Documentation
◆ feature_count()
|
inline |
Returns the number of features generated by this Variable (categories or one).
◆ from_JSON()
| void opennn::Variable::from_JSON | ( | const JsonDocument & | ) |
Loads Variable fields from a JSON document.
◆ get_categories_number()
| Index opennn::Variable::get_categories_number | ( | ) | const |
Returns the number of categories for categorical variables (zero otherwise).
◆ get_names()
| vector< string > opennn::Variable::get_names | ( | ) | const |
Returns the expanded feature names (one per category for categorical variables).
◆ get_role()
|
inline |
◆ get_role_type()
|
inline |
◆ get_scaler()
|
inline |
◆ get_scaler_type()
|
inline |
◆ get_type_string()
| const string & opennn::Variable::get_type_string | ( | ) | const |
Returns the canonical string name of the Variable type.
◆ is_binary()
|
inline |
Returns true if the Variable type is Binary.
◆ is_categorical()
|
inline |
Returns true if the Variable type is Categorical.
◆ is_used()
|
inline |
Returns true if the Variable has an active role other than Time.
◆ set()
| void opennn::Variable::set | ( | const string & | = {}, |
| const string & | = "None", | ||
| const VariableType & | = VariableType::Numeric, | ||
| const string & | = "MeanStandardDeviation", | ||
| const vector< string > & | = {} ) |
◆ set_categories()
|
inline |
◆ set_role() [1/2]
|
inline |
◆ set_role() [2/2]
|
inline |
◆ set_scaler() [1/2]
|
inline |
◆ set_scaler() [2/2]
|
inline |
◆ set_type()
| void opennn::Variable::set_type | ( | const string & | ) |
Sets the Variable type from its canonical string name.
◆ to_JSON()
| void opennn::Variable::to_JSON | ( | JsonWriter & | ) | const |
Writes Variable fields to a JSON writer.
Member Data Documentation
◆ categories
| vector<string> opennn::Variable::categories |
◆ name
| string opennn::Variable::name |
◆ role
| VariableRole opennn::Variable::role = VariableRole::None |
◆ scaler
| ScalerMethod opennn::Variable::scaler = ScalerMethod::None |
◆ type
| VariableType opennn::Variable::type = VariableType::None |