Commit 7d215bee authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Update file docstrings for C++ header files and standardize path names

parent 63884b07
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_operator_nodes/sq/parameterized_square.hpp
* @brief Class describing the parameterized square operator
*
* This class represents the parameterized unary operator -> (alpha * A + a)^2
* @brief Defines a class for the parameterized version of square operator
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class represents the parameterized unary operator -> (A + a)^2
*/
#ifndef PARAM_SQ_NODE
#define PARAM_SQ_NODE
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_operator_nodes/square.hpp
* @brief Class describing the square operator
*
* This class represents the unary operator -> (A)^2
* @brief Defines a class for the square operator
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class represents the unary operator -> (A)^2
*/
#ifndef SQ_NODE
#define SQ_NODE
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_operator_nodes/sqrt/parameterized_square_root.hpp
* @brief Class describing the parameterized square root operator
*
* This class represents the parameterized unary operator -> sqrt(alpha * A + a)
* @brief Defines a class for the parameterized version of square root operator
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class represents the parameterized unary operator -> sqrt(alpha * A + a)
*/
#ifndef PARAM_SQRT_NODE
#define PARAM_SQRT_NODE
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_operator_nodes/square_root.hpp
* @brief Class describing the square root operator
*
* This class represents the unary operator -> (A)^(1/2)
* @brief Defines a class for the square root operator
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class represents the unary operator -> (A)^(1/2)
*/
#ifndef SQRT_NODE
#define SQRT_NODE
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_operator_nodes/sub/parameterized_subtract.hpp
* @brief Class describing the parameterized addition operator
*
* This class represents the parameterized unary operator -> A - (alpha * B + a)
* @briefDefines a class for the parameterized version of subtraction operator
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class represents the parameterized unary operator -> A - (alpha * B)
*/
#ifndef PARAM_SUB_NODE
#define PARAM_SUB_NODE
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_operator_nodes/subtract.hpp
* @brief Class describing the subtraction operator
*
* This class represents the binary operator -> A - B
* @brief Defines a class for the subtraction operator
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class represents the binary operator -> A - B
*/
#ifndef SUB_NODE
#define SUB_NODE
......
......@@ -11,12 +11,14 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/allowed_ops.hpp
* @brief Definition of the map that converts the string representation of an operation to the correct OperatorNode constructor
* @brief Defines the map that converts std::string descriptions of the operators into their generator functions
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
#ifndef ALLOWED_OP_NODES
#define ALLOWED_OP_NODES
......
......@@ -11,12 +11,14 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/operator_nodes/functions.hpp
* @brief Definition of all allowed functions OperatorNodes can have
* @brief Defines all functions used to calculate the data for the features
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
#ifndef OP_FUNCTIONS
#define OP_FUNCTIONS
......
......@@ -11,12 +11,14 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/utils.hpp
* @brief utility functions to build node_ptrs from strings
* @brief Defines utility functions for handling Features (Nodes)
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
#ifndef NODE_UTILS
#define NODE_UTILS
......
......@@ -11,15 +11,14 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/node/value_storage/node_value_containers.hpp
* @brief Centeral storage area for all descriptor matrix data
*
* This file contains definitions where all descriptor/feature data is stored permanently or in temporary storage arrays
* All Nodes's (except ModelNodes) value_ptr/test_value_ptrs point to data here.
* @brief Creates a central storage area for the feature's input data and the descriptor matrix
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
#ifndef NODE_VALUE_ARR
#define NODE_VALUE_ARR
......
......@@ -11,13 +11,14 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file feature_creation/unit/Unit.hpp
* @brief A representation of the units for each feature
*
* A dictionary representation of the unit for a features (key = unit, value = power)
* @brief Defines a class that represents Units of of the features
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* A dictionary representation of the unit for a features (key = unit, value = power)
*/
#ifndef UNIT
......
......@@ -13,31 +13,31 @@
// limitations under the License.
#include "inputs/InputParser.hpp"
InputParser::InputParser(pt::ptree IP, std::string fn, std::shared_ptr<MPI_Interface> comm) :
_opset(as_vector<std::string>(IP, "opset")),
_param_opset(as_vector<std::string>(IP, "param_opset")),
InputParser::InputParser(pt::ptree ip, std::string fn, std::shared_ptr<MPI_Interface> comm) :
_opset(as_vector<std::string>(ip, "opset")),
_param_opset(as_vector<std::string>(ip, "param_opset")),
_filename(fn),
_data_file(IP.get<std::string>("data_file", "data.csv")),
_prop_key(IP.get<std::string>("property_key", "prop")),
_task_key(IP.get<std::string>("task_key", "Task")),
_calc_type(IP.get<std::string>("calc_type", "regression")),
_leave_out_inds(as_vector<int>(IP, "leave_out_inds")),
_cross_cor_max(IP.get<double>("max_feat_cross_correlation", 1.0)),
_l_bound(IP.get<double>("min_abs_feat_val", 1e-50)),
_u_bound(IP.get<double>("max_abs_feat_val", 1e50)),
_n_dim(IP.get<int>("desc_dim")),
_n_sis_select(IP.get<int>("n_sis_select")),
_max_rung(IP.get<int>("max_rung")),
_n_rung_store(IP.get<int>("n_rung_store", _max_rung - 1)),
_n_rung_generate(IP.get<int>("n_rung_generate", 0)),
_data_file(ip.get<std::string>("data_file", "data.csv")),
_prop_key(ip.get<std::string>("property_key", "prop")),
_task_key(ip.get<std::string>("task_key", "Task")),
_calc_type(ip.get<std::string>("calc_type", "regression")),
_leave_out_inds(as_vector<int>(ip, "leave_out_inds")),
_cross_cor_max(ip.get<double>("max_feat_cross_correlation", 1.0)),
_l_bound(ip.get<double>("min_abs_feat_val", 1e-50)),
_u_bound(ip.get<double>("max_abs_feat_val", 1e50)),
_n_dim(ip.get<int>("desc_dim")),
_n_sis_select(ip.get<int>("n_sis_select")),
_max_rung(ip.get<int>("max_rung")),
_n_rung_store(ip.get<int>("n_rung_store", _max_rung - 1)),
_n_rung_generate(ip.get<int>("n_rung_generate", 0)),
_n_samp(0),
_n_residuals(IP.get<int>("n_residual", 1)),
_n_models_store(IP.get<int>("n_models_store", _n_residuals)),
_max_param_depth(IP.get<int>("max_feat_param_depth", _max_rung)),
_nlopt_seed(IP.get<int>("nlopt_seed", 42)),
_fix_intercept(IP.get<bool>("fix_intercept", false)),
_global_param_opt(IP.get<bool>("global_param_opt", false)),
_reparam_residual(IP.get<bool>("reparam_residual", false))
_n_residuals(ip.get<int>("n_residual", 1)),
_n_models_store(ip.get<int>("n_models_store", _n_residuals)),
_max_param_depth(ip.get<int>("max_feat_param_depth", _max_rung)),
_nlopt_seed(ip.get<int>("nlopt_seed", 42)),
_fix_intercept(ip.get<bool>("fix_intercept", false)),
_global_param_opt(ip.get<bool>("global_param_opt", false)),
_reparam_residual(ip.get<bool>("reparam_residual", false))
{
// Check if param ops are passed without being build with parameterized features
#ifndef PARAMETERIZE
......@@ -131,7 +131,7 @@ InputParser::InputParser(pt::ptree IP, std::string fn, std::shared_ptr<MPI_Inter
}
// Make the train-test split
double leave_out_frac = IP.get<double>("leave_out_frac", static_cast<double>(IP.get<int>("n_leave_out", 0)) / static_cast<double>(_n_samp) );
double leave_out_frac = ip.get<double>("leave_out_frac", static_cast<double>(ip.get<int>("n_leave_out", 0)) / static_cast<double>(_n_samp) );
if((_leave_out_inds.size() == 0) && leave_out_frac > 0.0)
{
// If only fraction given create a test set that pull equally from all tasks
......@@ -442,7 +442,7 @@ void InputParser::generate_feature_space(
#endif
}
void stripComments(std::string& filename)
void strip_comments(std::string& filename)
{
//Open input and output file
std::string newfn = "stripped_" + filename;
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file inputs/InputParser.hpp
* @brief Define the class that parses the input file
*
* This class parses and stores the parameters in the input file
* @brief Define the class that parses the input file
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class parses and stores the parameters in the input file
*/
#ifndef SISSO_INPUTS
#define SISSO_INPUTS
......@@ -92,7 +94,7 @@ public:
* @param fn filename for the input file
* @param comm MPI communicator for the calculation
*/
InputParser(pt::ptree IP, std::string fn, std::shared_ptr<MPI_Interface> comm);
InputParser(pt::ptree ip, std::string fn, std::shared_ptr<MPI_Interface> comm);
/**
* @brief The generated FeatureSpace
......@@ -121,7 +123,7 @@ public:
*
* @param filename The filename of the file to strip
*/
void stripComments(std::string& filename);
void strip_comments(std::string& filename);
/**
* @brief boost json to std::vector<T>
......
......@@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file loss_function/LossFunction.hpp
* @brief A class used to calculate the projection score and l0-regularization error
* @brief Defines a base class used to calculate the projection score and l0-regularization objective function
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
......
......@@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file loss_function/LossFunctionConvexHull.hpp
* @brief A class used to calculate the projection score and l0-regularization error
* @brief Defines the class that uses a convex hull projection operator and a convex hull based objective function
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
......
......@@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file loss_function/LossFunctionLogPearsonRMSE.hpp
* @brief A class used to calculate the projection score and l0-regularization error
* @brief Defines the class that uses a logarithmic Pearson correlation projection operator and a logarithmic least-squares regression objective function
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
......
......@@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file loss_function/LossFunctionPearsonRMSE.hpp
* @brief A class used to calculate the projection score and l0-regularization error
* @brief Defines the class that uses a Pearson correlation projection operator and a least-squares regression objective function
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
......
......@@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file loss_function/utils.hpp
* @brief utilities for generating loss_functions
* @brief Defines utilities for generating and copying LossFunctions
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*/
......
......@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "inputs/InputParser.hpp"
#include "descriptor_identifier/SISSO_DI/SISSOLogRegressor.hpp"
#include "descriptor_identifier/SISSO_DI/SISSOClassifier.hpp"
#include "descriptor_identifier/solver/SISSOLogRegressor.hpp"
#include "descriptor_identifier/solver/SISSOClassifier.hpp"
int main(int argc, char const *argv[])
{
......@@ -36,7 +36,7 @@ int main(int argc, char const *argv[])
if(mpi_setup::comm->rank() == 0)
{
stripComments(filename);
strip_comments(filename);
}
else
{
......@@ -49,7 +49,7 @@ int main(int argc, char const *argv[])
boost::property_tree::json_parser::read_json(filename,propTree);
double start = omp_get_wtime();
InputParser IP(propTree, filename, mpi_setup::comm);
InputParser ip(propTree, filename, mpi_setup::comm);
if(mpi_setup::comm->rank() == 0)
{
boost::filesystem::remove(filename);
......@@ -62,19 +62,19 @@ int main(int argc, char const *argv[])
}
node_value_arrs::initialize_d_matrix_arr();
if(IP._calc_type.compare("regression") == 0)
if(ip._calc_type.compare("regression") == 0)
{
SISSORegressor sisso(IP._feat_space, IP._prop_label, IP._prop_unit, IP._prop_train, IP._prop_test, IP._task_sizes_train, IP._task_sizes_test, IP._leave_out_inds, IP._n_dim, IP._n_residuals, IP._n_models_store, IP._fix_intercept);
SISSORegressor sisso(ip._feat_space, ip._prop_label, ip._prop_unit, ip._prop_train, ip._prop_test, ip._task_sizes_train, ip._task_sizes_test, ip._leave_out_inds, ip._n_dim, ip._n_residuals, ip._n_models_store, ip._fix_intercept);
sisso.fit();
if(mpi_setup::comm->rank() == 0)
{
for(int ii = 0; ii < sisso.models().size(); ++ii)
{
std::cout << "Train RMSE: " << sisso.models()[ii][0].rmse() << " " << IP._prop_unit;
if(IP._prop_test.size() > 0)
std::cout << "Train RMSE: " << sisso.models()[ii][0].rmse() << " " << ip._prop_unit;
if(ip._prop_test.size() > 0)
{
std::cout << "; Test RMSE: " << sisso.models()[ii][0].test_rmse() << " " << IP._prop_unit << std::endl;
std::cout << "; Test RMSE: " << sisso.models()[ii][0].test_rmse() << " " << ip._prop_unit << std::endl;
}
else
{
......@@ -84,9 +84,9 @@ int main(int argc, char const *argv[])
}
}
}
else if(IP._calc_type.compare("log_regression") == 0)
else if(ip._calc_type.compare("log_regression") == 0)
{
SISSOLogRegressor sisso(IP._feat_space, IP._prop_label, IP._prop_unit, IP._prop_train, IP._prop_test, IP._task_sizes_train, IP._task_sizes_test, IP._leave_out_inds, IP._n_dim, IP._n_residuals, IP._n_models_store, IP._fix_intercept);
SISSOLogRegressor sisso(ip._feat_space, ip._prop_label, ip._prop_unit, ip._prop_train, ip._prop_test, ip._task_sizes_train, ip._task_sizes_test, ip._leave_out_inds, ip._n_dim, ip._n_residuals, ip._n_models_store, ip._fix_intercept);
sisso.fit();
if(mpi_setup::comm->rank() == 0)
......@@ -94,7 +94,7 @@ int main(int argc, char const *argv[])
for(int ii = 0; ii < sisso.models().size(); ++ii)
{
std::cout << "Train RMSE: " << sisso.models()[ii][0].rmse();
if(IP._prop_test.size() > 0)
if(ip._prop_test.size() > 0)
{
std::cout << "; Test RMSE: " << sisso.models()[ii][0].test_rmse() << std::endl;
}
......@@ -106,9 +106,9 @@ int main(int argc, char const *argv[])
}
}
}
else if(IP._calc_type.compare("classification") == 0)
else if(ip._calc_type.compare("classification") == 0)
{
SISSOClassifier sisso(IP._feat_space, IP._prop_label, IP._prop_unit, IP._prop_train, IP._prop_test, IP._task_sizes_train, IP._task_sizes_test, IP._leave_out_inds, IP._n_dim, IP._n_residuals, IP._n_models_store);
SISSOClassifier sisso(ip._feat_space, ip._prop_label, ip._prop_unit, ip._prop_train, ip._prop_test, ip._task_sizes_train, ip._task_sizes_test, ip._leave_out_inds, ip._n_dim, ip._n_residuals, ip._n_models_store);
sisso.fit();
if(mpi_setup::comm->rank() == 0)
......@@ -116,7 +116,7 @@ int main(int argc, char const *argv[])
for(int ii = 0; ii < sisso.models().size(); ++ii)
{
std::cout << "Percent of training data misclassified: " << sisso.models()[ii][0].percent_train_error() << "%";
if(IP._prop_test.size() > 0)
if(ip._prop_test.size() > 0)
{
std::cout << "; Percent of test data misclassified: " << sisso.models()[ii][0].percent_test_error() << "%" << std::endl;
}
......
......@@ -11,14 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file mpi_interface/MPI_Interface.hpp
* @brief Define MPI interface for the calculation
*
* This class modifies the boost mpi::communicator for easier communication
* @brief Define MPI interface for the calculations
*
* @author Thomas A. R. Purcell (tpurcell)
* @author Thomas A. R. Purcell (tpurcell90)
* @bug No known bugs.
*
* This class modifies the boost mpi::communicator for easier communication
*/
#ifndef SISSO_MPI_INTERFACE
#define SISSO_MPI_INTERFACE
......@@ -50,7 +52,7 @@ public:
*
* @return A unique tag to send information between two processes
*/
int cantorTagGen(const unsigned int procSend, const unsigned int procRecv, const unsigned int maxOffest, const unsigned int offest)
int cantor_tag_gen(const unsigned int procSend, const unsigned int procRecv, const unsigned int maxOffest, const unsigned int offest)
{
return (int((procSend + procRecv) * (procSend + procSend +1) / 2) + procRecv) * maxOffest + offest;
}
......
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