FeatureSpace.hpp 1.55 KB
Newer Older
Thomas Purcell's avatar
Thomas Purcell committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef FEATURE_SPACE
#define FEATURE_SPACE

#include <feature_creation/node/FeatureNode.hpp>
#include <feature_creation/node/operator_nodes/allowed_ops.hpp>

#include <iostream>

class FeatureSpace
{
    int max_phi_;
    int n_sis_select_;
    int n_samp_;
    int n_feat_;

    double max_abs_feat_val_;

    std::vector<int> start_gen_;
    std::vector<int> start_D_ind_;

    std::vector<double> prop_;
    std::vector<double> scores_;
    std::vector<double> D_;

    std::vector<un_op_node_gen> un_operators_;
    std::vector<bin_op_node_gen> bin_operators_;
    std::vector<bin_op_node_gen> com_bin_operators_;

    std::vector<node_ptr> phi_selected_;
    std::vector<node_ptr> phi_;
    std::vector<node_ptr> phi_0_;

public:
    FeatureSpace(
        std::vector<node_ptr> phi_0,
        std::vector<std::string> allowed_ops,
        int max_phi=1,
        int n_sis_select=1,
        double max_abs_feat_val=1e27
    );

    FeatureSpace(
        std::vector<node_ptr> phi_0,
        int max_phi=1,
        int n_sis_select=1,
        double max_abs_feat_val=1e27
    );

    FeatureSpace(FeatureSpace &o);
    FeatureSpace(FeatureSpace &&o);

    void generate_feature_space();

    inline std::vector<node_ptr> phi_selected(){return phi_selected_;};
    inline std::vector<node_ptr> phi(){return phi_;};
    inline std::vector<node_ptr> phi0(){return phi_0_;};
    inline std::vector<double>& scores(){return scores_;};
    inline double* D(int ind){return &D_[ind * n_samp_];}

    void project_r(std::vector<double>& prop);

    void sis(std::vector<double>& prop);
};

#endif