12 #ifndef MLPACK_CORE_CV_META_INFO_EXTRACTOR_HPP 13 #define MLPACK_CORE_CV_META_INFO_EXTRACTOR_HPP 15 #include <type_traits> 34 template<
typename MatType,
35 typename PredictionsType,
41 template<
typename PT,
typename WT,
typename... SignatureParams>
44 using PredictionsType = PT;
45 using WeightsType = WT;
50 template<
typename Class,
typename RT,
typename... Ts>
51 using Type = RT(Class::*)(SignatureParams..., Ts...);
54 template<
typename MT,
typename PT>
56 const MT&, const PT&> {};
58 template<
typename MT,
typename PT>
60 const MT&, const data::DatasetInfo&, const PT&> {};
62 template<
typename MT,
typename PT,
typename WT>
64 const MT&, const PT&, const WT&> {};
66 template<
typename MT,
typename PT,
typename WT>
68 const MT&, const data::DatasetInfo&, const PT&, const WT&> {};
70 template<
typename MT,
typename PT>
72 const MT&, const PT&, const size_t> {};
74 template<
typename MT,
typename PT>
76 const MT&, const data::DatasetInfo&, const PT&, const size_t> {};
78 template<
typename MT,
typename PT,
typename WT>
80 const MT&, const PT&, const size_t, const WT&> {};
82 template<
typename MT,
typename PT,
typename WT>
84 const MT&, const data::DatasetInfo&, const PT&, const size_t, const WT&> {};
89 using PredictionsType =
void*;
90 using WeightsType =
void*;
103 template<
typename MLAlgorithm,
104 template<
class,
template<
class...>
class,
size_t>
class... HMFs>
107 template<
typename MLAlgorithm,
108 template<
class,
template<
class...>
class,
size_t>
class HasMethodForm,
109 template<class, template<class...> class, size_t> class... HMFs>
112 template<
typename... Forms>
117 template<
typename... RemainingForms>
118 struct Implementation
121 using Type =
typename NextSMF::template From<Forms...>
::Type;
125 template<
typename Form,
typename... RemainingForms>
126 struct Implementation<Form, RemainingForms...>
128 using Type =
typename std::conditional<
129 HasMethodForm<MLAlgorithm, Form::template
Type,
130 Form::MinNumberOfAdditionalArgs>::value,
132 typename Implementation<RemainingForms...>
::Type>::type;
140 template<
typename MLAlgorithm>
143 template<
typename... Forms>
175 template<
typename MLAlgorithm,
176 typename MT = arma::mat,
177 typename PT = arma::Row<size_t>,
178 typename WT = arma::rowvec>
210 template<
typename... MethodForms>
212 HasMTrain, HasMPTrain, HasMPWTrain>::template From<MethodForms...>;
215 template<
typename... MFs >
216 using Selects =
typename std::conditional<
218 std::false_type, std::true_type>::type;
225 using PredictionsType =
226 typename Select<TF1, TF2, TF3, TF4, TF5>::Type::PredictionsType;
233 typename Select<WTF1, WTF2, WTF3, WTF4, WTF5>::Type::WeightsType;
239 static const bool IsSupported = !std::is_same<PredictionsType, void*>::value;
244 static const bool SupportsWeights = !std::is_same<WeightsType, void*>::value;
249 static const bool TakesDatasetInfo = Selects<TF5>::value;
254 static const bool TakesNumClasses = Selects<TF4, TF5>::value;
#define HAS_METHOD_FORM(METHOD, NAME)
HAS_METHOD_FORM generates a template that allows to check at compile time whether a given class has a...
DatasetMapper< data::IncrementPolicy > DatasetInfo
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...