Commit a5780cc2 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Fix bugs when -DBUILD_PARAMS=OFF

Complining should work now
parent 5443e06d
......@@ -63,9 +63,6 @@ BOOST_CLASS_EXPORT_GUID(CosParamNode, "CosParamNode")
FeatureSpace::FeatureSpace(InputParser inputs):
_phi_0(inputs.phi_0_ptrs()),
_phi(inputs.phi_0_ptrs()),
_end_no_params(1, inputs.phi_0().size()),
_start_rung_reparam(1, 0),
_allowed_param_ops(inputs.allowed_param_ops_copy()),
_allowed_ops(inputs.allowed_ops_copy()),
_prop_train(inputs.prop_train_copy()),
_scores( inputs.phi_0().size()),
......@@ -83,11 +80,16 @@ FeatureSpace::FeatureSpace(InputParser inputs):
_max_rung(inputs.max_rung()),
_n_sis_select(inputs.n_sis_select()),
_n_samp_train(inputs.n_samp_train()),
_n_rung_generate(inputs.n_rung_generate()),
_max_param_depth(inputs.max_param_depth()),
_reparam_residual(inputs.reparam_residual())
_n_rung_generate(inputs.n_rung_generate())
{
#ifdef PARAMETERIZE
_end_no_params.resize(1, inputs.phi_0().size()),
_start_rung_reparam.resize(1, 0),
_allowed_param_ops.resize(inputs.allowed_param_ops_copy()),
_max_param_depth = inputs.max_param_depth();
_reparam_residual = inputs.reparam_residual();
if(_max_param_depth == -1)
{
_max_param_depth = _max_rung;
......@@ -97,6 +99,11 @@ FeatureSpace::FeatureSpace(InputParser inputs):
throw std::logic_error("Invalid parameter depth.");
}
nlopt_wrapper::MAX_PARAM_DEPTH = _max_param_depth;
#else
if(inputs.allowed_param_ops_copy().size() > 0)
{
throw std::logic_error("To use parameterize features rebuild with -DBUILD_PARAMS=ON.");
}
#endif
for(int ff = _phi.size() - 1; ff >= 0; --ff)
......
......@@ -93,9 +93,10 @@ class FeatureSpace
const int _n_samp_train; //!< Number of samples in the training set
const int _n_rung_generate; //!< Either 0 or 1, and is the number of rungs to generate on the fly during SIS
#ifdef PARAMETERIZE
int _max_param_depth; //!< The maximum depth in the binary expression tree to set non-linear optimization
const bool _reparam_residual; //!< If True then reparameterize features using the residuals of each model
bool _reparam_residual; //!< If True then reparameterize features using the residuals of each model
#endif
public:
// DocString: feat_space_init
......
......@@ -38,8 +38,9 @@
#include "feature_creation/node/FeatureNode.hpp"
#include "mpi_interface/MPI_Interface.hpp"
#if PARAMETERIZE
#include "nl_opt/NLOptWrapper.hpp"
#endif
#ifdef PY_BINDINGS
#include "python/py_binding_cpp_def/conversion_utils.hpp"
......
This diff is collapsed.
This diff is collapsed.
......@@ -342,9 +342,9 @@ namespace sisso
py::class_<OperatorNodeWrap<N>, py::bases<Node>, boost::noncopyable>("OperatorNode", py::no_init)
.def("is_nan", &OperatorNode<N>::is_nan, (py::arg("self")), "@DocString_op_node_is_nan@")
.def("is_const", &OperatorNode<N>::is_const, (py::arg("self")), "@DocString_op_node_is_const@")
.def("feat", &OperatorNode<N>::feat, (py::arg("self"), py::arg("ind")), "@DocString_op_node_feat@")
.add_property("n_leaves", &OperatorNode<N>::n_leaves, "@DocString_op_node_n_leaves@")
.add_property("n_feats", &OperatorNode<N>::n_feats, "@DocString_op_node_n_feats@")
.add_property("feat", &OperatorNode<N>::feat, (py::arg("ind")), "@DocString_op_node_feat@")
;
}
#else
......
......@@ -46,10 +46,12 @@ FeatureSpace::FeatureSpace(
_n_feat(py::len(phi_0)),
_n_rung_store(0),
_n_rung_generate(0),
_n_samp_train(_phi_0[0]->n_samp()),
_max_param_depth(-1),
_reparam_residual(false)
_n_samp_train(_phi_0[0]->n_samp())
{
#ifdef PARAMETERIZE
_max_param_depth = -1;
_reparam_residual = false;
#endif
comp_feats::set_is_valid_fxn(project_type, _cross_cor_max, _n_samp_train, _is_valid, _is_valid_feat_list);
mpi_reduce_op::set_op(_project_type, _cross_cor_max, _n_sis_select);
......@@ -194,10 +196,12 @@ FeatureSpace::FeatureSpace(
_n_feat(py::len(phi_0)),
_n_rung_store(0),
_n_rung_generate(0),
_n_samp_train(_phi_0[0]->n_samp()),
_max_param_depth(-1),
_reparam_residual(false)
_n_samp_train(_phi_0[0]->n_samp())
{
#ifdef PARAMETERIZE
_max_param_depth = -1;
_reparam_residual = false;
#endif
comp_feats::set_is_valid_fxn(project_type, _cross_cor_max, _n_samp_train, _is_valid, _is_valid_feat_list);
mpi_reduce_op::set_op(_project_type, _cross_cor_max, _n_sis_select);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment