Node.cpp 693 Bytes
Newer Older
Thomas Purcell's avatar
Thomas Purcell committed
1
2
#include <feature_creation/node/Node.hpp>

Thomas Purcell's avatar
Thomas Purcell committed
3
4
5
Node::Node()
{}

6
Node::Node(unsigned long int feat_ind, int n_samp, int n_test_samp) :
7
    _n_test_samp(n_test_samp),
Thomas Purcell's avatar
Thomas Purcell committed
8
    _n_samp(n_samp),
9
    _feat_ind(feat_ind),
10
11
12
    _arr_ind(feat_ind),
    _d_mat_ind(-1),
    _selected(false)
Thomas Purcell's avatar
Thomas Purcell committed
13
14
{}

Thomas Purcell's avatar
Thomas Purcell committed
15
Node::~Node()
16
17
{}

18
19
20
21
22
23
void Node::set_standardized_value(int offset)
{
    set_value(offset);

    double mean = util_funcs::mean(value_ptr(offset), _n_samp);
    double stand_dev = util_funcs::stand_dev(value_ptr(offset), _n_samp, mean);
24

25
26
27
    std::transform(value_ptr(offset), value_ptr(offset) + _n_samp, value_ptr(offset), [=](double vv){return (vv - mean) / stand_dev;});
}

Thomas Purcell's avatar
Thomas Purcell committed
28
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Node)
Thomas Purcell's avatar
Thomas Purcell committed
29