|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
JSON serialization and deserialization for ppforest2 models. More...
Classes | |
| struct | Export |
| A model bundled with its export metadata and optional metrics. More... | |
| struct | JsonModelVisitor |
| Visitor that serializes a model (Tree or Forest) to JSON. More... | |
| struct | JsonNodeVisitor |
| Visitor that serializes a tree node to JSON. More... | |
Typedefs | |
| using | GroupNames = std::vector<std::string> |
| Group name vector for labeled serialization. | |
| using | json = nlohmann::json |
Functions | |
| std::vector< std::string > | to_labels (types::ResponseVector const &predictions, std::vector< std::string > const &group_names) |
| Map integer response codes to group name strings. | |
Serialization | |
| json | to_json (Model const &model) |
| json | to_json (TreeNode const &node) |
| json | to_json (Tree const &tree) |
| json | to_json (BootstrapTree const &tree) |
| json | to_json (Forest const &forest) |
| json | to_json (stats::ConfusionMatrix const &cm) |
| json | to_json (VariableImportance const &vi) |
| json | to_json (types::FeatureMatrix const &matrix) |
Labeled serialization (uses group names instead of integer codes) | |
| json | to_json (Model const &model, GroupNames const &group_names) |
| json | to_json (TreeNode const &node, GroupNames const &group_names) |
| json | to_json (Tree const &tree, GroupNames const &group_names) |
| json | to_json (BootstrapTree const &tree, GroupNames const &group_names) |
| json | to_json (Forest const &forest, GroupNames const &group_names) |
| json | to_json (stats::ConfusionMatrix const &cm, GroupNames const &group_names) |
Deserialization | |
| template<typename T> | |
| T | from_json (json const &j) |
| Deserialize from a model block (integer labels only). | |
| template<> | |
| Tree | from_json< Tree > (json const &j) |
| template<> | |
| Forest | from_json< Forest > (json const &j) |
| template<> | |
| stats::ConfusionMatrix | from_json< stats::ConfusionMatrix > (json const &j) |
| template<> | |
| VariableImportance | from_json< VariableImportance > (json const &j) |
Stream operators | |
| std::ostream & | operator<< (std::ostream &os, TreeNode const &node) |
| std::ostream & | operator<< (std::ostream &os, TreeCondition const &condition) |
| std::ostream & | operator<< (std::ostream &os, TreeResponse const &response) |
| std::ostream & | operator<< (std::ostream &os, Tree const &tree) |
| std::ostream & | operator<< (std::ostream &os, Forest const &forest) |
| template<typename V> | |
| std::ostream & | operator<< (std::ostream &ostream, std::vector< V > const &vec) |
| template<typename V, typename C1, typename C2> | |
| std::ostream & | operator<< (std::ostream &ostream, std::set< V, C1, C2 > const &set) |
| template<typename K, typename V> | |
| std::ostream & | operator<< (std::ostream &ostream, std::map< K, V > const &map) |
| template<typename V> | |
| std::ostream & | operator<< (std::ostream &ostream, std::map< int, V > const &map) |
JSON serialization and deserialization for ppforest2 models.
Uses nlohmann/json. Provides to_json() for serializing trees, forests, confusion matrices, and variable importance to JSON. Deserialization uses j.get<T>() via nlohmann ADL:
| using ppforest2::serialization::GroupNames = std::vector<std::string> |
Group name vector for labeled serialization.
| using ppforest2::serialization::json = nlohmann::json |
| T ppforest2::serialization::from_json | ( | json const & | j | ) |
Deserialize from a model block (integer labels only).
For labeled JSON (string values/groups), use j.get<Export<T>>() instead. Call via serialization::from_json<T>(j) or j.get<T>().
| Forest ppforest2::serialization::from_json< Forest > | ( | json const & | j | ) |
| stats::ConfusionMatrix ppforest2::serialization::from_json< stats::ConfusionMatrix > | ( | json const & | j | ) |
| Tree ppforest2::serialization::from_json< Tree > | ( | json const & | j | ) |
| VariableImportance ppforest2::serialization::from_json< VariableImportance > | ( | json const & | j | ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | os, |
| Forest const & | forest ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | os, |
| Tree const & | tree ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | os, |
| TreeCondition const & | condition ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | os, |
| TreeNode const & | node ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | os, |
| TreeResponse const & | response ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | ostream, |
| std::map< int, V > const & | map ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | ostream, |
| std::map< K, V > const & | map ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | ostream, |
| std::set< V, C1, C2 > const & | set ) |
| std::ostream & ppforest2::serialization::operator<< | ( | std::ostream & | ostream, |
| std::vector< V > const & | vec ) |
| json ppforest2::serialization::to_json | ( | BootstrapTree const & | tree | ) |
| json ppforest2::serialization::to_json | ( | BootstrapTree const & | tree, |
| GroupNames const & | group_names ) |
| json ppforest2::serialization::to_json | ( | Forest const & | forest, |
| GroupNames const & | group_names ) |
| json ppforest2::serialization::to_json | ( | Model const & | model, |
| GroupNames const & | group_names ) |
| json ppforest2::serialization::to_json | ( | stats::ConfusionMatrix const & | cm | ) |
| json ppforest2::serialization::to_json | ( | stats::ConfusionMatrix const & | cm, |
| GroupNames const & | group_names ) |
| json ppforest2::serialization::to_json | ( | Tree const & | tree, |
| GroupNames const & | group_names ) |
| json ppforest2::serialization::to_json | ( | TreeNode const & | node, |
| GroupNames const & | group_names ) |
| json ppforest2::serialization::to_json | ( | types::FeatureMatrix const & | matrix | ) |
| json ppforest2::serialization::to_json | ( | VariableImportance const & | vi | ) |
| std::vector< std::string > ppforest2::serialization::to_labels | ( | types::ResponseVector const & | predictions, |
| std::vector< std::string > const & | group_names ) |
Map integer response codes to group name strings.