ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::serialization::Export< T > Struct Template Reference

A model bundled with its export metadata and optional metrics. More...

#include <Json.hpp>

Public Member Functions

void compute_metrics (types::FeatureMatrix const &, types::ResponseVector const &)
 
void compute_metrics (types::FeatureMatrix const &x, types::ResponseVector const &y)
 Compute and store metrics on this export.
 
json to_json () const
 Serialize to JSON. Only defined for Export<Model::Ptr>.
 
json to_json () const
 

Public Attributes

std::vector< std::string > feature_names
 
GroupNames groups
 
model
 
int n_features = 0
 
int n_observations = 0
 
TrainingSpec::Ptr spec
 
Optional metrics — serialized by to_json() when present.
std::optional< VariableImportancevariable_importance
 
std::optional< stats::ConfusionMatrixtraining_confusion_matrix
 
std::optional< stats::ConfusionMatrixoob_confusion_matrix
 
std::optional< double > oob_error
 

Detailed Description

template<typename T>
struct ppforest2::serialization::Export< T >

A model bundled with its export metadata and optional metrics.

Represents the full JSON export format: { model_type, model, config, meta, [metrics] }.

Use j.get<Export<Tree>>() or j.get<Export<Model::Ptr>>() to deserialize a full export, and model_export.to_json() to serialize.

For Export<Model::Ptr>, construct with training data to compute metrics automatically, or use compute_metrics() after construction.

Member Function Documentation

◆ compute_metrics() [1/2]

◆ compute_metrics() [2/2]

template<typename T>
void ppforest2::serialization::Export< T >::compute_metrics ( types::FeatureMatrix const & x,
types::ResponseVector const & y )

Compute and store metrics on this export.

Only defined for Export<Model::Ptr>.

◆ to_json() [1/2]

template<typename T>
json ppforest2::serialization::Export< T >::to_json ( ) const

Serialize to JSON. Only defined for Export<Model::Ptr>.

◆ to_json() [2/2]

Member Data Documentation

◆ feature_names

template<typename T>
std::vector<std::string> ppforest2::serialization::Export< T >::feature_names

◆ groups

template<typename T>
GroupNames ppforest2::serialization::Export< T >::groups

◆ model

template<typename T>
T ppforest2::serialization::Export< T >::model

◆ n_features

template<typename T>
int ppforest2::serialization::Export< T >::n_features = 0

◆ n_observations

template<typename T>
int ppforest2::serialization::Export< T >::n_observations = 0

◆ oob_confusion_matrix

template<typename T>
std::optional<stats::ConfusionMatrix> ppforest2::serialization::Export< T >::oob_confusion_matrix

◆ oob_error

template<typename T>
std::optional<double> ppforest2::serialization::Export< T >::oob_error

◆ spec

template<typename T>
TrainingSpec::Ptr ppforest2::serialization::Export< T >::spec

◆ training_confusion_matrix

template<typename T>
std::optional<stats::ConfusionMatrix> ppforest2::serialization::Export< T >::training_confusion_matrix

◆ variable_importance

template<typename T>
std::optional<VariableImportance> ppforest2::serialization::Export< T >::variable_importance

The documentation for this struct was generated from the following file: