ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::test::NodeContextFixture Struct Reference

Test-only fixture that owns the storage backing a NodeContext. More...

#include <NodeContextFixture.hpp>

Public Member Functions

 NodeContextFixture (NodeContextFixture &&)=delete
 
 NodeContextFixture (NodeContextFixture const &)=delete
 
 NodeContextFixture (types::FeatureMatrix x_in, stats::GroupPartition y_part_in, types::OutcomeVector y_vec_in)
 
 NodeContextFixture (types::FeatureMatrix x_in, types::GroupIdVector ids_in)
 
 NodeContextFixture (types::FeatureMatrix x_in, types::OutcomeVector y_vec_in)
 
NodeContextFixtureoperator= (NodeContextFixture &&)=delete
 
NodeContextFixtureoperator= (NodeContextFixture const &)=delete
 

Public Attributes

NodeContext ctx
 
stats::RNG rng
 
types::FeatureMatrix x
 
types::GroupIdVector y_ids
 
stats::GroupPartition y_part
 
types::OutcomeVector y_vec
 

Detailed Description

Test-only fixture that owns the storage backing a NodeContext.

NodeContext holds non-owning references to a feature matrix, group partition, and outcome vector, so a test must keep those alive separately. This fixture bundles them with an RNG and a fully-wired NodeContext, so each strategy NVI test can stop redeclaring the boilerplate.

Three constructors:

  • (x, GroupIdVector ids) — classification flavour. y_vec is derived from ids via cast<Outcome>(); the partition is GroupPartition(ids).
  • (x, OutcomeVector y_vec) — regression flavour. y_ids and the partition are a median split matching ByCutpoint::init's behaviour at the root, so tests pass only the continuous response they actually care about.
  • (x, GroupPartition, OutcomeVector y_vec) — escape hatch for tests that need a partition shape neither default produces (e.g. gp.subset(...), custom two_groups(...) bounds). y_ids is left empty in this case since the partition came in pre-built.

Public fields so tests can mutate them after construction (e.g. f.x = …, f.ctx.projector = …).

Non-copyable / non-movable: ctx references the other members of the same fixture, so any copy or move would silently produce dangling references.

Constructor & Destructor Documentation

◆ NodeContextFixture() [1/5]

ppforest2::test::NodeContextFixture::NodeContextFixture ( types::FeatureMatrix x_in,
types::GroupIdVector ids_in )
inline

◆ NodeContextFixture() [2/5]

ppforest2::test::NodeContextFixture::NodeContextFixture ( types::FeatureMatrix x_in,
types::OutcomeVector y_vec_in )
inline

◆ NodeContextFixture() [3/5]

ppforest2::test::NodeContextFixture::NodeContextFixture ( types::FeatureMatrix x_in,
stats::GroupPartition y_part_in,
types::OutcomeVector y_vec_in )
inline

◆ NodeContextFixture() [4/5]

ppforest2::test::NodeContextFixture::NodeContextFixture ( NodeContextFixture const & )
delete

◆ NodeContextFixture() [5/5]

ppforest2::test::NodeContextFixture::NodeContextFixture ( NodeContextFixture && )
delete

Member Function Documentation

◆ operator=() [1/2]

NodeContextFixture & ppforest2::test::NodeContextFixture::operator= ( NodeContextFixture && )
delete

◆ operator=() [2/2]

NodeContextFixture & ppforest2::test::NodeContextFixture::operator= ( NodeContextFixture const & )
delete

Member Data Documentation

◆ ctx

NodeContext ppforest2::test::NodeContextFixture::ctx

◆ rng

stats::RNG ppforest2::test::NodeContextFixture::rng

◆ x

types::FeatureMatrix ppforest2::test::NodeContextFixture::x

◆ y_ids

types::GroupIdVector ppforest2::test::NodeContextFixture::y_ids

◆ y_part

stats::GroupPartition ppforest2::test::NodeContextFixture::y_part

◆ y_vec

types::OutcomeVector ppforest2::test::NodeContextFixture::y_vec

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