Merge branch 'master' of https://github.com/mlpack/mlpack into sse-loss
This commit is contained in:
@@ -44,10 +44,13 @@ macro(get_deps LINK DEPS_NAME PACKAGE)
|
||||
list(LENGTH DIRECTORIES DIRECTORIES_LEN)
|
||||
if (DIRECTORIES_LEN GREATER 0)
|
||||
list(GET DIRECTORIES 0 DEPENDENCY_DIR)
|
||||
set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include")
|
||||
# Clean this line when boost is removed.
|
||||
# Clean these lines when boost is removed.
|
||||
if (${DEPS_NAME} MATCHES "boost")
|
||||
set(Boost_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/")
|
||||
install(DIRECTORY "${Boost_INCLUDE_DIR}/boost" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
else()
|
||||
set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include")
|
||||
install(DIRECTORY "${GENERIC_INCLUDE_DIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
endif()
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
### mlpack ?.?.?
|
||||
###### ????-??-??
|
||||
* Added Decision Tree Regressor (#2905). It can be used using the class
|
||||
`mlpack::tree::DecisionTreeRegressor`. It is accessible only though C++.
|
||||
|
||||
* Added dict-style inspection of mlpack models in python bindings (#2868).
|
||||
|
||||
* Added Extra Trees Algorithm (#2883). Currently, it can be used using the
|
||||
|
||||
@@ -26,12 +26,13 @@ namespace r {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a vector option.
|
||||
@@ -39,7 +40,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a string option.
|
||||
@@ -47,7 +48,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a matrix option, a tuple option, a
|
||||
@@ -57,7 +58,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */ = 0);
|
||||
@@ -69,8 +70,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of an option. This is the function that will be
|
||||
|
||||
@@ -24,12 +24,13 @@ namespace r {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -46,7 +47,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Print each element in an array delimited by square brackets.
|
||||
std::ostringstream oss;
|
||||
@@ -89,7 +90,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type*)
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type*)
|
||||
{
|
||||
const std::string& s = *boost::any_cast<std::string>(&data.value);
|
||||
return "\"" + s + "\"";
|
||||
@@ -102,7 +103,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */)
|
||||
@@ -132,8 +133,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "NA";
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace r {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -42,7 +42,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
const T& t = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -58,7 +58,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& matrix = boost::any_cast<T>(data.value);
|
||||
@@ -74,8 +74,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << data.cppType << " model at " << boost::any_cast<T*>(data.value);
|
||||
@@ -88,8 +88,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& tuple = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -23,84 +23,88 @@ namespace r {
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<size_t>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
|
||||
const typename boost::disable_if<std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
void GetPrintableType(util::ParamData& d,
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace r {
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -34,11 +34,11 @@ inline std::string GetPrintableType(
|
||||
template<>
|
||||
inline std::string GetPrintableType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
@@ -46,11 +46,11 @@ inline std::string GetPrintableType<int>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "numeric";
|
||||
}
|
||||
@@ -58,11 +58,15 @@ inline std::string GetPrintableType<double>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo,arma::mat>>::value>::type*)
|
||||
{
|
||||
return "character";
|
||||
}
|
||||
@@ -70,11 +74,11 @@ inline std::string GetPrintableType<std::string>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<size_t>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
|
||||
const typename boost::disable_if<std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
@@ -82,11 +86,11 @@ inline std::string GetPrintableType<size_t>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "logical";
|
||||
}
|
||||
@@ -94,9 +98,9 @@ inline std::string GetPrintableType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "vector of " + GetPrintableType<typename T::value_type>(d) + "s";
|
||||
}
|
||||
@@ -104,9 +108,9 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
std::string type = "numeric matrix";
|
||||
if (std::is_same<typename T::elem_type, double>::value)
|
||||
@@ -127,8 +131,8 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "categorical matrix/data.frame";
|
||||
}
|
||||
@@ -136,10 +140,10 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
std::string type = util::StripType(d.cppType);
|
||||
if (type == "mlpackModel")
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace r {
|
||||
template<typename T>
|
||||
inline std::string GetRType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -35,11 +35,11 @@ inline std::string GetRType(
|
||||
template<>
|
||||
inline std::string GetRType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "logical";
|
||||
}
|
||||
@@ -47,11 +47,11 @@ inline std::string GetRType<bool>(
|
||||
template<>
|
||||
inline std::string GetRType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
@@ -59,11 +59,11 @@ inline std::string GetRType<int>(
|
||||
template<>
|
||||
inline std::string GetRType<size_t>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
|
||||
const typename boost::disable_if<std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
@@ -71,11 +71,11 @@ inline std::string GetRType<size_t>(
|
||||
template<>
|
||||
inline std::string GetRType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "numeric";
|
||||
}
|
||||
@@ -83,11 +83,15 @@ inline std::string GetRType<double>(
|
||||
template<>
|
||||
inline std::string GetRType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "character";
|
||||
}
|
||||
@@ -95,7 +99,7 @@ inline std::string GetRType<std::string>(
|
||||
template<typename T>
|
||||
inline std::string GetRType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
return GetRType<typename T::value_type>(d) + " vector";
|
||||
}
|
||||
@@ -103,9 +107,9 @@ inline std::string GetRType(
|
||||
template<typename T>
|
||||
inline std::string GetRType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0,
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
std::string elemType = GetRType<typename T::elem_type>(d);
|
||||
std::string type = "matrix";
|
||||
@@ -120,8 +124,8 @@ inline std::string GetRType(
|
||||
template<typename T>
|
||||
inline std::string GetRType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "numeric matrix/data.frame with info";
|
||||
}
|
||||
@@ -129,8 +133,8 @@ inline std::string GetRType(
|
||||
template<typename T>
|
||||
inline std::string GetRType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
return util::StripType(d.cppType);
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace r {
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -36,11 +36,11 @@ inline std::string GetType(
|
||||
template<>
|
||||
inline std::string GetType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "Int";
|
||||
}
|
||||
@@ -48,11 +48,11 @@ inline std::string GetType<int>(
|
||||
template<>
|
||||
inline std::string GetType<float>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<float>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<float>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<float>>::type*,
|
||||
const typename boost::disable_if<std::is_same<float,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<float>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<float>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<float>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<float,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "Float";
|
||||
}
|
||||
@@ -60,11 +60,11 @@ inline std::string GetType<float>(
|
||||
template<>
|
||||
inline std::string GetType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "Double";
|
||||
}
|
||||
@@ -72,11 +72,14 @@ inline std::string GetType<double>(
|
||||
template<>
|
||||
inline std::string GetType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "String";
|
||||
}
|
||||
@@ -84,11 +87,11 @@ inline std::string GetType<std::string>(
|
||||
template<>
|
||||
inline std::string GetType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "Bool";
|
||||
}
|
||||
@@ -96,9 +99,9 @@ inline std::string GetType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "Vec" + GetType<typename T::value_type>(d);
|
||||
}
|
||||
@@ -106,9 +109,9 @@ inline std::string GetType(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::string type = "";
|
||||
if (std::is_same<typename T::elem_type, double>::value)
|
||||
@@ -136,8 +139,8 @@ inline std::string GetType(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "MatWithInfo";
|
||||
}
|
||||
@@ -145,8 +148,8 @@ inline std::string GetType(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
return d.cppType;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace r {
|
||||
template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
if (!d.required)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ void PrintInputProcessing(
|
||||
template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
if (!d.required)
|
||||
{
|
||||
@@ -108,8 +108,8 @@ void PrintInputProcessing(
|
||||
template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
if (!d.required)
|
||||
{
|
||||
@@ -155,8 +155,8 @@ void PrintInputProcessing(
|
||||
template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
if (!d.required)
|
||||
{
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace r {
|
||||
template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
/**
|
||||
* This gives us code like:
|
||||
@@ -48,7 +48,7 @@ void PrintOutputProcessing(
|
||||
template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
@@ -69,8 +69,8 @@ void PrintOutputProcessing(
|
||||
template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
/**
|
||||
* This gives us code like:
|
||||
@@ -89,8 +89,8 @@ void PrintOutputProcessing(
|
||||
template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
/**
|
||||
* This gives us code like:
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace r {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -62,8 +62,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace r {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
// A flag type.
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -146,8 +146,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "An mlpack model pointer. `<Model>` refers to the type of model that "
|
||||
"is being stored, so, e.g., for `cf()`, the type will be `CFModel`. "
|
||||
|
||||
@@ -33,15 +33,15 @@ template<typename T>
|
||||
void AddToCLI11(const std::string& cliName,
|
||||
util::ParamData& param,
|
||||
CLI::App& app,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
bool>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
bool>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>>::type* = 0)
|
||||
arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
app.add_option_function<std::string>(cliName.c_str(),
|
||||
[¶m](const std::string& value)
|
||||
@@ -65,15 +65,15 @@ template<typename T>
|
||||
void AddToCLI11(const std::string& cliName,
|
||||
util::ParamData& param,
|
||||
CLI::App& app,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
bool>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<
|
||||
data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
bool>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<
|
||||
data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>>::type* = 0)
|
||||
arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
app.add_option_function<std::string>(cliName.c_str(),
|
||||
[¶m](const std::string& value)
|
||||
@@ -97,13 +97,13 @@ template<typename T>
|
||||
void AddToCLI11(const std::string& cliName,
|
||||
util::ParamData& param,
|
||||
CLI::App& app,
|
||||
const typename boost::disable_if<
|
||||
std::is_same<T, bool>>::type* = 0,
|
||||
const typename boost::enable_if<
|
||||
arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
const typename std::enable_if<!
|
||||
std::is_same<T, bool>::value>::type* = 0,
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>>::type* = 0)
|
||||
arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
app.add_option_function<std::string>(cliName.c_str(),
|
||||
[¶m](const std::string& value)
|
||||
@@ -127,15 +127,15 @@ template<typename T>
|
||||
void AddToCLI11(const std::string& cliName,
|
||||
util::ParamData& param,
|
||||
CLI::App& app,
|
||||
const typename boost::disable_if<
|
||||
std::is_same<T, bool>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
const typename std::enable_if<!
|
||||
std::is_same<T, bool>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>>::type* = 0)
|
||||
arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
app.add_option_function<T>(cliName.c_str(),
|
||||
[¶m](const T& value)
|
||||
@@ -157,15 +157,15 @@ template<typename T>
|
||||
void AddToCLI11(const std::string& cliName,
|
||||
util::ParamData& param,
|
||||
CLI::App& app,
|
||||
const typename boost::enable_if<
|
||||
std::is_same<T, bool>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<
|
||||
data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
const typename std::enable_if<
|
||||
std::is_same<T, bool>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!
|
||||
data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>>::type* = 0)
|
||||
arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
app.add_flag_function(cliName.c_str(),
|
||||
[¶m](const T& value)
|
||||
|
||||
@@ -26,12 +26,13 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a vector option.
|
||||
@@ -39,7 +40,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a string option.
|
||||
@@ -47,7 +48,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a matrix option, a tuple option, a
|
||||
@@ -57,7 +58,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */ = 0);
|
||||
@@ -69,8 +70,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of an option. This is the function that will be
|
||||
|
||||
@@ -24,12 +24,13 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if (!std::is_same<T, bool>::value)
|
||||
@@ -44,7 +45,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Print each element in an array delimited by square brackets.
|
||||
std::ostringstream oss;
|
||||
@@ -88,7 +89,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type*)
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type*)
|
||||
{
|
||||
const std::string& s = *boost::any_cast<std::string>(&data.value);
|
||||
return "'" + s + "'";
|
||||
@@ -100,7 +101,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */)
|
||||
@@ -115,8 +116,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "''";
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace cli {
|
||||
template<typename T>
|
||||
void DeleteAllocatedMemoryImpl(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -30,7 +30,7 @@ void DeleteAllocatedMemoryImpl(
|
||||
template<typename T>
|
||||
void DeleteAllocatedMemoryImpl(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -38,8 +38,8 @@ void DeleteAllocatedMemoryImpl(
|
||||
template<typename T>
|
||||
void DeleteAllocatedMemoryImpl(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Delete the allocated memory (hopefully we actually own it).
|
||||
typedef std::tuple<T*, std::string> TupleType;
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace cli {
|
||||
template<typename T>
|
||||
void* GetAllocatedMemory(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ void* GetAllocatedMemory(
|
||||
template<typename T>
|
||||
void* GetAllocatedMemory(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -39,8 +39,8 @@ void* GetAllocatedMemory(
|
||||
template<typename T>
|
||||
void* GetAllocatedMemory(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Here we have a model, which is a tuple, and we need the address of the
|
||||
// memory.
|
||||
|
||||
@@ -28,10 +28,10 @@ namespace cli {
|
||||
template<typename T>
|
||||
T& GetParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// No mapping is needed, so just cast it directly.
|
||||
return *boost::any_cast<T>(&d.value);
|
||||
@@ -45,7 +45,7 @@ T& GetParam(
|
||||
template<typename T>
|
||||
T& GetParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// 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
|
||||
@@ -80,8 +80,8 @@ T& GetParam(
|
||||
template<typename T>
|
||||
T& GetParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// If this is an input parameter, we need to load both the matrix and the
|
||||
// dataset info.
|
||||
@@ -110,8 +110,8 @@ T& GetParam(
|
||||
template<typename T>
|
||||
T*& GetParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// If the model is an input model, we have to load it from file. 'value'
|
||||
// contains the filename.
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print a vector option, with spaces between it.
|
||||
@@ -57,8 +57,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print an option into a std::string. This should print a short, one-line
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -103,8 +103,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Extract the string from the tuple that's being held.
|
||||
typedef std::tuple<T*, typename ParameterType<T>::type> TupleType;
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a matrix type (where the user has to pass the file
|
||||
@@ -38,7 +38,7 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a serializable model type (where the user has to
|
||||
@@ -47,8 +47,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a mapped matrix type (where the user has to pass
|
||||
@@ -57,8 +57,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter's name as seen by the user.
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "--" + data.name;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*)
|
||||
{
|
||||
return "--" + data.name + "_file";
|
||||
}
|
||||
@@ -53,8 +53,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "--" + data.name + "_file";
|
||||
}
|
||||
@@ -66,8 +66,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "--" + data.name + "_file";
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a matrix type (where the user has to pass the file
|
||||
@@ -40,7 +40,7 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a serializable model type (where the user has to
|
||||
@@ -50,8 +50,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a mapped matrix type (where the user has to pass
|
||||
@@ -61,8 +61,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter's name as seen by the user.
|
||||
|
||||
@@ -28,10 +28,10 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*)
|
||||
{
|
||||
return input + ".csv";
|
||||
}
|
||||
@@ -57,8 +57,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return input + ".bin";
|
||||
}
|
||||
@@ -71,8 +71,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return input + ".arff";
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -60,8 +60,8 @@ std::string GetPrintableType(
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
if (std::is_same<T, bool>::value)
|
||||
return "flag";
|
||||
@@ -101,8 +101,8 @@ std::string GetPrintableType(
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return data.cppType + " file";
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace cli {
|
||||
template<typename T>
|
||||
T& GetRawParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// No mapping is needed, so just cast it directly.
|
||||
return *boost::any_cast<T>(&d.value);
|
||||
@@ -42,7 +42,7 @@ T& GetRawParam(
|
||||
template<typename T>
|
||||
T& GetRawParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* = 0)
|
||||
@@ -59,8 +59,8 @@ T& GetRawParam(
|
||||
template<typename T>
|
||||
T*& GetRawParam(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Don't load the model.
|
||||
typedef std::tuple<T*, std::string> TupleType;
|
||||
|
||||
@@ -31,10 +31,10 @@ template<typename T>
|
||||
void InPlaceCopyInternal(
|
||||
util::ParamData& /* d */,
|
||||
util::ParamData& /* input */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string MapParameterName(
|
||||
const std::string& identifier,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ std::string MapParameterName(
|
||||
template<typename T>
|
||||
std::string MapParameterName(
|
||||
const std::string& identifier,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value ||
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Output a vector option (print to stdout).
|
||||
@@ -38,7 +38,7 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Output a matrix option (this saves it to the given file).
|
||||
@@ -46,7 +46,7 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Output a serializable class option (this saves it to the given file).
|
||||
@@ -54,8 +54,8 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Output a mapped dataset.
|
||||
@@ -63,8 +63,8 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Output an option. This is the function that will be called by the IO
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::cout << data.name << ": " << *boost::any_cast<T>(&data.value)
|
||||
<< std::endl;
|
||||
@@ -38,7 +38,7 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
std::cout << data.name << ": ";
|
||||
const T& t = *boost::any_cast<T>(&data.value);
|
||||
@@ -51,7 +51,7 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* /* junk */)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* /* junk */)
|
||||
{
|
||||
typedef std::tuple<T, std::tuple<std::string, size_t, size_t>> TupleType;
|
||||
const T& output = std::get<0>(*boost::any_cast<TupleType>(&data.value));
|
||||
@@ -71,8 +71,8 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
// The const cast is necessary here because Serialize() can't ever be marked
|
||||
// const. In this case we can assume it though, since we will be saving and
|
||||
@@ -91,8 +91,8 @@ void OutputParamImpl(
|
||||
template<typename T>
|
||||
void OutputParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
// Output the matrix with the mappings.
|
||||
typedef std::tuple<T, std::tuple<std::string, size_t, size_t>> TupleType;
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -62,8 +62,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace cli {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
// A flag type.
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -165,8 +165,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "A filename containing an mlpack model. These can have one of three "
|
||||
"formats: binary (.bin), text (.txt), and XML (.xml). The XML format "
|
||||
|
||||
@@ -27,11 +27,11 @@ template<typename T>
|
||||
void SetParam(
|
||||
util::ParamData& d,
|
||||
const boost::any& value,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T, bool>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T, bool>::value>::type* = 0)
|
||||
{
|
||||
// No mapping is needed.
|
||||
d.value = value;
|
||||
@@ -44,7 +44,7 @@ template<typename T>
|
||||
void SetParam(
|
||||
util::ParamData& d,
|
||||
const boost::any& /* value */,
|
||||
const typename boost::enable_if<std::is_same<T, bool>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T, bool>::value>::type* = 0)
|
||||
{
|
||||
// Force set to the value of whether or not this was passed.
|
||||
d.value = d.wasPassed;
|
||||
@@ -76,8 +76,8 @@ template<typename T>
|
||||
void SetParam(
|
||||
util::ParamData& d,
|
||||
const boost::any& value,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// We're setting the string filename.
|
||||
typedef std::tuple<T*, typename ParameterType<T>::type> TupleType;
|
||||
|
||||
@@ -26,22 +26,22 @@ namespace cli {
|
||||
*/
|
||||
template<typename T>
|
||||
std::string StringTypeParamImpl(
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string containing the type of the parameter, for vector options.
|
||||
*/
|
||||
template<typename T>
|
||||
std::string StringTypeParamImpl(
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string containing the type of the parameter,
|
||||
*/
|
||||
template<typename T>
|
||||
std::string StringTypeParamImpl(
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string containing the type of a parameter. This overload is used if
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace cli {
|
||||
*/
|
||||
template<typename T>
|
||||
std::string StringTypeParamImpl(
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Don't know what type this is.
|
||||
return "unknown";
|
||||
@@ -35,7 +35,7 @@ std::string StringTypeParamImpl(
|
||||
*/
|
||||
template<typename T>
|
||||
std::string StringTypeParamImpl(
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "vector";
|
||||
}
|
||||
@@ -45,7 +45,7 @@ std::string StringTypeParamImpl(
|
||||
*/
|
||||
template<typename T>
|
||||
std::string StringTypeParamImpl(
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
|
||||
+1357
-677
File diff suppressed because it is too large
Load Diff
@@ -26,12 +26,13 @@ namespace go {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a vector option.
|
||||
@@ -39,7 +40,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a string option.
|
||||
@@ -47,7 +48,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a matrix option, a tuple option, a
|
||||
@@ -57,10 +58,10 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */ = 0);
|
||||
arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a model option (this returns the default
|
||||
@@ -69,8 +70,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of an option. This is the function that will be
|
||||
|
||||
@@ -24,12 +24,13 @@ namespace go {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -46,7 +47,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Print each element in an array delimited by square brackets.
|
||||
std::ostringstream oss;
|
||||
@@ -90,7 +91,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type*)
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type*)
|
||||
{
|
||||
const std::string& s = *boost::any_cast<std::string>(&data.value);
|
||||
return "\"" + s + "\"";
|
||||
@@ -102,7 +103,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */)
|
||||
@@ -134,8 +135,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "nil";
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace go {
|
||||
template<typename T>
|
||||
inline std::string GetGoType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -37,11 +37,11 @@ inline std::string GetGoType(
|
||||
template<>
|
||||
inline std::string GetGoType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
@@ -49,11 +49,11 @@ inline std::string GetGoType<int>(
|
||||
template<>
|
||||
inline std::string GetGoType<float>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<float>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<float>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<float>>::type*,
|
||||
const typename boost::disable_if<std::is_same<float,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<float>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<float>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<float>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<float,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "float32";
|
||||
}
|
||||
@@ -61,11 +61,11 @@ inline std::string GetGoType<float>(
|
||||
template<>
|
||||
inline std::string GetGoType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "float64";
|
||||
}
|
||||
@@ -73,11 +73,14 @@ inline std::string GetGoType<double>(
|
||||
template<>
|
||||
inline std::string GetGoType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
@@ -85,11 +88,11 @@ inline std::string GetGoType<std::string>(
|
||||
template<>
|
||||
inline std::string GetGoType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "bool";
|
||||
}
|
||||
@@ -97,7 +100,7 @@ inline std::string GetGoType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetGoType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
return "[]" + GetGoType<typename T::value_type>(d);
|
||||
}
|
||||
@@ -105,9 +108,9 @@ inline std::string GetGoType(
|
||||
template<typename T>
|
||||
inline std::string GetGoType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0,
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return "mat.Dense";
|
||||
}
|
||||
@@ -115,8 +118,8 @@ inline std::string GetGoType(
|
||||
template<typename T>
|
||||
inline std::string GetGoType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
return "matrixWithInfo";
|
||||
}
|
||||
@@ -124,8 +127,8 @@ inline std::string GetGoType(
|
||||
template<typename T>
|
||||
inline std::string GetGoType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
std::string goStrippedType, strippedType, printedType, defaultsType;
|
||||
StripType(d.cppType, goStrippedType, strippedType, printedType, defaultsType);
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace go {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -42,7 +42,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
const T& t = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -58,7 +58,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& matrix = boost::any_cast<T>(data.value);
|
||||
@@ -74,8 +74,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << data.cppType << " model at " << boost::any_cast<T*>(data.value);
|
||||
@@ -88,8 +88,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& tuple = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -23,75 +23,78 @@ namespace go {
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
void GetPrintableType(util::ParamData& d,
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace go {
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -35,11 +35,11 @@ inline std::string GetPrintableType(
|
||||
template<>
|
||||
inline std::string GetPrintableType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
@@ -47,11 +47,11 @@ inline std::string GetPrintableType<int>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "float64";
|
||||
}
|
||||
@@ -59,11 +59,14 @@ inline std::string GetPrintableType<double>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
@@ -71,11 +74,11 @@ inline std::string GetPrintableType<std::string>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "bool";
|
||||
}
|
||||
@@ -83,9 +86,9 @@ inline std::string GetPrintableType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "array of " + GetPrintableType<typename T::value_type>(d) + "s";
|
||||
}
|
||||
@@ -93,9 +96,9 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
std::string type = "*mat.Dense";
|
||||
if (T::is_row || T::is_col)
|
||||
@@ -107,8 +110,8 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "matrixWithInfo";
|
||||
}
|
||||
@@ -116,10 +119,10 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
std::string goStrippedType, strippedType, printedType, defaultsType;
|
||||
StripType(d.cppType, goStrippedType, strippedType, printedType, defaultsType);
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace go {
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -34,9 +34,9 @@ inline std::string GetType(
|
||||
template<>
|
||||
inline std::string GetType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*)
|
||||
{
|
||||
return "Int";
|
||||
}
|
||||
@@ -44,9 +44,9 @@ inline std::string GetType<int>(
|
||||
template<>
|
||||
inline std::string GetType<float>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<float>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<float>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<float>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<float>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<float>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<float>::value>::type*)
|
||||
{
|
||||
return "Float";
|
||||
}
|
||||
@@ -54,9 +54,9 @@ inline std::string GetType<float>(
|
||||
template<>
|
||||
inline std::string GetType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*)
|
||||
{
|
||||
return "Double";
|
||||
}
|
||||
@@ -64,9 +64,12 @@ inline std::string GetType<double>(
|
||||
template<>
|
||||
inline std::string GetType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*)
|
||||
{
|
||||
return "String";
|
||||
}
|
||||
@@ -74,9 +77,9 @@ inline std::string GetType<std::string>(
|
||||
template<>
|
||||
inline std::string GetType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*)
|
||||
{
|
||||
return "Bool";
|
||||
}
|
||||
@@ -84,7 +87,7 @@ inline std::string GetType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
return "Vec" + GetType<typename T::value_type>(d);
|
||||
}
|
||||
@@ -92,7 +95,7 @@ inline std::string GetType(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
std::string type = "";
|
||||
if (std::is_same<typename T::elem_type, double>::value)
|
||||
@@ -120,8 +123,8 @@ inline std::string GetType(
|
||||
template<typename T>
|
||||
inline std::string GetType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
return d.cppType + "*";
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ namespace go {
|
||||
template<typename T>
|
||||
void PrintDefnInput(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
if (d.required)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ void PrintDefnInput(
|
||||
template<typename T>
|
||||
void PrintDefnInput(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// param_name *mat.Dense
|
||||
if (d.required)
|
||||
@@ -62,8 +62,8 @@ void PrintDefnInput(
|
||||
template<typename T>
|
||||
void PrintDefnInput(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// param_name *DataWithInfo
|
||||
if (d.required)
|
||||
@@ -79,8 +79,8 @@ void PrintDefnInput(
|
||||
template<typename T>
|
||||
void PrintDefnInput(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the type names we need to use.
|
||||
std::string goStrippedType, strippedType, printedType, defaultsType;
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace go {
|
||||
template<typename T>
|
||||
void PrintDefnOutput(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::cout << GetGoType<T>(d);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ void PrintDefnOutput(
|
||||
template<typename T>
|
||||
void PrintDefnOutput(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// *mat.Dense
|
||||
std::cout << "*" << GetGoType<T>(d);
|
||||
@@ -53,8 +53,8 @@ void PrintDefnOutput(
|
||||
template<typename T>
|
||||
void PrintDefnOutput(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// *mat.Dense
|
||||
std::cout << "*" << GetGoType<T>(d);
|
||||
@@ -66,8 +66,8 @@ void PrintDefnOutput(
|
||||
template<typename T>
|
||||
void PrintDefnOutput(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the type names we need to use.
|
||||
std::string goStrippedType, strippedType, printedType, defaultsType;
|
||||
|
||||
@@ -29,10 +29,10 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -129,7 +129,7 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -189,8 +189,8 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -250,8 +250,8 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// First, get the correct classparamName if needed.
|
||||
std::string goStrippedType, strippedType, printedType, defaultsType;
|
||||
|
||||
@@ -29,10 +29,10 @@ template<typename T>
|
||||
void PrintMethodConfig(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -64,7 +64,7 @@ template<typename T>
|
||||
void PrintMethodConfig(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -96,8 +96,8 @@ template<typename T>
|
||||
void PrintMethodConfig(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -129,8 +129,8 @@ template<typename T>
|
||||
void PrintMethodConfig(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ template<typename T>
|
||||
void PrintMethodInit(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -86,7 +86,7 @@ template<typename T>
|
||||
void PrintMethodInit(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -118,8 +118,8 @@ template<typename T>
|
||||
void PrintMethodInit(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -151,8 +151,8 @@ template<typename T>
|
||||
void PrintMethodInit(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -56,7 +56,7 @@ template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
@@ -83,8 +83,8 @@ template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -109,8 +109,8 @@ template<typename T>
|
||||
void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the type names we need to use.
|
||||
std::string goStrippedType, strippedType, printedType, defaultsType;
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace go {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -62,8 +62,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace go {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
// A flag type.
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -122,8 +122,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "An mlpack model pointer. This type holds a pointer to C++ memory "
|
||||
"containing the mlpack model. Note that this means the mlpack model "
|
||||
|
||||
@@ -26,12 +26,13 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a vector option.
|
||||
@@ -39,7 +40,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a string option.
|
||||
@@ -47,7 +48,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a matrix option, a tuple option, a
|
||||
@@ -57,10 +58,10 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */ = 0);
|
||||
arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a model option (this returns the default
|
||||
@@ -69,8 +70,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of an option. This is the function that will be
|
||||
|
||||
@@ -24,12 +24,13 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -46,7 +47,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Print each element in an array delimited by square brackets.
|
||||
std::ostringstream oss;
|
||||
@@ -89,7 +90,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type*)
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type*)
|
||||
{
|
||||
const std::string& s = *boost::any_cast<std::string>(&data.value);
|
||||
return "\"" + s + "\"";
|
||||
@@ -102,7 +103,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */)
|
||||
@@ -134,8 +135,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "nothing";
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -42,7 +42,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
const T& t = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -58,7 +58,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& matrix = boost::any_cast<T>(data.value);
|
||||
@@ -74,8 +74,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << data.cppType << " model at " << boost::any_cast<T*>(data.value);
|
||||
@@ -88,8 +88,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& tuple = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -60,8 +60,8 @@ std::string GetPrintableType(
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
if (std::is_same<T, bool>::value)
|
||||
return "Bool";
|
||||
@@ -102,8 +102,8 @@ std::string GetPrintableType(
|
||||
template<typename T>
|
||||
std::string GetPrintableType(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
std::string type = util::StripType(data.cppType);
|
||||
if (type == "mlpackModel")
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -62,8 +62,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace julia {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
// A flag type.
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -153,8 +153,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "An mlpack model pointer. `<Model>` refers to the type of model that "
|
||||
"is being stored, so, e.g., for `CF()`, the type will be `CFModel`. "
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace markdown {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -42,7 +42,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
const T& t = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -58,7 +58,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& matrix = boost::any_cast<T>(data.value);
|
||||
@@ -74,8 +74,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << data.cppType << " model at " << boost::any_cast<T*>(data.value);
|
||||
@@ -88,8 +88,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& tuple = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace markdown {
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a matrix type (where the user has to pass the file
|
||||
@@ -38,7 +38,7 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a serializable model type (where the user has to
|
||||
@@ -47,8 +47,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a mapped matrix type (where the user has to pass
|
||||
@@ -57,8 +57,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter's name as seen by the user.
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace markdown {
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "--" + data.name;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*)
|
||||
{
|
||||
return "--" + data.name + "_file";
|
||||
}
|
||||
@@ -53,8 +53,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "--" + data.name + "_file";
|
||||
}
|
||||
@@ -66,8 +66,8 @@ std::string GetPrintableParamName(
|
||||
template<typename T>
|
||||
std::string GetPrintableParamName(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "--" + data.name + "_file";
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a matrix type (where the user has to pass the file
|
||||
@@ -40,7 +40,7 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a serializable model type (where the user has to
|
||||
@@ -50,8 +50,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter name for a mapped matrix type (where the user has to pass
|
||||
@@ -61,8 +61,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& data,
|
||||
const std::string& value,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Get the parameter's name as seen by the user.
|
||||
|
||||
@@ -28,10 +28,10 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*)
|
||||
{
|
||||
return input + ".csv";
|
||||
}
|
||||
@@ -57,8 +57,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return input + ".bin";
|
||||
}
|
||||
@@ -71,8 +71,8 @@ template<typename T>
|
||||
std::string GetPrintableParamValue(
|
||||
util::ParamData& /* data */,
|
||||
const std::string& input,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return input + ".arff";
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace markdown {
|
||||
*/
|
||||
template<typename T>
|
||||
bool IsSerializable(
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -35,8 +35,8 @@ bool IsSerializable(
|
||||
*/
|
||||
template<typename T>
|
||||
bool IsSerializable(
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,12 +26,13 @@ namespace python {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a vector option.
|
||||
@@ -39,7 +40,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a string option.
|
||||
@@ -47,7 +48,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a matrix option, a tuple option, a
|
||||
@@ -57,10 +58,10 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */ = 0);
|
||||
arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of a model option (this returns the default
|
||||
@@ -69,8 +70,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return the default value of an option. This is the function that will be
|
||||
|
||||
@@ -24,12 +24,13 @@ namespace python {
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T, std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -46,7 +47,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Print each element in an array delimited by square brackets.
|
||||
std::ostringstream oss;
|
||||
@@ -89,7 +90,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T, std::string>>::type*)
|
||||
const typename std::enable_if<std::is_same<T, std::string>::value>::type*)
|
||||
{
|
||||
const std::string& s = *boost::any_cast<std::string>(&data.value);
|
||||
return "'" + s + "'";
|
||||
@@ -102,7 +103,7 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if_c<
|
||||
const typename std::enable_if<
|
||||
arma::is_arma_type<T>::value ||
|
||||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
|
||||
arma::mat>>::value>::type* /* junk */)
|
||||
@@ -134,8 +135,8 @@ std::string DefaultParamImpl(
|
||||
template<typename T>
|
||||
std::string DefaultParamImpl(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace python {
|
||||
template<typename T>
|
||||
inline std::string GetCythonType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -33,9 +33,9 @@ inline std::string GetCythonType(
|
||||
template<>
|
||||
inline std::string GetCythonType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*)
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
@@ -43,9 +43,9 @@ inline std::string GetCythonType<int>(
|
||||
template<>
|
||||
inline std::string GetCythonType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*)
|
||||
{
|
||||
return "double";
|
||||
}
|
||||
@@ -53,9 +53,12 @@ inline std::string GetCythonType<double>(
|
||||
template<>
|
||||
inline std::string GetCythonType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*)
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
@@ -63,9 +66,9 @@ inline std::string GetCythonType<std::string>(
|
||||
template<>
|
||||
inline std::string GetCythonType<size_t>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*)
|
||||
{
|
||||
return "size_t";
|
||||
}
|
||||
@@ -73,9 +76,9 @@ inline std::string GetCythonType<size_t>(
|
||||
template<>
|
||||
inline std::string GetCythonType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*)
|
||||
{
|
||||
return "cbool";
|
||||
}
|
||||
@@ -83,7 +86,7 @@ inline std::string GetCythonType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetCythonType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
return "vector[" + GetCythonType<typename T::value_type>(d) + "]";
|
||||
}
|
||||
@@ -91,7 +94,7 @@ inline std::string GetCythonType(
|
||||
template<typename T>
|
||||
inline std::string GetCythonType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
std::string type = "Mat";
|
||||
if (T::is_row)
|
||||
@@ -105,8 +108,8 @@ inline std::string GetCythonType(
|
||||
template<typename T>
|
||||
inline std::string GetCythonType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
return d.cppType + "*";
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace python {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -42,7 +42,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
const T& t = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -58,7 +58,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& matrix = boost::any_cast<T>(data.value);
|
||||
@@ -74,8 +74,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << data.cppType << " model at " << boost::any_cast<T*>(data.value);
|
||||
@@ -88,8 +88,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// Get the matrix.
|
||||
const T& tuple = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -23,84 +23,87 @@ namespace python {
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<size_t>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
|
||||
const typename boost::disable_if<std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<>
|
||||
inline std::string GetPrintableType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
template<typename T>
|
||||
void GetPrintableType(util::ParamData& d,
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace python {
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
@@ -34,11 +34,11 @@ inline std::string GetPrintableType(
|
||||
template<>
|
||||
inline std::string GetPrintableType<int>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<int>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<int>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
|
||||
const typename boost::disable_if<std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<int,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
@@ -46,11 +46,11 @@ inline std::string GetPrintableType<int>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<double>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<double>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<double>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
|
||||
const typename boost::disable_if<std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<double,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "float";
|
||||
}
|
||||
@@ -58,11 +58,14 @@ inline std::string GetPrintableType<double>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<std::string>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
|
||||
const typename boost::disable_if<std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<
|
||||
!util::IsStdVector<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!data::HasSerialize<std::string>::value>::type*,
|
||||
const typename std::enable_if<
|
||||
!arma::is_arma_type<std::string>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<std::string,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "str";
|
||||
}
|
||||
@@ -70,11 +73,11 @@ inline std::string GetPrintableType<std::string>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<size_t>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
|
||||
const typename boost::disable_if<std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<size_t,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
@@ -82,11 +85,11 @@ inline std::string GetPrintableType<size_t>(
|
||||
template<>
|
||||
inline std::string GetPrintableType<bool>(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
|
||||
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
|
||||
const typename boost::disable_if<std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
|
||||
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<bool,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "bool";
|
||||
}
|
||||
@@ -94,9 +97,9 @@ inline std::string GetPrintableType<bool>(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "list of " + GetPrintableType<typename T::value_type>(d) + "s";
|
||||
}
|
||||
@@ -104,9 +107,9 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
std::string type = "matrix";
|
||||
if (std::is_same<typename T::elem_type, double>::value)
|
||||
@@ -127,8 +130,8 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return "categorical matrix";
|
||||
}
|
||||
@@ -136,10 +139,10 @@ inline std::string GetPrintableType(
|
||||
template<typename T>
|
||||
inline std::string GetPrintableType(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
return d.cppType + "Type";
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ template<typename T>
|
||||
void ImportDecl(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// First, we have to parse the type. If we have something like, e.g.,
|
||||
// 'LogisticRegression<>', we must convert this to 'LogisticRegression[T=*].'
|
||||
@@ -53,8 +53,8 @@ template<typename T>
|
||||
void ImportDecl(
|
||||
util::ParamData& /* d */,
|
||||
const size_t /* indent */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Print nothing.
|
||||
}
|
||||
@@ -66,7 +66,7 @@ template<typename T>
|
||||
void ImportDecl(
|
||||
util::ParamData& /* d */,
|
||||
const size_t /* indent */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Print nothing.
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace python {
|
||||
template<typename T>
|
||||
void PrintClassDefn(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void PrintClassDefn(
|
||||
template<typename T>
|
||||
void PrintClassDefn(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -48,8 +48,8 @@ void PrintClassDefn(
|
||||
template<typename T>
|
||||
void PrintClassDefn(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// First, we have to parse the type. If we have something like, e.g.,
|
||||
// 'LogisticRegression<>', we must convert this to 'LogisticRegression[].'
|
||||
|
||||
@@ -31,11 +31,11 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// The copy_all_inputs parameter must be handled first, and therefore is
|
||||
// outside the scope of this code.
|
||||
@@ -164,11 +164,11 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0,
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -251,8 +251,8 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -372,9 +372,9 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// First, get the correct class name if needed.
|
||||
std::string strippedType, printedType, defaultsType;
|
||||
@@ -445,9 +445,9 @@ template<typename T>
|
||||
void PrintInputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
// The user should pass in a matrix type of some sort.
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -30,10 +30,10 @@ void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const bool onlyOutput,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -86,7 +86,7 @@ void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const bool onlyOutput,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -128,8 +128,8 @@ void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const bool onlyOutput,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
|
||||
{
|
||||
const std::string prefix(indent, ' ');
|
||||
|
||||
@@ -170,8 +170,8 @@ void PrintOutputProcessing(
|
||||
util::ParamData& d,
|
||||
const size_t indent,
|
||||
const bool onlyOutput,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Get the type names we need to use.
|
||||
std::string strippedType, printedType, defaultsType;
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace python {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Return a string representing the command-line type of a vector.
|
||||
@@ -62,8 +62,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print the command-line type of an option into a string.
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace python {
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type*,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type*,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
|
||||
{
|
||||
// A flag type.
|
||||
if (std::is_same<T, bool>::value)
|
||||
@@ -150,8 +150,8 @@ std::string PrintTypeDoc(
|
||||
template<typename T>
|
||||
std::string PrintTypeDoc(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type*)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
|
||||
{
|
||||
return "An mlpack model pointer. This type can be pickled to or from disk, "
|
||||
"and internally holds a pointer to C++ memory containing the mlpack "
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace tests {
|
||||
template<typename T>
|
||||
void DeleteAllocatedMemoryImpl(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -30,7 +30,7 @@ void DeleteAllocatedMemoryImpl(
|
||||
template<typename T>
|
||||
void DeleteAllocatedMemoryImpl(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -38,8 +38,8 @@ void DeleteAllocatedMemoryImpl(
|
||||
template<typename T>
|
||||
void DeleteAllocatedMemoryImpl(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Delete the allocated memory (hopefully we actually own it).
|
||||
delete *boost::any_cast<T*>(&d.value);
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace tests {
|
||||
template<typename T>
|
||||
void* GetAllocatedMemory(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ void* GetAllocatedMemory(
|
||||
template<typename T>
|
||||
void* GetAllocatedMemory(
|
||||
util::ParamData& /* d */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -39,8 +39,8 @@ void* GetAllocatedMemory(
|
||||
template<typename T>
|
||||
void* GetAllocatedMemory(
|
||||
util::ParamData& d,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
|
||||
{
|
||||
// Here we have a model; return its memory location.
|
||||
return *boost::any_cast<T*>(&d.value);
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace tests {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print a vector option, with spaces between it.
|
||||
@@ -39,7 +39,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print a matrix option (this just prints the filename).
|
||||
@@ -47,7 +47,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0);
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print a serializable class option (this just prints the filename).
|
||||
@@ -55,8 +55,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print a mapped matrix option (this just prints the filename).
|
||||
@@ -64,8 +64,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
|
||||
|
||||
/**
|
||||
* Print an option into a std::string. This should print a short, one-line
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace tests {
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
|
||||
const typename boost::disable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<!std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << boost::any_cast<T>(data.value);
|
||||
@@ -37,7 +37,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
|
||||
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
|
||||
{
|
||||
const T& t = boost::any_cast<T>(data.value);
|
||||
|
||||
@@ -51,7 +51,7 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if<arma::is_arma_type<T>>::type* /* junk */)
|
||||
const typename std::enable_if<arma::is_arma_type<T>::value>::type* /* junk */)
|
||||
{
|
||||
return "matrix type";
|
||||
}
|
||||
@@ -60,8 +60,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& data,
|
||||
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
|
||||
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
|
||||
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
|
||||
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
|
||||
{
|
||||
// Extract the string from the tuple that's being held.
|
||||
std::ostringstream oss;
|
||||
@@ -73,8 +73,8 @@ std::string GetPrintableParam(
|
||||
template<typename T>
|
||||
std::string GetPrintableParam(
|
||||
util::ParamData& /* data */,
|
||||
const typename boost::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>>::type* /* junk */)
|
||||
const typename std::enable_if<std::is_same<T,
|
||||
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
|
||||
{
|
||||
return "matrix/DatatsetInfo tuple";
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ set(SOURCES
|
||||
recurrent_attention_impl.hpp
|
||||
reinforce_normal.hpp
|
||||
reinforce_normal_impl.hpp
|
||||
relu6.hpp
|
||||
relu6_impl.hpp
|
||||
reparametrization.hpp
|
||||
reparametrization_impl.hpp
|
||||
radial_basis_function.hpp
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "../visitor/delta_visitor.hpp"
|
||||
#include "../visitor/output_parameter_visitor.hpp"
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "layer_types.hpp"
|
||||
|
||||
namespace mlpack {
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include <mlpack/prereqs.hpp>
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "layer_types.hpp"
|
||||
|
||||
namespace mlpack {
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
#include <mlpack/prereqs.hpp>
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "../visitor/delete_visitor.hpp"
|
||||
#include "../visitor/delta_visitor.hpp"
|
||||
#include "../visitor/output_height_visitor.hpp"
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include "recurrent_attention.hpp"
|
||||
#include "recurrent.hpp"
|
||||
#include "reinforce_normal.hpp"
|
||||
#include "relu6.hpp"
|
||||
#include "reparametrization.hpp"
|
||||
#include "select.hpp"
|
||||
#include "sequential.hpp"
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <mlpack/methods/ann/layer/pixel_shuffle.hpp>
|
||||
#include <mlpack/methods/ann/layer/positional_encoding.hpp>
|
||||
#include <mlpack/methods/ann/layer/reinforce_normal.hpp>
|
||||
#include <mlpack/methods/ann/layer/relu6.hpp>
|
||||
#include <mlpack/methods/ann/layer/reparametrization.hpp>
|
||||
#include <mlpack/methods/ann/layer/select.hpp>
|
||||
#include <mlpack/methods/ann/layer/softmax.hpp>
|
||||
@@ -83,6 +84,7 @@ template<typename InputDataType, typename OutputDataType> class FastLSTM;
|
||||
template<typename InputDataType, typename OutputDataType> class VRClassReward;
|
||||
template<typename InputDataType, typename OutputDataType> class Concatenate;
|
||||
template<typename InputDataType, typename OutputDataType> class Padding;
|
||||
template<typename InputDataType, typename OutputDataType> class ReLU6;
|
||||
|
||||
template<typename InputDataType,
|
||||
typename OutputDataType,
|
||||
@@ -222,6 +224,7 @@ template <typename InputDataType,
|
||||
class AdaptiveMeanPooling;
|
||||
|
||||
using MoreTypes = boost::variant<
|
||||
FlexibleReLU<arma::mat, arma::mat>*,
|
||||
Linear3D<arma::mat, arma::mat, NoRegularizer>*,
|
||||
LpPooling<arma::mat, arma::mat>*,
|
||||
PixelShuffle<arma::mat, arma::mat>*,
|
||||
@@ -232,10 +235,10 @@ using MoreTypes = boost::variant<
|
||||
Recurrent<arma::mat, arma::mat>*,
|
||||
RecurrentAttention<arma::mat, arma::mat>*,
|
||||
ReinforceNormal<arma::mat, arma::mat>*,
|
||||
ReLU6<arma::mat, arma::mat>*,
|
||||
Reparametrization<arma::mat, arma::mat>*,
|
||||
Select<arma::mat, arma::mat>*,
|
||||
Sequential<arma::mat, arma::mat, false>*,
|
||||
Sequential<arma::mat, arma::mat, true>*,
|
||||
SpatialDropout<arma::mat, arma::mat>*,
|
||||
Subview<arma::mat, arma::mat>*,
|
||||
VRClassReward<arma::mat, arma::mat>*,
|
||||
VirtualBatchNorm<arma::mat, arma::mat>*,
|
||||
@@ -277,7 +280,6 @@ using LayerTypes = boost::variant<
|
||||
Dropout<arma::mat, arma::mat>*,
|
||||
ELU<arma::mat, arma::mat>*,
|
||||
FastLSTM<arma::mat, arma::mat>*,
|
||||
FlexibleReLU<arma::mat, arma::mat>*,
|
||||
GRU<arma::mat, arma::mat>*,
|
||||
HardTanH<arma::mat, arma::mat>*,
|
||||
Join<arma::mat, arma::mat>*,
|
||||
@@ -297,8 +299,9 @@ using LayerTypes = boost::variant<
|
||||
NoisyLinear<arma::mat, arma::mat>*,
|
||||
Padding<arma::mat, arma::mat>*,
|
||||
PReLU<arma::mat, arma::mat>*,
|
||||
Sequential<arma::mat, arma::mat, false>*,
|
||||
Sequential<arma::mat, arma::mat, true>*,
|
||||
Softmax<arma::mat, arma::mat>*,
|
||||
SpatialDropout<arma::mat, arma::mat>*,
|
||||
TransposedConvolution<NaiveConvolution<ValidConvolution>,
|
||||
NaiveConvolution<ValidConvolution>,
|
||||
NaiveConvolution<ValidConvolution>, arma::mat, arma::mat>*,
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define MLPACK_METHODS_ANN_LAYER_RECURRENT_ATTENTION_HPP
|
||||
|
||||
#include <mlpack/prereqs.hpp>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "../visitor/delta_visitor.hpp"
|
||||
#include "../visitor/output_parameter_visitor.hpp"
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @file methods/ann/layer/relu6.hpp
|
||||
* @author Aakash kaushik
|
||||
*
|
||||
* For more information, kindly refer to the following paper.
|
||||
*
|
||||
* @code
|
||||
* @article{Andrew G2017,
|
||||
* author = {Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko,
|
||||
* Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam},
|
||||
* title = {MobileNets: Efficient Convolutional Neural Networks for Mobile
|
||||
* Vision Applications},
|
||||
* year = {2017},
|
||||
* url = {https://arxiv.org/pdf/1704.04861}
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* mlpack is free software; you may redistribute it and/or modify it under the
|
||||
* terms of the 3-clause BSD license. You should have received a copy of the
|
||||
* 3-clause BSD license along with mlpack. If not, see
|
||||
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
||||
*/
|
||||
#ifndef MLPACK_METHODS_ANN_LAYER_RELU6_HPP
|
||||
#define MLPACK_METHODS_ANN_LAYER_RELU6_HPP
|
||||
|
||||
#include <mlpack/prereqs.hpp>
|
||||
|
||||
namespace mlpack {
|
||||
namespace ann /** Artificial Neural Network. */ {
|
||||
|
||||
/**
|
||||
* @tparam InputDataType Type of the input data (arma::colvec, arma::mat,
|
||||
* arma::sp_mat or arma::cube).
|
||||
* @tparam OutputDataType Type of the output data (arma::colvec, arma::mat,
|
||||
* arma::sp_mat or arma::cube).
|
||||
*/
|
||||
template<typename InputDataType = arma::mat,
|
||||
typename OutputDataType = arma::mat>
|
||||
class ReLU6
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Create the ReLU6 object.
|
||||
*/
|
||||
ReLU6();
|
||||
|
||||
/**
|
||||
* Ordinary feed forward pass of a neural network, evaluating the function
|
||||
* f(x) by propagating the activity forward through f.
|
||||
*
|
||||
* @param input Input data used for evaluating the specified function.
|
||||
* @param output Resulting output activation.
|
||||
*/
|
||||
template<typename InputType, typename OutputType>
|
||||
void Forward(const InputType& input, OutputType& output);
|
||||
|
||||
/**
|
||||
* Ordinary feed backward pass of a neural network, calculating the function
|
||||
* f(x) by propagating x backwards through f. Using the results from the feed
|
||||
* forward pass.
|
||||
*
|
||||
* @param input The propagated input activation.
|
||||
* @param gy The backpropagated error.
|
||||
* @param g The calculated gradient.
|
||||
*/
|
||||
template<typename DataType>
|
||||
void Backward(const DataType& input, const DataType& gy, DataType& g);
|
||||
|
||||
//! Get the output parameter.
|
||||
OutputDataType const& OutputParameter() const { return outputParameter; }
|
||||
//! Modify the output parameter.
|
||||
OutputDataType& OutputParameter() { return outputParameter; }
|
||||
|
||||
//! Get the delta.
|
||||
OutputDataType const& Delta() const { return delta; }
|
||||
//! Modify the delta.
|
||||
OutputDataType& Delta() { return delta; }
|
||||
|
||||
//! Get size of weights.
|
||||
size_t WeightSize() const { return 0; }
|
||||
|
||||
/**
|
||||
* Serialize the layer.
|
||||
*/
|
||||
template<typename Archive>
|
||||
void serialize(Archive& ar, const uint32_t /* version */);
|
||||
|
||||
private:
|
||||
//! Locally-stored output parameter object.
|
||||
OutputDataType outputParameter;
|
||||
|
||||
//! Locally-stored delta object.
|
||||
OutputDataType delta;
|
||||
}; // class ReLU6
|
||||
|
||||
} // namespace ann
|
||||
} // namespace mlpack
|
||||
|
||||
// Include implementation.
|
||||
#include "relu6_impl.hpp"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @file methods/ann/layer/relu6_impl.hpp
|
||||
* @author Aakash kaushik
|
||||
*
|
||||
* For more information, kindly refer to the following paper.
|
||||
*
|
||||
* @code
|
||||
* @article{Andrew G2017,
|
||||
* author = {Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko,
|
||||
* Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam},
|
||||
* title = {MobileNets: Efficient Convolutional Neural Networks for Mobile
|
||||
* Vision Applications},
|
||||
* year = {2017},
|
||||
* url = {https://arxiv.org/pdf/1704.04861}
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* mlpack is free software; you may redistribute it and/or modify it under the
|
||||
* terms of the 3-clause BSD license. You should have received a copy of the
|
||||
* 3-clause BSD license along with mlpack. If not, see
|
||||
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
||||
*/
|
||||
#ifndef MLPACK_METHODS_ANN_LAYER_RELU6_IMPL_HPP
|
||||
#define MLPACK_METHODS_ANN_LAYER_RELU6_IMPL_HPP
|
||||
|
||||
// In case it hasn't yet been included.
|
||||
#include "relu6.hpp"
|
||||
|
||||
namespace mlpack {
|
||||
namespace ann /** Artificial Neural Network. */ {
|
||||
|
||||
template<typename InputDataType, typename OutputDataType>
|
||||
ReLU6<InputDataType, OutputDataType>::ReLU6()
|
||||
{
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
template<typename InputDataType, typename OutputDataType>
|
||||
template<typename InputType, typename OutputType>
|
||||
void ReLU6<InputDataType, OutputDataType>::Forward(
|
||||
const InputType& input, OutputType& output)
|
||||
{
|
||||
OutputType outputTemp(arma::size(input));
|
||||
outputTemp.fill(6.0);
|
||||
output = arma::zeros<OutputType>(arma::size(input));
|
||||
output = arma::min(arma::max(output, input), outputTemp);
|
||||
}
|
||||
|
||||
template<typename InputDataType, typename OutputDataType>
|
||||
template<typename DataType>
|
||||
void ReLU6<InputDataType, OutputDataType>::Backward(
|
||||
const DataType& input, const DataType& gy, DataType& g)
|
||||
{
|
||||
DataType derivative(arma::size(gy));
|
||||
derivative.fill(0.0);
|
||||
for (size_t i = 0; i < input.n_elem; ++i)
|
||||
{
|
||||
if (input(i) < 6 && input(i) > 0)
|
||||
derivative(i) = 1.0;
|
||||
}
|
||||
|
||||
g = gy % derivative;
|
||||
}
|
||||
|
||||
template<typename InputDataType, typename OutputDataType>
|
||||
template<typename Archive>
|
||||
void ReLU6<InputDataType, OutputDataType>::serialize(
|
||||
Archive& ar,
|
||||
const uint32_t /* version */)
|
||||
{
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
} // namespace ann
|
||||
} // namespace mlpack
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
#include <mlpack/prereqs.hpp>
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "../visitor/delete_visitor.hpp"
|
||||
#include "../visitor/copy_visitor.hpp"
|
||||
#include "../visitor/delta_visitor.hpp"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <mlpack/methods/emst/union_find.hpp>
|
||||
#include "random_point_selection.hpp"
|
||||
#include "ordered_point_selection.hpp"
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
|
||||
namespace mlpack {
|
||||
namespace dbscan {
|
||||
|
||||
@@ -4,6 +4,8 @@ set(SOURCES
|
||||
all_dimension_select.hpp
|
||||
decision_tree.hpp
|
||||
decision_tree_impl.hpp
|
||||
decision_tree_regressor.hpp
|
||||
decision_tree_regressor_impl.hpp
|
||||
all_categorical_split.hpp
|
||||
all_categorical_split_impl.hpp
|
||||
best_binary_numeric_split.hpp
|
||||
|
||||
@@ -20,7 +20,9 @@ namespace tree {
|
||||
|
||||
/**
|
||||
* The AllCategoricalSplit is a splitting function that will split categorical
|
||||
* features into many children: one child for each category.
|
||||
* features into many children: one child for each category. This is a generic
|
||||
* splitting strategy and can be used for both regression and classification
|
||||
* trees.
|
||||
*
|
||||
* @tparam FitnessFunction Fitness function to evaluate gain with.
|
||||
*/
|
||||
@@ -34,9 +36,11 @@ class AllCategoricalSplit
|
||||
/**
|
||||
* Check if we can split a node. If we can split a node in a way that
|
||||
* improves on 'bestGain', then we return the improved gain. Otherwise we
|
||||
* return the value 'bestGain'. If a split is made, then classProbabilities
|
||||
* and aux may be modified. For this particular split type, aux will be empty
|
||||
* and classProbabilities will hold one element---the number of children.
|
||||
* return the value 'bestGain'. If a split is made, then splitInfo and
|
||||
* aux may be modified. For this particular split type, aux will be empty
|
||||
* and splitInfo will store the number of children of the node.
|
||||
*
|
||||
* This overload is used only for classification.
|
||||
*
|
||||
* @param bestGain Best gain seen so far (we'll only split if we find gain
|
||||
* better than this).
|
||||
@@ -47,45 +51,80 @@ class AllCategoricalSplit
|
||||
* @param weights Weights associated with labels.
|
||||
* @param minimumLeafSize Minimum number of points in a leaf node for
|
||||
* splitting.
|
||||
* @param classProbabilities Class probabilities vector, which may be filled
|
||||
* with split information a successful split.
|
||||
* @param splitInfo Stores split information on a successful split.
|
||||
* @param minimumGainSplit Minimum gain split.
|
||||
* @param aux Auxiliary split information, which may be modified on a
|
||||
* successful split.
|
||||
*/
|
||||
template<bool UseWeights, typename VecType, typename WeightVecType>
|
||||
template<bool UseWeights, typename VecType, typename LabelsType,
|
||||
typename WeightVecType>
|
||||
static double SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const size_t numCategories,
|
||||
const arma::Row<size_t>& labels,
|
||||
const LabelsType& labels,
|
||||
const size_t numClasses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
arma::vec& classProbabilities,
|
||||
arma::vec& splitInfo,
|
||||
AuxiliarySplitInfo& aux);
|
||||
|
||||
/**
|
||||
* Check if we can split a node. If we can split a node in a way that
|
||||
* improves on 'bestGain', then we return the improved gain. Otherwise we
|
||||
* return the value 'bestGain'. If a split is made, then splitInfo and
|
||||
* aux may be modified. For this particular split type, aux will be empty
|
||||
* and splitInfo will store the number of children of the node.
|
||||
*
|
||||
* This overload is used only for regression.
|
||||
*
|
||||
* @param bestGain Best gain seen so far (we'll only split if we find gain
|
||||
* better than this).
|
||||
* @param data The dimension of data points to check for a split in.
|
||||
* @param numCategories Number of categories in the categorical data.
|
||||
* @param responses Responses for each point.
|
||||
* @param weights Weights associated with responses.
|
||||
* @param minimumLeafSize Minimum number of points in a leaf node for
|
||||
* splitting.
|
||||
* @param splitInfo Stores split information on a successful split.
|
||||
* @param minimumGainSplit Minimum gain split.
|
||||
* @param aux Auxiliary split information, which may be modified on a
|
||||
* successful split.
|
||||
*/
|
||||
template<bool UseWeights, typename VecType, typename ResponsesType,
|
||||
typename WeightVecType>
|
||||
static double SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const size_t numCategories,
|
||||
const ResponsesType& responses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
double& splitInfo,
|
||||
AuxiliarySplitInfo& aux);
|
||||
|
||||
/**
|
||||
* Return the number of children in the split.
|
||||
*
|
||||
* @param classProbabilities Auxiliary information for the split.
|
||||
* @param splitInfo Auxiliary information for the split.
|
||||
* @param * (aux) Auxiliary information for the split (Unused).
|
||||
*/
|
||||
static size_t NumChildren(const arma::vec& classProbabilities,
|
||||
static size_t NumChildren(const double& splitInfo,
|
||||
const AuxiliarySplitInfo& /* aux */);
|
||||
|
||||
/**
|
||||
* Calculate the direction a point should percolate to.
|
||||
*
|
||||
* @param point the Point to use.
|
||||
* @param classProbabilities Column Vector of class probabilities.
|
||||
* @param splitInfo Auxiliary information for the split.
|
||||
* @param * (aux) Auxiliary information for the split (Unused).
|
||||
*/
|
||||
template<typename ElemType>
|
||||
static size_t CalculateDirection(
|
||||
const ElemType& point,
|
||||
const arma::vec& classProbabilities,
|
||||
const double& splitInfo,
|
||||
const AuxiliarySplitInfo& /* aux */);
|
||||
};
|
||||
|
||||
|
||||
@@ -15,25 +15,27 @@
|
||||
namespace mlpack {
|
||||
namespace tree {
|
||||
|
||||
// Overload used in classification.
|
||||
template<typename FitnessFunction>
|
||||
template<bool UseWeights, typename VecType, typename WeightVecType>
|
||||
template<bool UseWeights, typename VecType, typename LabelsType,
|
||||
typename WeightVecType>
|
||||
double AllCategoricalSplit<FitnessFunction>::SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const size_t numCategories,
|
||||
const arma::Row<size_t>& labels,
|
||||
const LabelsType& labels,
|
||||
const size_t numClasses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
arma::vec& classProbabilities,
|
||||
arma::vec& splitInfo,
|
||||
AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
// Count the number of elements in each potential child.
|
||||
const double epsilon = 1e-7; // Tolerance for floating-point errors.
|
||||
arma::Col<size_t> counts(numCategories, arma::fill::zeros);
|
||||
|
||||
// If we are using weighted training, learn the weights for each child too.
|
||||
// If we are using weighted training, split the weights for each child too.
|
||||
arma::vec childWeightSums;
|
||||
double sumWeight = 0.0;
|
||||
if (UseWeights)
|
||||
@@ -60,6 +62,7 @@ double AllCategoricalSplit<FitnessFunction>::SplitIfBetter(
|
||||
arma::uvec childPositions(numCategories, arma::fill::zeros);
|
||||
std::vector<arma::Row<size_t>> childLabels(numCategories);
|
||||
std::vector<arma::Row<double>> childWeights(numCategories);
|
||||
|
||||
for (size_t i = 0; i < numCategories; ++i)
|
||||
{
|
||||
// Labels and weights should have same length.
|
||||
@@ -99,9 +102,104 @@ double AllCategoricalSplit<FitnessFunction>::SplitIfBetter(
|
||||
|
||||
if (overallGain > bestGain + minimumGainSplit + epsilon)
|
||||
{
|
||||
// This is better, so set up the class probabilities vector and return.
|
||||
classProbabilities.set_size(1);
|
||||
classProbabilities[0] = numCategories;
|
||||
// This is better, so store it in splitInfo and return.
|
||||
splitInfo.set_size(1);
|
||||
splitInfo[0] = numCategories;
|
||||
return overallGain;
|
||||
}
|
||||
|
||||
// Otherwise there was no improvement.
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
// Overload used in regression.
|
||||
template<typename FitnessFunction>
|
||||
template<bool UseWeights, typename VecType, typename ResponsesType,
|
||||
typename WeightVecType>
|
||||
double AllCategoricalSplit<FitnessFunction>::SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const size_t numCategories,
|
||||
const ResponsesType& responses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
double& splitInfo,
|
||||
AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
// Count the number of elements in each potential child.
|
||||
const double epsilon = 1e-7; // Tolerance for floating-point errors.
|
||||
arma::Col<size_t> counts(numCategories, arma::fill::zeros);
|
||||
|
||||
// If we are using weighted training, split the weights for each child too.
|
||||
arma::vec childWeightSums;
|
||||
double sumWeight = 0.0;
|
||||
if (UseWeights)
|
||||
childWeightSums.zeros(numCategories);
|
||||
|
||||
for (size_t i = 0; i < data.n_elem; ++i)
|
||||
{
|
||||
counts[(size_t) data[i]]++;
|
||||
|
||||
if (UseWeights)
|
||||
{
|
||||
childWeightSums[(size_t) data[i]] += weights[i];
|
||||
sumWeight += weights[i];
|
||||
}
|
||||
}
|
||||
|
||||
// If each child will have the minimum number of points in it, we can split.
|
||||
// Otherwise we can't.
|
||||
if (arma::min(counts) < minimumLeafSize)
|
||||
return DBL_MAX;
|
||||
|
||||
// Calculate the gain of the split. First we have to calculate the labels
|
||||
// that would be assigned to each child.
|
||||
arma::uvec childPositions(numCategories, arma::fill::zeros);
|
||||
std::vector<arma::rowvec> childResponses(numCategories);
|
||||
std::vector<arma::rowvec> childWeights(numCategories);
|
||||
|
||||
for (size_t i = 0; i < numCategories; ++i)
|
||||
{
|
||||
// Responses and weights should have same length.
|
||||
childResponses[i].zeros(counts[i]);
|
||||
if (UseWeights)
|
||||
childWeights[i].zeros(counts[i]);
|
||||
}
|
||||
|
||||
// Extract labels for each child.
|
||||
for (size_t i = 0; i < data.n_elem; ++i)
|
||||
{
|
||||
const size_t category = (size_t) data[i];
|
||||
|
||||
if (UseWeights)
|
||||
{
|
||||
childResponses[category][childPositions[category]] = responses[i];
|
||||
childWeights[category][childPositions[category]++] = weights[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
childResponses[category][childPositions[category]++] = responses[i];
|
||||
}
|
||||
}
|
||||
|
||||
double overallGain = 0.0;
|
||||
for (size_t i = 0; i < counts.n_elem; ++i)
|
||||
{
|
||||
// Calculate the gain of this child.
|
||||
const double childPct = UseWeights ?
|
||||
double(childWeightSums[i]) / sumWeight :
|
||||
double(counts[i]) / double(data.n_elem);
|
||||
const double childGain = FitnessFunction::template Evaluate<UseWeights>(
|
||||
childResponses[i], childWeights[i]);
|
||||
|
||||
overallGain += childPct * childGain;
|
||||
}
|
||||
|
||||
if (overallGain > bestGain + minimumGainSplit + epsilon)
|
||||
{
|
||||
// This is better, so store it in splitInfo and return.
|
||||
splitInfo = numCategories;
|
||||
return overallGain;
|
||||
}
|
||||
|
||||
@@ -111,17 +209,17 @@ double AllCategoricalSplit<FitnessFunction>::SplitIfBetter(
|
||||
|
||||
template<typename FitnessFunction>
|
||||
size_t AllCategoricalSplit<FitnessFunction>::NumChildren(
|
||||
const arma::vec& classProbabilities,
|
||||
const double& splitInfo,
|
||||
const AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
return size_t(classProbabilities[0]);
|
||||
return (size_t) splitInfo;
|
||||
}
|
||||
|
||||
template<typename FitnessFunction>
|
||||
template<typename ElemType>
|
||||
size_t AllCategoricalSplit<FitnessFunction>::CalculateDirection(
|
||||
const ElemType& point,
|
||||
const arma::vec& /* classProbabilities */,
|
||||
const double& /* splitInfo */,
|
||||
const AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
return (size_t) point;
|
||||
|
||||
@@ -13,10 +13,32 @@
|
||||
#define MLPACK_METHODS_DECISION_TREE_BEST_BINARY_NUMERIC_SPLIT_HPP
|
||||
|
||||
#include <mlpack/prereqs.hpp>
|
||||
#include "mse_gain.hpp"
|
||||
|
||||
#include <mlpack/core/util/sfinae_utility.hpp>
|
||||
|
||||
namespace mlpack {
|
||||
namespace tree {
|
||||
|
||||
// This gives us a HasBinaryGains<T, U> type (where U is a function pointer)
|
||||
// we can use with SFINAE to catch when a type has a BinaryGains(...) function.
|
||||
HAS_MEM_FUNC(BinaryGains, HasBinaryGains);
|
||||
|
||||
// This struct will have `value` set to `true` if a BinaryGains() function of
|
||||
// the right signature is detected. We only check for BinaryGains(), and not
|
||||
// BinaryScanInitialize() or BinaryStep(), because those two are template
|
||||
// members functions and would make this check far more difficult.
|
||||
//
|
||||
// The unused UseWeights template parameter is necessary to ensure that the
|
||||
// compiler thinks the result `value` depends on a parameter specific to the
|
||||
// SplitIfBetter() function in BestBinaryNumericSplit().
|
||||
template<typename T, bool /* UseWeights */>
|
||||
struct HasOptimizedBinarySplitForms
|
||||
{
|
||||
const static bool value = HasBinaryGains<T,
|
||||
std::tuple<double, double>(T::*)()>::value;
|
||||
};
|
||||
|
||||
/**
|
||||
* The BestBinaryNumericSplit is a splitting function for decision trees that
|
||||
* will exhaustively search a numeric dimension for the best binary split.
|
||||
@@ -33,12 +55,10 @@ class BestBinaryNumericSplit
|
||||
/**
|
||||
* Check if we can split a node. If we can split a node in a way that
|
||||
* improves on 'bestGain', then we return the improved gain. Otherwise we
|
||||
* return the value 'bestGain'. If a split is made, then classProbabilities
|
||||
* and aux may be modified.
|
||||
* return the value 'bestGain'. If a split is made, then splitInfo and aux
|
||||
* may be modified.
|
||||
*
|
||||
* It's not necessary that `ElemType` is the same as the type of the data in
|
||||
* `VecType`---if they are different, casting will be done to store the
|
||||
* auxiliary information.
|
||||
* This overload is used only for classification tasks.
|
||||
*
|
||||
* @param bestGain Best gain seen so far (we'll only split if we find gain
|
||||
* better than this).
|
||||
@@ -49,8 +69,7 @@ class BestBinaryNumericSplit
|
||||
* @param minimumLeafSize Minimum number of points in a leaf node for
|
||||
* splitting.
|
||||
* @param minimumGainSplit Minimum gain split.
|
||||
* @param classProbabilities Class probabilities vector, which may be filled
|
||||
* with split information a successful split.
|
||||
* @param splitInfo Stores split information on a successful split.
|
||||
* @param aux Auxiliary split information, which may be modified on a
|
||||
* successful split.
|
||||
*/
|
||||
@@ -63,13 +82,84 @@ class BestBinaryNumericSplit
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
arma::vec& classProbabilities,
|
||||
arma::vec& splitInfo,
|
||||
AuxiliarySplitInfo& aux);
|
||||
|
||||
/**
|
||||
* Check if we can split a node. If we can split a node in a way that
|
||||
* improves on 'bestGain', then we return the improved gain. Otherwise we
|
||||
* return the value 'bestGain'. If a split is made, then splitInfo and aux
|
||||
* may be modified.
|
||||
*
|
||||
* This overload is used only for regression tasks.
|
||||
*
|
||||
* @param bestGain Best gain seen so far (we'll only split if we find gain
|
||||
* better than this).
|
||||
* @param data The dimension of data points to check for a split in.
|
||||
* @param responses Responses for each point.
|
||||
* @param weights Weights associated with responses.
|
||||
* @param minimumLeafSize Minimum number of points in a leaf node for
|
||||
* splitting.
|
||||
* @param minimumGainSplit Minimum gain split.
|
||||
* @param splitInfo Stores split information on a successful split.
|
||||
* @param aux Auxiliary split information, which may be modified on a
|
||||
* successful split.
|
||||
*/
|
||||
template<bool UseWeights, typename VecType, typename ResponsesType,
|
||||
typename WeightVecType>
|
||||
static typename std::enable_if<
|
||||
!HasOptimizedBinarySplitForms<FitnessFunction, UseWeights>::value,
|
||||
double>::type
|
||||
SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const ResponsesType& responses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
double& splitInfo,
|
||||
AuxiliarySplitInfo& aux);
|
||||
|
||||
/**
|
||||
* Check if we can split a node. If we can split a node in a way that
|
||||
* improves on 'bestGain', then we return the improved gain. Otherwise we
|
||||
* return the value 'bestGain'. If a split is made, then splitInfo and aux
|
||||
* may be modified.
|
||||
*
|
||||
* This overload is specialized for any fitness function that implements
|
||||
* BinaryScanInitialize(), BinaryStep() and BinaryGains() functions.
|
||||
*
|
||||
* @param bestGain Best gain seen so far (we'll only split if we find gain
|
||||
* better than this).
|
||||
* @param data The dimension of data points to check for a split in.
|
||||
* @param responses Responses for each point.
|
||||
* @param weights Weights associated with responses.
|
||||
* @param minimumLeafSize Minimum number of points in a leaf node for
|
||||
* splitting.
|
||||
* @param minimumGainSplit Minimum gain split.
|
||||
* @param splitInfo Stores split information on a successful split.
|
||||
* @param aux Auxiliary split information, which may be modified on a
|
||||
* successful split.
|
||||
*/
|
||||
template<bool UseWeights, typename VecType, typename ResponsesType,
|
||||
typename WeightVecType>
|
||||
static typename std::enable_if<
|
||||
HasOptimizedBinarySplitForms<FitnessFunction, UseWeights>::value,
|
||||
double>::type
|
||||
SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const ResponsesType& responses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
double& splitInfo,
|
||||
AuxiliarySplitInfo& /* aux */);
|
||||
|
||||
/**
|
||||
* Returns 2, since the binary split always has two children.
|
||||
*/
|
||||
static size_t NumChildren(const arma::vec& /* classProbabilities */,
|
||||
static size_t NumChildren(const double& /* splitInfo */,
|
||||
const AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
return 2;
|
||||
@@ -79,13 +169,13 @@ class BestBinaryNumericSplit
|
||||
* Given a point, calculate which child it should go to (left or right).
|
||||
*
|
||||
* @param point Point to calculate direction of.
|
||||
* @param classProbabilities Auxiliary information for the split.
|
||||
* @param splitInfo Auxiliary information for the split.
|
||||
* @param * (aux) Auxiliary information for the split (Unused).
|
||||
*/
|
||||
template<typename ElemType>
|
||||
static size_t CalculateDirection(
|
||||
const ElemType& point,
|
||||
const arma::vec& classProbabilities,
|
||||
const double& splitInfo,
|
||||
const AuxiliarySplitInfo& /* aux */);
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
namespace mlpack {
|
||||
namespace tree {
|
||||
|
||||
// Overload used for classification.
|
||||
template<typename FitnessFunction>
|
||||
template<bool UseWeights, typename VecType, typename WeightVecType>
|
||||
double BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
@@ -25,7 +26,7 @@ double BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
arma::vec& classProbabilities,
|
||||
arma::vec& splitInfo,
|
||||
AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
// First sanity check: if we don't have enough points, we can't split.
|
||||
@@ -151,12 +152,11 @@ double BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
// Corner case: is this the best possible split?
|
||||
if (gain >= 0.0)
|
||||
{
|
||||
// We can take a shortcut: no split will be better than this, so just take
|
||||
// this one.
|
||||
classProbabilities.set_size(1);
|
||||
// The actual split value will be halfway between the value at index - 1
|
||||
// and index.
|
||||
classProbabilities[0] = (data[sortedIndices[index - 1]] +
|
||||
// We can take a shortcut: no split will be better than this, so just
|
||||
// take this one. The actual split value will be halfway between the
|
||||
// value at index - 1 and index.
|
||||
splitInfo.set_size(1);
|
||||
splitInfo[0] = (data[sortedIndices[index - 1]] +
|
||||
data[sortedIndices[index]]) / 2.0;
|
||||
|
||||
return gain;
|
||||
@@ -165,8 +165,8 @@ double BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
{
|
||||
// We still have a better split.
|
||||
bestFoundGain = gain;
|
||||
classProbabilities.set_size(1);
|
||||
classProbabilities[0] = (data[sortedIndices[index - 1]] +
|
||||
splitInfo.set_size(1);
|
||||
splitInfo[0] = (data[sortedIndices[index - 1]] +
|
||||
data[sortedIndices[index]]) / 2.0;
|
||||
improved = true;
|
||||
}
|
||||
@@ -185,14 +185,298 @@ double BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
return bestFoundGain;
|
||||
}
|
||||
|
||||
// Overload used for regression.
|
||||
template<typename FitnessFunction>
|
||||
template<bool UseWeights, typename VecType, typename ResponsesType,
|
||||
typename WeightVecType>
|
||||
typename std::enable_if<
|
||||
!HasOptimizedBinarySplitForms<FitnessFunction, UseWeights>::value,
|
||||
double>::type
|
||||
BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const ResponsesType& responses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
double& splitInfo,
|
||||
AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
typedef typename ResponsesType::elem_type RType;
|
||||
typedef typename WeightVecType::elem_type WType;
|
||||
|
||||
// First sanity check: if we don't have enough points, we can't split.
|
||||
if (data.n_elem < (minimumLeafSize * 2))
|
||||
return DBL_MAX;
|
||||
if (bestGain == 0.0)
|
||||
return DBL_MAX; // It can't be outperformed.
|
||||
|
||||
// Next, sort the data.
|
||||
arma::uvec sortedIndices = arma::sort_index(data);
|
||||
arma::Row<RType> sortedResponses(responses.n_elem);
|
||||
arma::Row<WType> sortedWeights;
|
||||
for (size_t i = 0; i < sortedResponses.n_elem; ++i)
|
||||
sortedResponses[i] = responses[sortedIndices[i]];
|
||||
|
||||
// Sanity check: if the first element is the same as the last, we can't split
|
||||
// in this dimension.
|
||||
if (data[sortedIndices[0]] == data[sortedIndices[sortedIndices.n_elem - 1]])
|
||||
return DBL_MAX;
|
||||
|
||||
// Only initialize if we are using weights.
|
||||
if (UseWeights)
|
||||
{
|
||||
sortedWeights.set_size(sortedResponses.n_elem);
|
||||
// The weights must keep the same order as the responses.
|
||||
for (size_t i = 0; i < sortedResponses.n_elem; ++i)
|
||||
sortedWeights[i] = weights[sortedIndices[i]];
|
||||
}
|
||||
|
||||
double bestFoundGain = std::min(bestGain + minimumGainSplit, 0.0);
|
||||
bool improved = false;
|
||||
// Force a minimum leaf size of 1 (empty children don't make sense).
|
||||
const size_t minimum = std::max(minimumLeafSize, (size_t) 1);
|
||||
|
||||
WType totalWeight = 0.0;
|
||||
WType totalLeftWeight = 0.0;
|
||||
WType totalRightWeight = 0.0;
|
||||
|
||||
if (UseWeights)
|
||||
{
|
||||
totalWeight = arma::accu(sortedWeights);
|
||||
bestFoundGain *= totalWeight;
|
||||
|
||||
for (size_t i = 0; i < minimum - 1; ++i)
|
||||
totalLeftWeight += sortedWeights[i];
|
||||
|
||||
for (size_t i = minimum - 1; i < data.n_elem; ++i)
|
||||
totalRightWeight += sortedWeights[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
bestFoundGain *= data.n_elem;
|
||||
}
|
||||
|
||||
// Loop through all possible split points, choosing the best one.
|
||||
for (size_t index = minimum; index < data.n_elem - minimum + 1; ++index)
|
||||
{
|
||||
if (UseWeights)
|
||||
{
|
||||
totalLeftWeight += sortedWeights[index - 1];
|
||||
totalRightWeight -= sortedWeights[index - 1];
|
||||
}
|
||||
// Make sure that the value has changed.
|
||||
if (data[sortedIndices[index]] == data[sortedIndices[index - 1]])
|
||||
continue;
|
||||
|
||||
// Calculate the gain for the left and right child.
|
||||
const double leftGain = FitnessFunction::template
|
||||
Evaluate<UseWeights>(sortedResponses, sortedWeights, 0, index);
|
||||
const double rightGain = FitnessFunction::template
|
||||
Evaluate<UseWeights>(sortedResponses, sortedWeights, index,
|
||||
responses.n_elem);
|
||||
|
||||
double gain;
|
||||
if (UseWeights)
|
||||
{
|
||||
gain = totalLeftWeight * leftGain + totalRightWeight * rightGain;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate the gain at this split point.
|
||||
gain = double(index) * leftGain +
|
||||
double(sortedResponses.n_elem - index) * rightGain;
|
||||
}
|
||||
|
||||
// Corner case: is this the best possible split?
|
||||
if (gain >= 0.0)
|
||||
{
|
||||
// We can take a shortcut: no split will be better than this, so just
|
||||
// take this one. The actual split value will be halfway between the
|
||||
// value at index - 1 and index.
|
||||
splitInfo = (data[sortedIndices[index - 1]] +
|
||||
data[sortedIndices[index]]) / 2.0;
|
||||
|
||||
return gain;
|
||||
}
|
||||
if (gain > bestFoundGain)
|
||||
{
|
||||
// We still have a better split.
|
||||
bestFoundGain = gain;
|
||||
splitInfo = (data[sortedIndices[index - 1]] +
|
||||
data[sortedIndices[index]]) / 2.0;
|
||||
improved = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we didn't improve, return the original gain exactly as we got it
|
||||
// (without introducing floating point errors).
|
||||
if (!improved)
|
||||
return DBL_MAX;
|
||||
|
||||
if (UseWeights)
|
||||
bestFoundGain /= totalWeight;
|
||||
else
|
||||
bestFoundGain /= data.n_elem;
|
||||
|
||||
return bestFoundGain;
|
||||
}
|
||||
|
||||
// Optimized version for any fitness function that implements
|
||||
// BinaryScanInitialize(), BinaryStep() and BinaryGains() functions.
|
||||
template<typename FitnessFunction>
|
||||
template<bool UseWeights, typename VecType, typename ResponsesType,
|
||||
typename WeightVecType>
|
||||
typename std::enable_if<
|
||||
HasOptimizedBinarySplitForms<FitnessFunction, UseWeights>::value,
|
||||
double>::type
|
||||
BestBinaryNumericSplit<FitnessFunction>::SplitIfBetter(
|
||||
const double bestGain,
|
||||
const VecType& data,
|
||||
const ResponsesType& responses,
|
||||
const WeightVecType& weights,
|
||||
const size_t minimumLeafSize,
|
||||
const double minimumGainSplit,
|
||||
double& splitInfo,
|
||||
AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
typedef typename ResponsesType::elem_type RType;
|
||||
typedef typename WeightVecType::elem_type WType;
|
||||
|
||||
FitnessFunction fitnessFunction;
|
||||
|
||||
// First sanity check: if we don't have enough points, we can't split.
|
||||
if (data.n_elem < (minimumLeafSize * 2))
|
||||
return DBL_MAX;
|
||||
if (bestGain == 0.0)
|
||||
return DBL_MAX; // It can't be outperformed.
|
||||
|
||||
// Next, sort the data.
|
||||
arma::uvec sortedIndices = arma::sort_index(data);
|
||||
arma::Row<RType> sortedResponses(responses.n_elem);
|
||||
arma::Row<WType> sortedWeights;
|
||||
for (size_t i = 0; i < sortedResponses.n_elem; ++i)
|
||||
sortedResponses[i] = responses[sortedIndices[i]];
|
||||
|
||||
// Sanity check: if the first element is the same as the last, we can't split
|
||||
// in this dimension.
|
||||
if (data[sortedIndices[0]] == data[sortedIndices[sortedIndices.n_elem - 1]])
|
||||
return DBL_MAX;
|
||||
|
||||
// Only initialize if we are using weights.
|
||||
if (UseWeights)
|
||||
{
|
||||
sortedWeights.set_size(sortedResponses.n_elem);
|
||||
// The weights must keep the same order as the responses.
|
||||
for (size_t i = 0; i < sortedResponses.n_elem; ++i)
|
||||
sortedWeights[i] = weights[sortedIndices[i]];
|
||||
}
|
||||
|
||||
double bestFoundGain = std::min(bestGain + minimumGainSplit, 0.0);
|
||||
bool improved = false;
|
||||
// Force a minimum leaf size of 1 (empty children don't make sense).
|
||||
const size_t minimum = std::max(minimumLeafSize, (size_t) 1);
|
||||
|
||||
WType totalWeight = 0.0;
|
||||
WType leftChildWeight = 0.0;
|
||||
WType rightChildWeight = 0.0;
|
||||
|
||||
if (UseWeights)
|
||||
{
|
||||
totalWeight = arma::accu(sortedWeights);
|
||||
bestFoundGain *= totalWeight;
|
||||
|
||||
for (size_t i = 0; i < minimum - 1; ++i)
|
||||
leftChildWeight += sortedWeights[i];
|
||||
|
||||
for (size_t i = minimum - 1; i < data.n_elem; ++i)
|
||||
rightChildWeight += sortedWeights[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
bestFoundGain *= data.n_elem;
|
||||
}
|
||||
|
||||
// Initialize and precompute various statistics to efficiently compute gain
|
||||
// values for all possible splits.
|
||||
fitnessFunction.template BinaryScanInitialize<UseWeights>(sortedResponses,
|
||||
sortedWeights, minimum);
|
||||
|
||||
// Loop through all possible split points, choosing the best one.
|
||||
for (size_t index = minimum; index < data.n_elem - minimum + 1; ++index)
|
||||
{
|
||||
if (UseWeights)
|
||||
{
|
||||
leftChildWeight += sortedWeights[index - 1];
|
||||
rightChildWeight -= sortedWeights[index - 1];
|
||||
}
|
||||
|
||||
// Steps through the current index and updates the cached data.
|
||||
fitnessFunction.template BinaryStep<UseWeights>(sortedResponses,
|
||||
sortedWeights, index - 1);
|
||||
|
||||
// Make sure that the value has changed.
|
||||
if (data[sortedIndices[index]] == data[sortedIndices[index - 1]])
|
||||
continue;
|
||||
|
||||
// Calculate the gain for the left and right child.
|
||||
std::tuple<double, double> binaryGains = fitnessFunction.BinaryGains();
|
||||
const double leftGain = std::get<0>(binaryGains);
|
||||
const double rightGain = std::get<1>(binaryGains);
|
||||
|
||||
double gain;
|
||||
if (UseWeights)
|
||||
{
|
||||
gain = leftChildWeight * leftGain + rightChildWeight * rightGain;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate the gain at this split point.
|
||||
gain = double(index) * leftGain +
|
||||
double(sortedResponses.n_elem - index) * rightGain;
|
||||
}
|
||||
|
||||
// Corner case: is this the best possible split?
|
||||
if (gain >= 0.0)
|
||||
{
|
||||
// We can take a shortcut: no split will be better than this, so just
|
||||
// take this one. The actual split value will be halfway between the
|
||||
// value at index - 1 and index.
|
||||
splitInfo = (data[sortedIndices[index - 1]] +
|
||||
data[sortedIndices[index]]) / 2.0;
|
||||
|
||||
return gain;
|
||||
}
|
||||
if (gain > bestFoundGain)
|
||||
{
|
||||
// We still have a better split.
|
||||
bestFoundGain = gain;
|
||||
splitInfo = (data[sortedIndices[index - 1]] +
|
||||
data[sortedIndices[index]]) / 2.0;
|
||||
improved = true;
|
||||
}
|
||||
}
|
||||
// If we didn't improve, return the original gain exactly as we got it
|
||||
// (without introducing floating point errors).
|
||||
if (!improved)
|
||||
return DBL_MAX;
|
||||
|
||||
if (UseWeights)
|
||||
bestFoundGain /= totalWeight;
|
||||
else
|
||||
bestFoundGain /= data.n_elem;
|
||||
|
||||
return bestFoundGain;
|
||||
}
|
||||
|
||||
template<typename FitnessFunction>
|
||||
template<typename ElemType>
|
||||
size_t BestBinaryNumericSplit<FitnessFunction>::CalculateDirection(
|
||||
const ElemType& point,
|
||||
const arma::vec& classProbabilities,
|
||||
const double& splitInfo,
|
||||
const AuxiliarySplitInfo& /* aux */)
|
||||
{
|
||||
if (point <= classProbabilities[0])
|
||||
if (point <= splitInfo)
|
||||
return 0; // Go left.
|
||||
else
|
||||
return 1; // Go right.
|
||||
|
||||
@@ -31,11 +31,6 @@ namespace tree {
|
||||
*
|
||||
* The class inherits from the auxiliary split information in order to prevent
|
||||
* an empty auxiliary split information struct from taking any extra size.
|
||||
*
|
||||
* Note that `ElemType` is a template parameter controlling the type that is
|
||||
* used to store split information. In general, you would want to set this to
|
||||
* be the same as the type of the data that you will be using, but it's not
|
||||
* required to do that.
|
||||
*/
|
||||
template<typename FitnessFunction = GiniGain,
|
||||
template<typename> class NumericSplitType = BestBinaryNumericSplit,
|
||||
|
||||
@@ -690,9 +690,9 @@ double DecisionTree<FitnessFunction,
|
||||
// Get the number of children we will have.
|
||||
size_t numChildren = 0;
|
||||
if (datasetInfo.Type(bestDim) == data::Datatype::categorical)
|
||||
numChildren = CategoricalSplit::NumChildren(classProbabilities, *this);
|
||||
numChildren = CategoricalSplit::NumChildren(classProbabilities[0], *this);
|
||||
else
|
||||
numChildren = NumericSplit::NumChildren(classProbabilities, *this);
|
||||
numChildren = NumericSplit::NumChildren(classProbabilities[0], *this);
|
||||
|
||||
// Calculate all child assignments.
|
||||
arma::Row<size_t> childAssignments(count);
|
||||
@@ -700,14 +700,14 @@ double DecisionTree<FitnessFunction,
|
||||
{
|
||||
for (size_t j = begin; j < begin + count; ++j)
|
||||
childAssignments[j - begin] = CategoricalSplit::CalculateDirection(
|
||||
data(bestDim, j), classProbabilities, *this);
|
||||
data(bestDim, j), classProbabilities[0], *this);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t j = begin; j < begin + count; ++j)
|
||||
{
|
||||
childAssignments[j - begin] = NumericSplit::CalculateDirection(
|
||||
data(bestDim, j), classProbabilities, *this);
|
||||
data(bestDim, j), classProbabilities[0], *this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,7 +855,8 @@ double DecisionTree<FitnessFunction,
|
||||
if (bestDim != data.n_rows)
|
||||
{
|
||||
// We know that the split is numeric.
|
||||
size_t numChildren = NumericSplit::NumChildren(classProbabilities, *this);
|
||||
size_t numChildren =
|
||||
NumericSplit::NumChildren(classProbabilities[0], *this);
|
||||
splitDimension = bestDim;
|
||||
dimensionTypeOrMajorityClass = (size_t) data::Datatype::numeric;
|
||||
|
||||
@@ -865,7 +866,7 @@ double DecisionTree<FitnessFunction,
|
||||
for (size_t j = begin; j < begin + count; ++j)
|
||||
{
|
||||
childAssignments[j - begin] = NumericSplit::CalculateDirection(
|
||||
data(bestDim, j), classProbabilities, *this);
|
||||
data(bestDim, j), classProbabilities[0], *this);
|
||||
}
|
||||
|
||||
// Calculate counts of children in each node.
|
||||
@@ -1089,10 +1090,10 @@ size_t DecisionTree<FitnessFunction,
|
||||
if ((data::Datatype) dimensionTypeOrMajorityClass ==
|
||||
data::Datatype::categorical)
|
||||
return CategoricalSplit::CalculateDirection(point[splitDimension],
|
||||
classProbabilities, *this);
|
||||
classProbabilities[0], *this);
|
||||
else
|
||||
return NumericSplit::CalculateDirection(point[splitDimension],
|
||||
classProbabilities, *this);
|
||||
classProbabilities[0], *this);
|
||||
}
|
||||
|
||||
// Get the number of classes in the tree.
|
||||
@@ -1107,7 +1108,7 @@ size_t DecisionTree<FitnessFunction,
|
||||
DimensionSelectionType,
|
||||
NoRecursion>::NumClasses() const
|
||||
{
|
||||
// Recurse to the nearest child and return the number of elements in the
|
||||
// Recurse to the nearest leaf and return the number of elements in the
|
||||
// probability vector.
|
||||
if (children.size() == 0)
|
||||
return classProbabilities.n_elem;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user