Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
SOURCES=lib/cpf.cpp lib/grid.cpp lib/helper.cpp lib/rpf.cpp lib/trees.cpp randomPlantedForest.cpp RcppExports.cpp
SOURCES=lib/cpf.cpp lib/grid.cpp lib/helper.cpp lib/rpf.cpp lib/trees.cpp \
lib/rpf_purify_no_extrapolation.cpp lib/rpf_purify_no_extrapolation_grid.cpp \
lib/rpf_purify_anova.cpp lib/rpf_purify.cpp randomPlantedForest.cpp RcppExports.cpp

OBJECTS = $(SOURCES:.cpp=.o)

Expand Down
2 changes: 1 addition & 1 deletion src/include/helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace utils
if (n_entries != entries.size())
throw std::invalid_argument("Invalid matrix size.");
}
T &operator[](std::vector<int> &indices)
T &operator[](const std::vector<int>& indices)
{
if (indices.size() != dims.size())
throw std::invalid_argument("Invalid number of indices.");
Expand Down
11 changes: 10 additions & 1 deletion src/include/rpf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ class RandomPlantedForest
NumericMatrix predict_matrix(const NumericMatrix &X, const NumericVector components = {0});
NumericMatrix predict_vector(const NumericVector &X, const NumericVector components = {0});
void purify_1();
void purify_2();
void purify_anova();
void purify_22();
void purify_3();
void purify_3_new();
void purify_anova_and_marginalize();
void purify_no_extrapolation();
void purify_no_extrapolation_existing_grid();
void print();
void cross_validation(int n_sets = 4, IntegerVector splits = {5, 50}, NumericVector t_tries = {0.2, 0.5, 0.7, 0.9}, IntegerVector split_tries = {1, 2, 5, 10});
double MSE(const NumericMatrix &Y_predicted, const NumericMatrix &Y_true);
Expand Down Expand Up @@ -50,11 +55,15 @@ class RandomPlantedForest
std::vector<double> lower_bounds;
std::vector<TreeFamily> tree_families; /**< random planted forest containing result */
std::vector<double> predict_single(const std::vector<double> &X, std::set<int> component_index);
std::vector<double> predict_single_grid(const std::vector<double> &X, std::set<int> component_index);
std::vector<double> predict_single_no_grid(const std::vector<double> &X, std::set<int> component_index);
void L2_loss(Split &split);
virtual void fit();
virtual void create_tree_family(std::vector<Leaf> initial_leaves, size_t n);
virtual Split calcOptimalSplit(const std::vector<std::vector<double>> &Y, const std::vector<std::vector<double>> &X,
std::multimap<int, std::shared_ptr<DecisionTree>> &possible_splits, TreeFamily &curr_family);

std::vector<std::vector<double>> get_lim_list(const TreeFamily &curr_family);
};

#endif // RPF_HPP
Loading