Merge pull request #1190 from sbrodehl/dev-cmake-project

cmake project
This commit is contained in:
Ryan Curtin
2018-01-18 09:33:20 -08:00
committed by GitHub
31 changed files with 81 additions and 242 deletions
+1
View File
@@ -23,6 +23,7 @@ set(SOURCES
print_doc_functions_impl.hpp
print_help.hpp
print_help.cpp
set_param.hpp
string_type_param.hpp
string_type_param_impl.hpp
)
+1
View File
@@ -2,6 +2,7 @@
# Anything not in this list will not be compiled into mlpack.
set(SOURCES
test_option.hpp
ignore_check.hpp
get_param.hpp
get_printable_param.hpp
get_printable_param_impl.hpp
@@ -3,6 +3,7 @@
set(SOURCES
arma_extend.hpp
fn_ccov.hpp
fn_inplace_reshape.hpp
glue_ccov_meat.hpp
glue_ccov_proto.hpp
hdf5_misc.hpp
+1
View File
@@ -19,6 +19,7 @@ set(SOURCES
normalize_labels_impl.hpp
save.hpp
save_impl.hpp
serialization_template_version.hpp
split_data.hpp
imputer.hpp
binarize.hpp
@@ -3,6 +3,7 @@
set(SOURCES
increment_policy.hpp
missing_policy.hpp
datatype.hpp
)
# Add directory name to sources.
+2
View File
@@ -7,6 +7,7 @@ set(SOURCES
lin_alg.hpp
lin_alg_impl.hpp
lin_alg.cpp
make_alias.hpp
random.hpp
random.cpp
random_basis.hpp
@@ -14,6 +15,7 @@ set(SOURCES
range.hpp
range_impl.hpp
round.hpp
shuffle_data.hpp
)
# add directory name to sources
@@ -1,13 +0,0 @@
/**
* @file range_serialization.cpp
* @author Ryan Curtin
*
* Instantiation of Serialize() operators for math::Range.
*/
#include <limits>
#include "range_serialization.hpp"
using namespace mlpack;
using namespace mlpack::math;
MLPACK_SERIALIZATION_INSTANTIATE(Range);
@@ -1,28 +0,0 @@
/**
* @file range_serialization.hpp
* @author Ryan Curtin
*
* Implementations of Serialize() for math::Range.
*/
#ifndef MLPACK_CORE_MATH_RANGE_SERIALIZATION_HPP
#define MLPACK_CORE_MATH_RANGE_SERIALIZATION_HPP
#include "range.hpp"
#include <mlpack/core/data/serialization.hpp>
namespace mlpack {
namespace math {
//! Serialize the range.
template<typename T>
template<typename Archive>
void RangeType<T>::Serialize(Archive& ar, const unsigned int /* version */)
{
ar & data::CreateNVP(hi, "hi");
ar & data::CreateNVP(lo, "lo");
}
} // namespace math
} // namespace mlpack
#endif
@@ -12,10 +12,13 @@ set(DIRS
lbfgs
line_search
proximal
parallel_sgd
rmsprop
sa
scd
sdp
sgd
sgdr
smorms3
spalera_sgd
)
@@ -1,4 +1,6 @@
set(SOURCES
decay_policies/constant_step.hpp
decay_policies/exponential_backoff.hpp
parallel_sgd.hpp
parallel_sgd_impl.hpp
sparse_test_function.hpp
@@ -1,11 +0,0 @@
set(SOURCES
constant_step.hpp
exponential_backoff.hpp
)
set(DIR_SRCS)
foreach(file ${SOURCES})
set(DIR_SRCS ${DIR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
endforeach()
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
@@ -1,4 +1,7 @@
set(SOURCES
descent_policies/cyclic_descent.hpp
descent_policies/greedy_descent.hpp
descent_policies/random_descent.hpp
scd.hpp
scd_impl.hpp
)
@@ -1,11 +0,0 @@
set(SOURCES
vanilla_update.hpp
momentum_update.hpp
)
set(DIR_SRCS)
foreach(file ${SOURCES})
set(DIR_SRCS ${DIR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
endforeach()
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
+3
View File
@@ -33,6 +33,7 @@ set(SOURCES
cellbound_impl.hpp
cosine_tree/cosine_tree.hpp
cosine_tree/cosine_tree.cpp
cover_tree.hpp
cover_tree/cover_tree.hpp
cover_tree/cover_tree_impl.hpp
cover_tree/first_point_is_root.hpp
@@ -74,6 +75,8 @@ set(SOURCES
rectangle_tree/r_star_tree_descent_heuristic_impl.hpp
rectangle_tree/r_star_tree_split.hpp
rectangle_tree/r_star_tree_split_impl.hpp
rectangle_tree/traits.hpp
rectangle_tree/typedef.hpp
rectangle_tree/x_tree_split.hpp
rectangle_tree/x_tree_split_impl.hpp
rectangle_tree/x_tree_auxiliary_information.hpp
+2
View File
@@ -1,6 +1,7 @@
# Define the files we need to compile.
# Anything not in this list will not be compiled into mlpack.
set(SOURCES
arma_traits.hpp
arma_config.hpp
arma_config_check.hpp
backtrace.hpp
@@ -17,6 +18,7 @@ set(SOURCES
log.cpp
mlpack_main.hpp
nulloutstream.hpp
param.hpp
param_checks.hpp
param_checks_impl.hpp
param_data.hpp
-127
View File
@@ -1,127 +0,0 @@
/**
* @file param_data_impl.hpp
* @author Ryan Curtin
*
* Implementation of utility functions for ParamData structures.
*/
#ifndef MLPACK_CORE_UTIL_PARAM_DATA_IMPL_HPP
#define MLPACK_CORE_UTIL_PARAM_DATA_IMPL_HPP
#include "param_data.hpp"
#include <mlpack/core/data/load.hpp>
namespace mlpack {
namespace util {
//! This overload is called when nothing special needs to happen to the name of
//! the parameter.
template<typename T>
std::string MapParameterName(
const std::string& identifier,
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
const typename boost::disable_if<std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
{
return identifier;
}
//! This is called for matrices, DatasetInfo objects, and serializable objects,
//! which have a different boost name.
template<typename T>
std::string MapParameterName(
const std::string& identifier,
const typename boost::enable_if_c<
arma::is_arma_type<T>::value ||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
arma::mat>>::value ||
data::HasSerialize<T>::value>::type* /* junk */)
{
return identifier + "_file";
}
//! This overload is called when T == ParameterType<T>::value.
template<typename T>
T& HandleParameter(
typename ParameterType<T>::type& value,
ParamData& /* d */,
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
const typename boost::disable_if<std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
{
return value;
}
//! This overload is called for matrices, which return a different type.
template<typename T>
T& HandleParameter(
typename ParameterType<T>::type& value,
ParamData& d,
const typename boost::enable_if<arma::is_arma_type<T>>::type* /* junk */)
{
// If the matrix is an input matrix, we have to load the matrix. 'value'
// contains the filename. It's possible we could load empty matrices many
// times, but I am not bothered by that---it shouldn't be something that
// happens.
T& matrix = *boost::any_cast<T>(&d.mappedValue);
if (d.input && !d.loaded)
{
// call correct data::Load() function
if (arma::is_Row<T>::value || arma::is_Col<T>::value)
data::Load(value, matrix, true);
else
data::Load(value, matrix, true, !d.noTranspose);
d.loaded = true;
}
return matrix;
}
//! This must be overloaded for matrices and dataset info objects.
template<typename T>
T& HandleParameter(
typename util::ParameterType<T>::type& value,
util::ParamData& d,
const typename boost::enable_if<std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
{
// If this is an input parameter, we need to load both the matrix and the
// dataset info.
std::tuple<mlpack::data::DatasetInfo, arma::mat>& tuple =
*boost::any_cast<std::tuple<mlpack::data::DatasetInfo,
arma::mat>>(&d.mappedValue);
if (d.input && !d.loaded)
{
data::Load(value, std::get<1>(tuple), std::get<0>(tuple), true,
!d.noTranspose);
d.loaded = true;
}
return tuple;
}
//! This is called for serializable mlpack objects, which have a different boost
//! name.
template<typename T>
T& HandleParameter(
typename ParameterType<T>::type& value,
ParamData& d,
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
{
// If the model is an input model, we have to load it from file. 'value'
// contains the filename.
T& model = *boost::any_cast<T>(&d.mappedValue);
if (d.input && !d.loaded)
{
data::Load(value, "model", model, true);
d.loaded = true;
}
return model;
}
} // namespace util
} // namespace mlpack
#endif
+8 -8
View File
@@ -21,11 +21,11 @@ endmacro ()
# Recurse into each method mlpack provides.
set(DIRS
preprocess
# mvu # Note: this implementation of MVU does not work. See #189.
adaboost
approx_kfn
amf
ann
approx_kfn
block_krylov_svd
cf
dbscan
@@ -39,33 +39,33 @@ set(DIRS
hoeffding_trees
kernel_pca
kmeans
mean_shift
lars
linear_regression
local_coordinate_coding
logistic_regression
lsh
# mvu
matrix_completion
mean_shift
naive_bayes
nca
neighbor_search
nmf
# lmf
nystroem_method
pca
perceptron
preprocess
quic_svd
radical
randomized_svd
random_forest
randomized_svd
range_search
rann
# rmva
regularized_svd
reinforcement_learning
softmax_regression
sparse_autoencoder
sparse_coding
nystroem_method
sparse_svm
)
foreach(dir ${DIRS})
+4 -4
View File
@@ -5,6 +5,10 @@ set(SOURCES
amf_impl.hpp
)
add_subdirectory(update_rules)
add_subdirectory(init_rules)
add_subdirectory(termination_policies)
# Add directory name to sources.
set(DIR_SRCS)
foreach(file ${SOURCES})
@@ -13,7 +17,3 @@ endforeach()
# Append sources (with directory name) to list of all mlpack sources (used at
# the parent scope).
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
add_subdirectory(update_rules)
add_subdirectory(init_rules)
add_subdirectory(termination_policies)
+7 -7
View File
@@ -7,6 +7,13 @@ set(SOURCES
rnn_impl.hpp
)
add_subdirectory(visitor)
add_subdirectory(activation_functions)
add_subdirectory(init_rules)
add_subdirectory(layer)
add_subdirectory(convolution_rules)
add_subdirectory(augmented)
# Add directory name to sources.
set(DIR_SRCS)
foreach(file ${SOURCES})
@@ -15,10 +22,3 @@ endforeach()
# Append sources (with directory name) to list of all mlpack sources (used at
# the parent scope).
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
add_subdirectory(visitor)
add_subdirectory(activation_functions)
add_subdirectory(init_rules)
add_subdirectory(layer)
add_subdirectory(convolution_rules)
add_subdirectory(augmented)
@@ -2,9 +2,13 @@
# Anything not in this list will not be compiled into mlpack.
set(SOURCES
add.hpp
add_impl.hpp
copy.hpp
copy_impl.hpp
score.hpp
score_impl.hpp
sort.hpp
sort_impl.hpp
)
# Add directory name to sources.
+1 -1
View File
@@ -69,7 +69,7 @@ set(SOURCES
select_impl.hpp
sequential.hpp
sequential_impl.hpp
vr_class_reward_impl.hpp
vr_class_reward.hpp
vr_class_reward_impl.hpp
)
@@ -8,6 +8,7 @@ set(SOURCES
fastmks_model.cpp
fastmks_rules.hpp
fastmks_rules_impl.hpp
fastmks_stat.hpp
)
# Add directory name to sources.
+2
View File
@@ -6,6 +6,8 @@ set(SOURCES
hmm_model.hpp
hmm_regression.hpp
hmm_regression_impl.hpp
hmm_util.hpp
hmm_util_impl.hpp
)
# Add directory name to sources.
+2 -2
View File
@@ -5,6 +5,8 @@ set(SOURCES
kernel_pca_impl.hpp
)
add_subdirectory(kernel_rules)
# Add directory name to sources.
set(DIR_SRCS)
foreach(file ${SOURCES})
@@ -14,7 +16,5 @@ endforeach()
# the parent scope).
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
add_subdirectory(kernel_rules)
add_cli_executable(kernel_pca)
add_python_binding(kernel_pca)
+2 -2
View File
@@ -7,6 +7,8 @@ set(SOURCES
# pca_nomain.cpp
)
add_subdirectory(decomposition_policies)
# Add directory name to sources.
set(DIR_SRCS)
foreach(file ${SOURCES})
@@ -16,7 +18,5 @@ endforeach()
# the parent scope).
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
add_subdirectory(decomposition_policies)
add_cli_executable(pca)
add_python_binding(pca)
+3 -3
View File
@@ -7,6 +7,9 @@ set(SOURCES
perceptron_impl.hpp
)
add_subdirectory(initialization_methods)
add_subdirectory(learning_policies)
# Add directory name to sources.
set(DIR_SRCS)
foreach(file ${SOURCES})
@@ -16,8 +19,5 @@ endforeach()
# the parent scope).
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
add_subdirectory(initialization_methods)
add_subdirectory(learning_policies)
add_cli_executable(perceptron)
add_python_binding(perceptron)
@@ -8,6 +8,11 @@ set(SOURCES
training_config.hpp
)
add_subdirectory(environment)
add_subdirectory(policy)
add_subdirectory(replay)
add_subdirectory(worker)
# Add directory name to sources.
set(DIR_SRCS)
foreach(file ${SOURCES})
@@ -16,7 +21,3 @@ endforeach()
# Append sources (with directory name) to list of all mlpack sources (used at
# the parent scope).
set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
add_subdirectory(environment)
add_subdirectory(estimator)
add_subdirectory(policy)
+20 -19
View File
@@ -1,27 +1,27 @@
# mlpack test executable.
add_executable(mlpack_test
activation_functions_test.cpp
adaboost_test.cpp
adam_test.cpp
ada_delta_test.cpp
ada_grad_test.cpp
adaboost_test.cpp
adam_test.cpp
akfn_test.cpp
aknn_test.cpp
ann_layer_test.cpp
armadillo_svd_test.cpp
arma_extend_test.cpp
armadillo_svd_test.cpp
async_learning_test.cpp
aug_lagrangian_test.cpp
augmented_rnns_tasks_test.cpp
binarize_test.cpp
block_krylov_svd_test.cpp
cf_test.cpp
cli_binding_test.cpp
cli_test.cpp
cmaes_test.cpp
cli_binding_test.cpp
cne_test.cpp
convolutional_network_test.cpp
convolution_test.cpp
convolutional_network_test.cpp
cosine_tree_test.cpp
cv_test.cpp
dbscan_test.cpp
@@ -55,14 +55,22 @@ add_executable(mlpack_test
lars_test.cpp
lbfgs_test.cpp
lin_alg_test.cpp
linear_regression_test.cpp
line_search_test.cpp
linear_regression_test.cpp
load_save_test.cpp
local_coordinate_coding_test.cpp
logistic_regression_test.cpp
log_test.cpp
logistic_regression_test.cpp
lrsdp_test.cpp
lsh_test.cpp
main_tests/decision_tree_test.cpp
main_tests/emst_test.cpp
main_tests/linear_regression_test.cpp
main_tests/pca_test.cpp
main_tests/preprocess_binarize_test.cpp
main_tests/preprocess_imputer_test.cpp
main_tests/preprocess_split_test.cpp
main_tests/test_helper.hpp
math_test.cpp
matrix_completion_test.cpp
maximal_inputs_test.cpp
@@ -79,9 +87,9 @@ add_executable(mlpack_test
parallel_sgd_test.cpp
pca_test.cpp
perceptron_test.cpp
python_binding_test.cpp
prefixedoutstream_test.cpp
proximal_test.cpp
python_binding_test.cpp
q_learning_test.cpp
qdafn_test.cpp
quic_svd_test.cpp
@@ -98,12 +106,12 @@ add_executable(mlpack_test
sa_test.cpp
scd_test.cpp
sdp_primal_dual_test.cpp
serialization.hpp
serialization.cpp
serialization.hpp
serialization_test.cpp
sgdr_test.cpp
sgd_test.cpp
sfinae_test.cpp
sgd_test.cpp
sgdr_test.cpp
smorms3_test.cpp
snapshot_ensembles.cpp
softmax_regression_test.cpp
@@ -116,20 +124,13 @@ add_executable(mlpack_test
svd_batch_test.cpp
svd_incremental_test.cpp
termination_policy_test.cpp
test_tools.hpp
timer_test.cpp
tree_test.cpp
tree_traits_test.cpp
ub_tree_test.cpp
union_find_test.cpp
vantage_point_tree_test.cpp
main_tests/test_helper.hpp
main_tests/emst_test.cpp
main_tests/decision_tree_test.cpp
main_tests/linear_regression_test.cpp
main_tests/pca_test.cpp
main_tests/preprocess_binarize_test.cpp
main_tests/preprocess_imputer_test.cpp
main_tests/preprocess_split_test.cpp
)
# Link dependencies of test executable.
+1 -1
View File
@@ -14,7 +14,7 @@
#include <mlpack/methods/amf/update_rules/svd_batch_learning.hpp>
#include <mlpack/methods/amf/init_rules/random_init.hpp>
#include <mlpack/methods/amf/init_rules/average_init.hpp>
#include <mlpack/methods/amf/termination_policies/validation_RMSE_termination.hpp>
#include <mlpack/methods/amf/termination_policies/validation_rmse_termination.hpp>
#include <mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp>
#include <boost/test/unit_test.hpp>
+1 -1
View File
@@ -18,7 +18,7 @@
#include <mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp>
#include <mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp>
#include <mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp>
#include <mlpack/methods/amf/termination_policies/validation_RMSE_termination.hpp>
#include <mlpack/methods/amf/termination_policies/validation_rmse_termination.hpp>
#include <boost/test/unit_test.hpp>
#include "test_tools.hpp"