Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
cpp_sisso
Commits
77c64893
Commit
77c64893
authored
Aug 08, 2021
by
Thomas Purcell
Browse files
Update python library DocStrings
Set up for the python API
parent
7cec81f0
Changes
55
Hide whitespace changes
Inline
Side-by-side
src/descriptor_identifier/Model/Model.hpp
View file @
77c64893
...
...
@@ -304,6 +304,7 @@ public:
*/
virtual
std
::
string
matlab_expr
()
const
=
0
;
// DocString: model_to_matlab
/**
* @brief Convert the model into a Matlab function
*
...
...
@@ -444,6 +445,7 @@ public:
*/
inline
py
::
list
leave_out_inds
(){
return
python_conv_utils
::
to_list
<
int
>
(
_leave_out_inds
);}
// DocString: model_eval_arr
/**
* @brief Evaluate the model for a new point
*
...
...
@@ -452,6 +454,7 @@ public:
*/
inline
double
eval_py
(
np
::
ndarray
x_in
)
const
{
return
eval
(
python_conv_utils
::
from_ndarray
<
double
>
(
x_in
));}
// DocString: model_eval_list
/**
* @brief Evaluate the model for a new point
*
...
...
@@ -460,14 +463,16 @@ public:
*/
inline
double
eval_py
(
py
::
list
x_in
)
const
{
return
eval
(
python_conv_utils
::
from_list
<
double
>
(
x_in
));}
// DocString: model_eval_dict
/**
* @brief Evaluate the model for a new point
*
* @param x_in_dct Dictionary describing the new point ("feature expr": value)
* @param x_in_dct Dictionary describing the new point (
\
"feature expr
\
": value)
* @return The prediction of the model for a given data point
*/
inline
double
eval_py
(
py
::
dict
x_in
)
const
{
return
eval
(
python_conv_utils
::
from_dict
<
std
::
string
,
double
>
(
x_in
));}
// DocString: model_eval_many_arr
/**
* @brief Evaluate the model for a set of new points
*
...
...
@@ -476,6 +481,7 @@ public:
*/
np
::
ndarray
eval_many_py
(
np
::
ndarray
x_in
)
const
;
// DocString: model_eval_many_dict
/**
* @brief Evaluate the model for a set of new points
*
...
...
src/descriptor_identifier/Model/ModelClassifier.hpp
View file @
77c64893
...
...
@@ -53,7 +53,7 @@ public:
const
std
::
vector
<
int
>
leave_out_inds
);
// DocString: model_class_init_
s
tr
// DocString: model_class_init_tr
ain
/**
* @brief Construct a model from a training output file
* @details Reads in all of the data from the output file and recreates the model object
...
...
@@ -62,7 +62,7 @@ public:
*/
ModelClassifier
(
const
std
::
string
train_file
);
// DocString: model_class_init_
str_str
// DocString: model_class_init_
test_train
/**
* @brief Construct a model from a training and testing output file
* @details Reads in all of the data from the output files and recreates the model object
...
...
@@ -243,6 +243,7 @@ public:
}
#ifdef PY_BINDINGS
// DocString: model_class_init_new_coefs_list
/**
* @brief Construct a new Model with updated coefficient
* @details Copy a model but update its coefficients
...
...
@@ -254,6 +255,7 @@ public:
*/
ModelClassifier
(
const
ModelClassifier
&
o
,
py
::
list
new_coefs
,
np
::
ndarray
prop_train_est
,
np
::
ndarray
prop_test_est
);
// DocString: model_class_init_new_coefs_arr
/**
* @brief Construct a new Model with updated coefficient
* @details Copy a model but update its coefficients
...
...
src/descriptor_identifier/Model/ModelLogRegressor.hpp
View file @
77c64893
...
...
@@ -52,7 +52,7 @@ public:
const
std
::
vector
<
int
>
leave_out_inds
);
// DocString: model_log_reg_init_
s
tr
// DocString: model_log_reg_init_tr
ain
/**
* @brief Construct a model from a training output file
* @details Reads in all of the data from the output file and recreates the model object
...
...
@@ -61,7 +61,7 @@ public:
*/
ModelLogRegressor
(
std
::
string
train_file
);
// DocString: model_log_reg_init_
str_str
// DocString: model_log_reg_init_
test_train
/**
* @brief Construct a model from a training and testing output file
* @details Reads in all of the data from the output files and recreates the model object
...
...
src/descriptor_identifier/Model/ModelRegressor.hpp
View file @
77c64893
...
...
@@ -51,7 +51,7 @@ public:
const
std
::
vector
<
int
>
leave_out_inds
);
// DocString: model_reg_init_
s
tr
// DocString: model_reg_init_tr
ain
/**
* @brief Construct a model from a training output file
* @details Reads in all of the data from the output file and recreates the model object
...
...
@@ -60,7 +60,7 @@ public:
*/
ModelRegressor
(
const
std
::
string
train_file
);
// DocString: model_reg_init_
str_str
// DocString: model_reg_init_
test_train
/**
* @brief Construct a model from a training and testing output file
* @details Reads in all of the data from the output files and recreates the model object
...
...
src/descriptor_identifier/SISSO_DI/SISSOClassifier.hpp
View file @
77c64893
...
...
@@ -119,6 +119,7 @@ public:
// Python interface functions
#ifdef PY_BINDINGS
// DocString: sisso_class_init_arr
/**
* @brief Constructor for the Classifier that takes in python objects (cpp definition in <python/descriptor_identifier/SISSOClassifier.cpp)
*
...
...
src/descriptor_identifier/SISSO_DI/SISSOLogRegressor.hpp
View file @
77c64893
...
...
@@ -87,6 +87,7 @@ public:
// Python interface functions
#ifdef PY_BINDINGS
// DocString: sisso_log_reg_init_arr
/**
* @brief Constructor for the Regressor that takes in python objects (cpp definition in <python/descriptor_identifier/SISSOLogRegressor.cpp)
*
...
...
src/descriptor_identifier/SISSO_DI/SISSORegressor.hpp
View file @
77c64893
...
...
@@ -94,6 +94,8 @@ public:
// Python interface functions
#ifdef PY_BINDINGS
// DocString: sisso_reg_init_arr
/**
* @brief Constructor for the Regressor that takes in python objects (cpp definition in <python/descriptor_identifier/SISSORegressor.cpp)
*
...
...
src/feature_creation/feature_space/FeatureSpace.hpp
View file @
77c64893
...
...
@@ -389,7 +389,6 @@ public:
* @param allowed_ops list of allowed operators
* @param allowed_param_ops dictionary of the parameterizable operators and their associated free parameters
* @param prop The property to be learned (training data)
* @param task_sizes The number of samples per task
* @param project_type The projection operator to use
* @param max_phi highest rung value for the calculation
* @param n_sis_select number of features to select during each SIS step
...
...
@@ -406,7 +405,6 @@ public:
py
::
list
allowed_ops
,
py
::
list
allowed_param_ops
,
py
::
list
prop
,
py
::
list
task_sizes
,
std
::
string
project_type
=
"regression"
,
int
max_phi
=
1
,
int
n_sis_select
=
1
,
...
...
@@ -426,7 +424,6 @@ public:
* @param phi_0 The initial set of features to combine
* @param allowed_ops list of allowed operators
* @param prop The property to be learned (training data)
* @param task_sizes The number of samples per task
* @param project_type The projection operator to use
* @param max_phi highest rung value for the calculation
* @param n_sis_select number of features to select during each SIS step
...
...
@@ -442,7 +439,6 @@ public:
py
::
list
allowed_ops
,
py
::
list
allowed_param_ops
,
np
::
ndarray
prop
,
py
::
list
task_sizes
,
std
::
string
project_type
=
"regression"
,
int
max_phi
=
1
,
int
n_sis_select
=
1
,
...
...
@@ -462,7 +458,6 @@ public:
* @param phi_0 The initial set of features to combine
* @param allowed_ops list of allowed operators
* @param prop The property to be learned (training data)
* @param task_sizes The number of samples per task
* @param project_type The projection operator to use
* @param max_phi highest rung value for the calculation
* @param n_sis_select number of features to select during each SIS step
...
...
@@ -476,7 +471,6 @@ public:
py
::
list
phi_0
,
py
::
list
allowed_ops
,
py
::
list
prop
,
py
::
list
task_sizes
,
std
::
string
project_type
=
"regression"
,
int
max_phi
=
1
,
int
n_sis_select
=
1
,
...
...
@@ -494,7 +488,6 @@ public:
* @param phi_0 The initial set of features to combine
* @param allowed_ops list of allowed operators
* @param prop The property to be learned (training data)
* @param task_sizes The number of samples per task
* @param project_type The projection operator to use
* @param max_phi highest rung value for the calculation
* @param n_sis_select number of features to select during each SIS step
...
...
@@ -508,7 +501,6 @@ public:
py
::
list
phi_0
,
py
::
list
allowed_ops
,
np
::
ndarray
prop
,
py
::
list
task_sizes
,
std
::
string
project_type
=
"regression"
,
int
max_phi
=
1
,
int
n_sis_select
=
1
,
...
...
src/feature_creation/node/FeatureNode.hpp
View file @
77c64893
...
...
@@ -74,6 +74,7 @@ public:
const
bool
set_val
=
true
);
#ifdef PY_BINDINGS
// DocString: feat_node_init_list
/**
* @brief Constructs a feature node using numpy arrays (cpp definition in "python/feature_creation/FeatureNode.cpp)
*
...
...
@@ -85,6 +86,7 @@ public:
*/
FeatureNode
(
unsigned
long
int
feat_ind
,
std
::
string
expr
,
np
::
ndarray
value
,
np
::
ndarray
test_value
,
Unit
unit
);
// DocString: feat_node_init_arr
/**
* @brief Constructs a feature node using Python lists (cpp definition in "python/feature_creation/FeatureNode.cpp)
*
...
...
@@ -143,12 +145,14 @@ public:
*/
void
reset_feats
(
std
::
vector
<
node_ptr
>&
phi
){};
// DocString: feat_node_x_in_expr
/**
* @brief Get the list of feature expressions
* @return vector storing the expressions for all primary features that show up in feature in the order they appear in the postfix notation
*/
virtual
inline
std
::
vector
<
std
::
string
>
get_x_in_expr_list
()
const
{
return
std
::
vector
<
std
::
string
>
(
1
,
_expr
);}
// DocString: feat_node_n_leaves
/**
* @brief return the number of leaves in the feature
*
...
...
src/feature_creation/node/ModelNode.hpp
View file @
77c64893
...
...
@@ -65,6 +65,7 @@ public:
*/
ModelNode
();
// DocString: model_node_init
/**
* @brief Constructs a feature node
*
...
...
@@ -91,6 +92,7 @@ public:
const
Unit
unit
);
// DocString: model_node_init_node_ptr
/**
* @brief Copy constructor from general node_ptr
*
...
...
@@ -160,7 +162,7 @@ public:
/**
* @brief Evaluate the model for a new point
*
* @param x_in_dct Dictionary describing the new point ("feature expr": value)
* @param x_in_dct Dictionary describing the new point (
\
"feature expr
\
": value)
* @return The prediction of the model for a given data point
*/
double
eval
(
std
::
map
<
std
::
string
,
double
>
x_in_dct
);
...
...
@@ -189,12 +191,14 @@ public:
*/
std
::
vector
<
double
>
eval
(
std
::
map
<
std
::
string
,
std
::
vector
<
double
>>
x_in_dct
);
// DocString: model_node_x_in_expr
/**
* @brief get the list of feature expressions for each of the leaves
* @return Vector containing the expression for each leaf in the binary expression tree
*/
inline
std
::
vector
<
std
::
string
>
get_x_in_expr_list
()
const
{
return
_x_in_expr_list
;}
// DocString: model_node_n_leaves
/**
* @brief return the number of leaves in the feature
*
...
...
@@ -372,6 +376,7 @@ public:
void
update_div_mult_leaves
(
std
::
map
<
std
::
string
,
double
>&
div_mult_leaves
,
const
double
fact
,
double
&
expected_abs_tot
)
const
;
#ifdef PY_BINDINGS
// DocString: model_node_eval_arr
/**
* @brief Evaluate the model for a new point
*
...
...
@@ -380,6 +385,7 @@ public:
*/
inline
double
eval_py
(
np
::
ndarray
x_in
){
return
eval
(
python_conv_utils
::
from_ndarray
<
double
>
(
x_in
));}
// DocString: model_node_eval_list
/**
* @brief Evaluate the model for a new point
*
...
...
@@ -388,14 +394,16 @@ public:
*/
inline
double
eval_py
(
py
::
list
x_in
){
return
eval
(
python_conv_utils
::
from_list
<
double
>
(
x_in
));}
// DocString: model_node_eval_dict
/**
* @brief Evaluate the model for a new point
*
* @param x_in_dct Dictionary describing the new point ("feature expr": value)
* @param x_in_dct Dictionary describing the new point (
\
"feature expr
\
": value)
* @return The prediction of the model for a given data point
*/
inline
double
eval_py
(
py
::
dict
x_in
){
return
eval
(
python_conv_utils
::
from_dict
<
std
::
string
,
double
>
(
x_in
));}
// DocString: model_node_eval_many_arr
/**
* @brief Evaluate the model for a set of new points
*
...
...
@@ -404,6 +412,7 @@ public:
*/
np
::
ndarray
eval_many_py
(
np
::
ndarray
x_in
);
// DocString: model_node_eval_many_dict
/**
* @brief Evaluate the model for a set of new points
*
...
...
src/feature_creation/node/Node.hpp
View file @
77c64893
...
...
@@ -20,7 +20,6 @@
#include
"utils/math_funcs.hpp"
#ifdef PY_BINDINGS
#include
"python/conversion_utils.hpp"
namespace
py
=
boost
::
python
;
namespace
np
=
boost
::
python
::
numpy
;
#endif
...
...
@@ -125,12 +124,14 @@ public:
*/
virtual
void
reset_feats
(
std
::
vector
<
std
::
shared_ptr
<
Node
>>&
phi
)
=
0
;
// DocString: node_x_in_expr
/**
* @brief Get the list of feature expressions
* @return vector storing the expressions for all primary features that show up in feature in the order they appear in the postfix notation
*/
virtual
std
::
vector
<
std
::
string
>
get_x_in_expr_list
()
const
=
0
;
// DocString: node_n_leaves
/**
* @brief return the number of leaves in the feature
*
...
...
src/feature_creation/node/operator_nodes/OperatorNode.hpp
View file @
77c64893
...
...
@@ -146,9 +146,9 @@ public:
return
x_in_expr
;
}
// DocString: op_node_n_leaves
/**
* @brief return the number of leaves in the feature
* @details [long description]
*
* @param cur_n_leaves The current number of primary features that are inside the feature
* @return total number of leaves of the binary expression tree
...
...
@@ -184,24 +184,12 @@ public:
);
}
// DocString: op_node_expr
/**
* @brief Get the expression for the overall feature (From root node down)
*/
virtual
std
::
string
expr
()
const
=
0
;
// DocString: node_latex_expr
/**
* @brief Get the latexified expression for the overall feature (From root node down)
*/
virtual
std
::
string
get_latex_expr
()
const
=
0
;
// DocString: op_node_unit
/**
* @brief Get the unit of the feature (combine the units of _feats)
*/
virtual
Unit
unit
()
const
=
0
;
/**
* @brief Get the training data of the feature
*/
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/abs/absolute_value.hpp
View file @
77c64893
...
...
@@ -47,6 +47,7 @@ public:
*/
AbsNode
(
const
node_ptr
feat
,
const
unsigned
long
int
feat_ind
);
// DocString: abs_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the feature to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/abs/parameterized_absolute_value.hpp
View file @
77c64893
...
...
@@ -79,6 +79,7 @@ public:
*/
AbsParamNode
(
const
node_ptr
feat
,
const
unsigned
long
int
feat_ind
,
std
::
shared_ptr
<
NLOptimizer
>
optimizer
);
// DocString: abs_param_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the feature to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/abs_diff/absolute_difference.hpp
View file @
77c64893
...
...
@@ -51,6 +51,7 @@ public:
*/
AbsDiffNode
(
const
node_ptr
feat_1
,
const
node_ptr
feat_2
,
const
unsigned
long
int
feat_ind
);
// DocString: abs_diff_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the features to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/abs_diff/parameterized_absolute_difference.hpp
View file @
77c64893
...
...
@@ -80,6 +80,7 @@ public:
*/
AbsDiffParamNode
(
const
node_ptr
feat_1
,
const
node_ptr
feat_2
,
const
unsigned
long
int
feat_ind
,
std
::
shared_ptr
<
NLOptimizer
>
optimizer
);
// DocString: abs_diff_param_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the feature to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/add/add.hpp
View file @
77c64893
...
...
@@ -48,6 +48,7 @@ public:
*/
AddNode
(
const
node_ptr
feat_1
,
const
node_ptr
feat_2
,
const
unsigned
long
int
feat_ind
);
// DocString: add_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the features to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/add/parameterized_add.hpp
View file @
77c64893
...
...
@@ -82,6 +82,7 @@ public:
*/
AddParamNode
(
const
node_ptr
feat_1
,
const
node_ptr
feat_2
,
const
unsigned
long
int
feat_ind
,
std
::
shared_ptr
<
NLOptimizer
>
optimizer
);
// DocString: add_param_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the feature to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/cb/cube.hpp
View file @
77c64893
...
...
@@ -47,6 +47,7 @@ public:
*/
CbNode
(
const
node_ptr
feat
,
const
unsigned
long
int
feat_ind
);
// DocString: cb_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the feature to operate on
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/cb/parameterized_cube.hpp
View file @
77c64893
...
...
@@ -79,6 +79,7 @@ public:
*/
CbParamNode
(
const
node_ptr
feat
,
const
unsigned
long
int
feat_ind
,
std
::
shared_ptr
<
NLOptimizer
>
optimizer
);
// DocString: cb_param_node_init
/**
* @brief Constructor
* @details Constructs the Node from node pointer of the feature to operate on
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment