ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
Json.hpp File Reference
#include "models/TreeNode.hpp"
#include "models/TreeBranch.hpp"
#include "models/TreeLeaf.hpp"
#include "models/Tree.hpp"
#include "models/Forest.hpp"
#include "models/Evaluation.hpp"
#include "stats/ConfusionMatrix.hpp"
#include "stats/Metrics.hpp"
#include <nlohmann/json.hpp>
#include <optional>
#include <ostream>

Go to the source code of this file.

Classes

struct  nlohmann::adl_serializer< Eigen::Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > >
 Eigen::Matrix ↔ JSON. More...
 
struct  nlohmann::adl_serializer< ppforest2::serialization::Export< ppforest2::Forest::Ptr > >
 
struct  nlohmann::adl_serializer< ppforest2::serialization::Export< ppforest2::Model::Ptr > >
 
struct  nlohmann::adl_serializer< ppforest2::serialization::Export< ppforest2::Tree::Ptr > >
 
struct  nlohmann::adl_serializer< ppforest2::stats::ClassificationMetrics >
 
struct  nlohmann::adl_serializer< ppforest2::stats::ConfusionMatrix >
 
struct  nlohmann::adl_serializer< ppforest2::stats::RegressionMetrics >
 
struct  nlohmann::adl_serializer< ppforest2::VariableImportance >
 
struct  ppforest2::serialization::Export< T >
 A model bundled with its export metadata and optional metrics. More...
 
class  ppforest2::serialization::JsonModelVisitor
 Visitor that serializes a model (Tree or Forest) to JSON. More...
 
class  ppforest2::serialization::JsonNodeVisitor
 Visitor that serializes a tree node to JSON. More...
 

Namespaces

namespace  nlohmann
 
namespace  ppforest2
 Binarization strategies for multiclass-to-binary reduction.
 
namespace  ppforest2::serialization
 JSON serialization and deserialization for ppforest2 models.
 

Typedefs

using ppforest2::serialization::json = nlohmann::json
 
using ppforest2::serialization::Metrics = stats::Metrics
 Re-export of stats::Metrics for serialization callers.
 
using ppforest2::serialization::Names = types::Names
 Re-export of types::Names for serialization callers.
 

Functions

json ppforest2::serialization::to_json (types::OutcomeVector const &y, types::Names const &names)
 Serialize a prediction vector as JSON.
 
Serialization
json ppforest2::serialization::to_json (BaggedTree const &tree)
 
json ppforest2::serialization::to_json (Forest const &forest)
 
json ppforest2::serialization::to_json (Metrics const &metrics)
 
json ppforest2::serialization::to_json (Model const &model)
 
json ppforest2::serialization::to_json (stats::ClassificationMetrics const &cm)
 
json ppforest2::serialization::to_json (stats::ConfusionMatrix const &cm)
 
json ppforest2::serialization::to_json (stats::RegressionMetrics const &rm)
 
json ppforest2::serialization::to_json (Tree const &tree)
 
json ppforest2::serialization::to_json (TreeNode const &node)
 
json ppforest2::serialization::to_json (types::FeatureMatrix const &matrix)
 
json ppforest2::serialization::to_json (VariableImportance const &vi)
 
Labeled serialization (uses group names instead of integer codes)
json ppforest2::serialization::to_json (BaggedTree const &tree, Names const &group_names)
 
json ppforest2::serialization::to_json (Forest const &forest, Names const &group_names)
 
json ppforest2::serialization::to_json (Metrics const &metrics, Names const &group_names)
 
json ppforest2::serialization::to_json (Model const &model, Names const &group_names)
 
json ppforest2::serialization::to_json (stats::ClassificationMetrics const &cm, Names const &group_names)
 
json ppforest2::serialization::to_json (stats::ConfusionMatrix const &cm, Names const &group_names)
 
json ppforest2::serialization::to_json (stats::RegressionMetrics const &rm, Names const &group_names)
 
json ppforest2::serialization::to_json (Tree const &tree, Names const &group_names)
 
json ppforest2::serialization::to_json (TreeNode const &node, Names const &group_names)
 
Optional serialization — <tt>nullopt</tt> round-trips as JSON <tt>null</tt>.
json ppforest2::serialization::to_json (std::optional< Metrics > const &metrics)
 
json ppforest2::serialization::to_json (std::optional< Metrics > const &metrics, Names const &group_names)
 
json ppforest2::serialization::to_json (std::optional< VariableImportance > const &vi)
 
Deserialization
template<typename T>
ppforest2::serialization::from_json (json const &j)
 Deserialize a value block (confusion matrix, VI, metrics, …).
 
template<>
stats::ClassificationMetrics ppforest2::serialization::from_json< stats::ClassificationMetrics > (json const &j)
 
template<>
stats::ConfusionMatrix ppforest2::serialization::from_json< stats::ConfusionMatrix > (json const &j)
 
template<>
stats::RegressionMetrics ppforest2::serialization::from_json< stats::RegressionMetrics > (json const &j)
 
template<>
VariableImportance ppforest2::serialization::from_json< VariableImportance > (json const &j)
 
Metrics ppforest2::serialization::metrics_from_json (json const &j, types::Mode mode)
 Deserialize a Metrics block; mode picks the variant alternative.
 
Stream operators
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, TreeBranch const &condition)
 
std::ostream & ppforest2::serialization::operator<< (std::ostream &os, TreeLeaf const &response)
 
std::ostream & ppforest2::serialization::operator<< (std::ostream &os, TreeNode const &node)
 
template<typename V>
std::ostream & ppforest2::serialization::operator<< (std::ostream &ostream, std::map< int, V > const &map)
 
template<typename K, typename V>
std::ostream & ppforest2::serialization::operator<< (std::ostream &ostream, std::map< K, V > const &map)
 
template<typename V, typename C1, typename C2>
std::ostream & ppforest2::serialization::operator<< (std::ostream &ostream, std::set< V, C1, C2 > const &set)
 
template<typename V>
std::ostream & ppforest2::serialization::operator<< (std::ostream &ostream, std::vector< V > const &vec)