mlpack 4.6.2__cp39-cp39-win_amd64.whl → 4.7.0__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. mlpack/__init__.py +6 -6
  2. mlpack/adaboost_classify.cp39-win_amd64.pyd +0 -0
  3. mlpack/adaboost_probabilities.cp39-win_amd64.pyd +0 -0
  4. mlpack/adaboost_train.cp39-win_amd64.pyd +0 -0
  5. mlpack/approx_kfn.cp39-win_amd64.pyd +0 -0
  6. mlpack/arma_numpy.cp39-win_amd64.pyd +0 -0
  7. mlpack/bayesian_linear_regression.cp39-win_amd64.pyd +0 -0
  8. mlpack/cf.cp39-win_amd64.pyd +0 -0
  9. mlpack/dbscan.cp39-win_amd64.pyd +0 -0
  10. mlpack/decision_tree.cp39-win_amd64.pyd +0 -0
  11. mlpack/det.cp39-win_amd64.pyd +0 -0
  12. mlpack/emst.cp39-win_amd64.pyd +0 -0
  13. mlpack/fastmks.cp39-win_amd64.pyd +0 -0
  14. mlpack/gmm_generate.cp39-win_amd64.pyd +0 -0
  15. mlpack/gmm_probability.cp39-win_amd64.pyd +0 -0
  16. mlpack/gmm_train.cp39-win_amd64.pyd +0 -0
  17. mlpack/hmm_generate.cp39-win_amd64.pyd +0 -0
  18. mlpack/hmm_loglik.cp39-win_amd64.pyd +0 -0
  19. mlpack/hmm_train.cp39-win_amd64.pyd +0 -0
  20. mlpack/hmm_viterbi.cp39-win_amd64.pyd +0 -0
  21. mlpack/hoeffding_tree.cp39-win_amd64.pyd +0 -0
  22. mlpack/image_converter.cp39-win_amd64.pyd +0 -0
  23. mlpack/include/mlpack/base.hpp +1 -0
  24. mlpack/include/mlpack/core/arma_extend/find_nan.hpp +63 -0
  25. mlpack/include/mlpack/core/cereal/low_precision.hpp +48 -0
  26. mlpack/include/mlpack/core/cv/cv_base.hpp +11 -11
  27. mlpack/include/mlpack/core/cv/cv_base_impl.hpp +7 -7
  28. mlpack/include/mlpack/core/cv/k_fold_cv.hpp +4 -4
  29. mlpack/include/mlpack/core/cv/k_fold_cv_impl.hpp +4 -4
  30. mlpack/include/mlpack/core/cv/meta_info_extractor.hpp +10 -10
  31. mlpack/include/mlpack/core/cv/metrics/f1_impl.hpp +1 -1
  32. mlpack/include/mlpack/core/cv/metrics/facilities.hpp +2 -1
  33. mlpack/include/mlpack/core/cv/metrics/precision_impl.hpp +1 -1
  34. mlpack/include/mlpack/core/cv/metrics/r2_score_impl.hpp +1 -1
  35. mlpack/include/mlpack/core/cv/metrics/silhouette_score_impl.hpp +1 -1
  36. mlpack/include/mlpack/core/cv/simple_cv.hpp +4 -4
  37. mlpack/include/mlpack/core/cv/simple_cv_impl.hpp +2 -2
  38. mlpack/include/mlpack/core/data/binarize.hpp +0 -2
  39. mlpack/include/mlpack/core/data/check_categorical_param.hpp +0 -2
  40. mlpack/include/mlpack/core/data/combine_options.hpp +151 -0
  41. mlpack/include/mlpack/core/data/confusion_matrix.hpp +0 -2
  42. mlpack/include/mlpack/core/data/confusion_matrix_impl.hpp +0 -2
  43. mlpack/include/mlpack/core/data/data.hpp +6 -4
  44. mlpack/include/mlpack/core/data/data_options.hpp +341 -18
  45. mlpack/include/mlpack/core/data/dataset_mapper.hpp +3 -5
  46. mlpack/include/mlpack/core/data/dataset_mapper_impl.hpp +0 -2
  47. mlpack/include/mlpack/core/data/detect_file_type.hpp +34 -5
  48. mlpack/include/mlpack/core/data/detect_file_type_impl.hpp +185 -11
  49. mlpack/include/mlpack/core/data/extension.hpp +2 -4
  50. mlpack/include/mlpack/core/data/font8x8_basic.h +152 -0
  51. mlpack/include/mlpack/core/data/has_serialize.hpp +0 -2
  52. mlpack/include/mlpack/core/data/image_bounding_box.hpp +36 -0
  53. mlpack/include/mlpack/core/data/image_bounding_box_impl.hpp +155 -0
  54. mlpack/include/mlpack/core/data/image_layout.hpp +63 -0
  55. mlpack/include/mlpack/core/data/image_layout_impl.hpp +75 -0
  56. mlpack/include/mlpack/core/data/image_letterbox.hpp +116 -0
  57. mlpack/include/mlpack/core/data/image_options.hpp +257 -0
  58. mlpack/include/mlpack/core/data/image_resize_crop.hpp +113 -48
  59. mlpack/include/mlpack/core/data/imputation_methods/custom_imputation.hpp +16 -32
  60. mlpack/include/mlpack/core/data/imputation_methods/listwise_deletion.hpp +19 -29
  61. mlpack/include/mlpack/core/data/imputation_methods/mean_imputation.hpp +113 -44
  62. mlpack/include/mlpack/core/data/imputation_methods/median_imputation.hpp +44 -43
  63. mlpack/include/mlpack/core/data/imputer.hpp +41 -49
  64. mlpack/include/mlpack/core/data/is_naninf.hpp +0 -2
  65. mlpack/include/mlpack/core/data/load.hpp +49 -233
  66. mlpack/include/mlpack/core/data/load_arff.hpp +0 -2
  67. mlpack/include/mlpack/core/data/load_arff_impl.hpp +2 -4
  68. mlpack/include/mlpack/core/data/load_categorical.hpp +1 -4
  69. mlpack/include/mlpack/core/data/load_categorical_impl.hpp +10 -26
  70. mlpack/include/mlpack/core/data/load_dense.hpp +279 -0
  71. mlpack/include/mlpack/core/data/load_deprecated.hpp +466 -0
  72. mlpack/include/mlpack/core/data/load_image.hpp +71 -43
  73. mlpack/include/mlpack/core/data/load_impl.hpp +95 -274
  74. mlpack/include/mlpack/core/data/load_model.hpp +62 -0
  75. mlpack/include/mlpack/core/data/load_numeric.hpp +124 -87
  76. mlpack/include/mlpack/core/data/load_sparse.hpp +91 -0
  77. mlpack/include/mlpack/core/data/map_policies/datatype.hpp +0 -2
  78. mlpack/include/mlpack/core/data/map_policies/increment_policy.hpp +0 -2
  79. mlpack/include/mlpack/core/data/map_policies/map_policies.hpp +0 -1
  80. mlpack/include/mlpack/core/data/matrix_options.hpp +152 -20
  81. mlpack/include/mlpack/core/data/normalize_labels.hpp +0 -2
  82. mlpack/include/mlpack/core/data/normalize_labels_impl.hpp +0 -2
  83. mlpack/include/mlpack/core/data/one_hot_encoding.hpp +2 -4
  84. mlpack/include/mlpack/core/data/one_hot_encoding_impl.hpp +3 -5
  85. mlpack/include/mlpack/core/data/save.hpp +26 -120
  86. mlpack/include/mlpack/core/data/save_dense.hpp +42 -0
  87. mlpack/include/mlpack/core/data/save_deprecated.hpp +308 -0
  88. mlpack/include/mlpack/core/data/save_image.hpp +82 -42
  89. mlpack/include/mlpack/core/data/save_impl.hpp +60 -245
  90. mlpack/include/mlpack/core/data/save_matrix.hpp +45 -0
  91. mlpack/include/mlpack/core/data/save_model.hpp +61 -0
  92. mlpack/include/mlpack/core/data/save_numeric.hpp +60 -0
  93. mlpack/include/mlpack/core/data/save_sparse.hpp +44 -0
  94. mlpack/include/mlpack/core/data/scaler_methods/max_abs_scaler.hpp +0 -2
  95. mlpack/include/mlpack/core/data/scaler_methods/mean_normalization.hpp +2 -4
  96. mlpack/include/mlpack/core/data/scaler_methods/min_max_scaler.hpp +0 -2
  97. mlpack/include/mlpack/core/data/scaler_methods/pca_whitening.hpp +1 -3
  98. mlpack/include/mlpack/core/data/scaler_methods/standard_scaler.hpp +2 -4
  99. mlpack/include/mlpack/core/data/scaler_methods/zca_whitening.hpp +0 -2
  100. mlpack/include/mlpack/core/data/split_data.hpp +6 -8
  101. mlpack/include/mlpack/core/data/string_algorithms.hpp +0 -2
  102. mlpack/include/mlpack/core/data/string_encoding.hpp +0 -2
  103. mlpack/include/mlpack/core/data/string_encoding_dictionary.hpp +0 -2
  104. mlpack/include/mlpack/core/data/string_encoding_impl.hpp +0 -2
  105. mlpack/include/mlpack/core/data/string_encoding_policies/bag_of_words_encoding_policy.hpp +0 -2
  106. mlpack/include/mlpack/core/data/string_encoding_policies/dictionary_encoding_policy.hpp +0 -2
  107. mlpack/include/mlpack/core/data/string_encoding_policies/policy_traits.hpp +0 -2
  108. mlpack/include/mlpack/core/data/string_encoding_policies/tf_idf_encoding_policy.hpp +0 -2
  109. mlpack/include/mlpack/core/data/text_options.hpp +91 -53
  110. mlpack/include/mlpack/core/data/tokenizers/char_extract.hpp +0 -2
  111. mlpack/include/mlpack/core/data/tokenizers/split_by_any_of.hpp +0 -2
  112. mlpack/include/mlpack/core/distributions/gamma_distribution_impl.hpp +4 -4
  113. mlpack/include/mlpack/core/distributions/laplace_distribution.hpp +9 -9
  114. mlpack/include/mlpack/core/distributions/laplace_distribution_impl.hpp +7 -7
  115. mlpack/include/mlpack/core/hpt/cv_function.hpp +2 -2
  116. mlpack/include/mlpack/core/hpt/cv_function_impl.hpp +2 -2
  117. mlpack/include/mlpack/core/hpt/hpt.hpp +4 -4
  118. mlpack/include/mlpack/core/hpt/hpt_impl.hpp +9 -9
  119. mlpack/include/mlpack/core/math/make_alias.hpp +7 -5
  120. mlpack/include/mlpack/core/math/random.hpp +19 -5
  121. mlpack/include/mlpack/core/math/shuffle_data.hpp +79 -245
  122. mlpack/include/mlpack/core/metrics/non_maximal_suppression_impl.hpp +9 -10
  123. mlpack/include/mlpack/core/stb/bundled/stb_image_resize2.h +291 -239
  124. mlpack/include/mlpack/core/tree/binary_space_tree/rp_tree_mean_split_impl.hpp +7 -7
  125. mlpack/include/mlpack/core/tree/cellbound.hpp +2 -2
  126. mlpack/include/mlpack/core/tree/cosine_tree/cosine_tree_impl.hpp +10 -10
  127. mlpack/include/mlpack/core/tree/octree/octree.hpp +10 -0
  128. mlpack/include/mlpack/core/tree/octree/octree_impl.hpp +14 -4
  129. mlpack/include/mlpack/core/util/arma_traits.hpp +25 -38
  130. mlpack/include/mlpack/core/util/coot_traits.hpp +97 -0
  131. mlpack/include/mlpack/core/util/forward.hpp +0 -2
  132. mlpack/include/mlpack/core/util/param.hpp +4 -4
  133. mlpack/include/mlpack/core/util/params_impl.hpp +2 -2
  134. mlpack/include/mlpack/core/util/using.hpp +29 -2
  135. mlpack/include/mlpack/core/util/version.hpp +5 -3
  136. mlpack/include/mlpack/core/util/version_impl.hpp +3 -6
  137. mlpack/include/mlpack/methods/adaboost/adaboost_classify_main.cpp +1 -1
  138. mlpack/include/mlpack/methods/adaboost/adaboost_main.cpp +3 -3
  139. mlpack/include/mlpack/methods/adaboost/adaboost_train_main.cpp +2 -2
  140. mlpack/include/mlpack/methods/ann/activation_functions/activation_functions.hpp +1 -0
  141. mlpack/include/mlpack/methods/ann/activation_functions/bipolar_sigmoid_function.hpp +6 -4
  142. mlpack/include/mlpack/methods/ann/activation_functions/elish_function.hpp +17 -12
  143. mlpack/include/mlpack/methods/ann/activation_functions/elliot_function.hpp +9 -7
  144. mlpack/include/mlpack/methods/ann/activation_functions/gaussian_function.hpp +7 -6
  145. mlpack/include/mlpack/methods/ann/activation_functions/gelu_exact_function.hpp +73 -0
  146. mlpack/include/mlpack/methods/ann/activation_functions/gelu_function.hpp +27 -16
  147. mlpack/include/mlpack/methods/ann/activation_functions/hard_sigmoid_function.hpp +8 -6
  148. mlpack/include/mlpack/methods/ann/activation_functions/hard_swish_function.hpp +6 -4
  149. mlpack/include/mlpack/methods/ann/activation_functions/hyper_sinh_function.hpp +13 -8
  150. mlpack/include/mlpack/methods/ann/activation_functions/identity_function.hpp +6 -4
  151. mlpack/include/mlpack/methods/ann/activation_functions/inverse_quadratic_function.hpp +8 -6
  152. mlpack/include/mlpack/methods/ann/activation_functions/lisht_function.hpp +7 -5
  153. mlpack/include/mlpack/methods/ann/activation_functions/logistic_function.hpp +14 -12
  154. mlpack/include/mlpack/methods/ann/activation_functions/mish_function.hpp +7 -5
  155. mlpack/include/mlpack/methods/ann/activation_functions/multi_quadratic_function.hpp +6 -4
  156. mlpack/include/mlpack/methods/ann/activation_functions/poisson1_function.hpp +4 -2
  157. mlpack/include/mlpack/methods/ann/activation_functions/quadratic_function.hpp +6 -4
  158. mlpack/include/mlpack/methods/ann/activation_functions/rectifier_function.hpp +10 -10
  159. mlpack/include/mlpack/methods/ann/activation_functions/silu_function.hpp +10 -8
  160. mlpack/include/mlpack/methods/ann/activation_functions/softplus_function.hpp +12 -9
  161. mlpack/include/mlpack/methods/ann/activation_functions/softsign_function.hpp +15 -23
  162. mlpack/include/mlpack/methods/ann/activation_functions/spline_function.hpp +9 -7
  163. mlpack/include/mlpack/methods/ann/activation_functions/swish_function.hpp +11 -9
  164. mlpack/include/mlpack/methods/ann/activation_functions/tanh_exponential_function.hpp +9 -7
  165. mlpack/include/mlpack/methods/ann/activation_functions/tanh_function.hpp +10 -7
  166. mlpack/include/mlpack/methods/ann/ann.hpp +3 -0
  167. mlpack/include/mlpack/methods/ann/convolution_rules/base_convolution.hpp +197 -0
  168. mlpack/include/mlpack/methods/ann/convolution_rules/convolution_rules.hpp +1 -2
  169. mlpack/include/mlpack/methods/ann/convolution_rules/im2col_convolution.hpp +215 -0
  170. mlpack/include/mlpack/methods/ann/convolution_rules/naive_convolution.hpp +109 -154
  171. mlpack/include/mlpack/methods/ann/dag_network.hpp +728 -0
  172. mlpack/include/mlpack/methods/ann/dag_network_impl.hpp +1640 -0
  173. mlpack/include/mlpack/methods/ann/dists/bernoulli_distribution_impl.hpp +1 -1
  174. mlpack/include/mlpack/methods/ann/dists/normal_distribution_impl.hpp +7 -2
  175. mlpack/include/mlpack/methods/ann/ffn.hpp +39 -3
  176. mlpack/include/mlpack/methods/ann/ffn_impl.hpp +14 -32
  177. mlpack/include/mlpack/methods/ann/init_rules/const_init.hpp +4 -4
  178. mlpack/include/mlpack/methods/ann/init_rules/gaussian_init.hpp +6 -2
  179. mlpack/include/mlpack/methods/ann/init_rules/he_init.hpp +4 -2
  180. mlpack/include/mlpack/methods/ann/init_rules/kathirvalavakumar_subavathi_init.hpp +3 -3
  181. mlpack/include/mlpack/methods/ann/init_rules/lecun_normal_init.hpp +4 -2
  182. mlpack/include/mlpack/methods/ann/init_rules/nguyen_widrow_init.hpp +2 -2
  183. mlpack/include/mlpack/methods/ann/init_rules/oivs_init.hpp +2 -2
  184. mlpack/include/mlpack/methods/ann/init_rules/orthogonal_init.hpp +2 -2
  185. mlpack/include/mlpack/methods/ann/init_rules/random_init.hpp +8 -4
  186. mlpack/include/mlpack/methods/ann/layer/adaptive_max_pooling.hpp +21 -23
  187. mlpack/include/mlpack/methods/ann/layer/adaptive_max_pooling_impl.hpp +15 -15
  188. mlpack/include/mlpack/methods/ann/layer/adaptive_mean_pooling.hpp +21 -23
  189. mlpack/include/mlpack/methods/ann/layer/adaptive_mean_pooling_impl.hpp +16 -16
  190. mlpack/include/mlpack/methods/ann/layer/add.hpp +18 -18
  191. mlpack/include/mlpack/methods/ann/layer/add_impl.hpp +13 -13
  192. mlpack/include/mlpack/methods/ann/layer/add_merge.hpp +19 -18
  193. mlpack/include/mlpack/methods/ann/layer/add_merge_impl.hpp +13 -13
  194. mlpack/include/mlpack/methods/ann/layer/alpha_dropout.hpp +17 -16
  195. mlpack/include/mlpack/methods/ann/layer/alpha_dropout_impl.hpp +14 -13
  196. mlpack/include/mlpack/methods/ann/layer/base_layer.hpp +28 -51
  197. mlpack/include/mlpack/methods/ann/layer/batch_norm.hpp +16 -18
  198. mlpack/include/mlpack/methods/ann/layer/batch_norm_impl.hpp +55 -54
  199. mlpack/include/mlpack/methods/ann/layer/c_relu.hpp +18 -20
  200. mlpack/include/mlpack/methods/ann/layer/c_relu_impl.hpp +20 -25
  201. mlpack/include/mlpack/methods/ann/layer/celu.hpp +14 -19
  202. mlpack/include/mlpack/methods/ann/layer/celu_impl.hpp +25 -34
  203. mlpack/include/mlpack/methods/ann/layer/concat.hpp +18 -18
  204. mlpack/include/mlpack/methods/ann/layer/concat_impl.hpp +13 -13
  205. mlpack/include/mlpack/methods/ann/layer/concatenate.hpp +18 -18
  206. mlpack/include/mlpack/methods/ann/layer/concatenate_impl.hpp +14 -14
  207. mlpack/include/mlpack/methods/ann/layer/convolution.hpp +42 -47
  208. mlpack/include/mlpack/methods/ann/layer/convolution_impl.hpp +170 -159
  209. mlpack/include/mlpack/methods/ann/layer/dropconnect.hpp +18 -20
  210. mlpack/include/mlpack/methods/ann/layer/dropconnect_impl.hpp +20 -20
  211. mlpack/include/mlpack/methods/ann/layer/dropout.hpp +17 -19
  212. mlpack/include/mlpack/methods/ann/layer/dropout_impl.hpp +14 -21
  213. mlpack/include/mlpack/methods/ann/layer/elu.hpp +23 -25
  214. mlpack/include/mlpack/methods/ann/layer/elu_impl.hpp +20 -27
  215. mlpack/include/mlpack/methods/ann/layer/embedding.hpp +160 -0
  216. mlpack/include/mlpack/methods/ann/layer/embedding_impl.hpp +189 -0
  217. mlpack/include/mlpack/methods/ann/layer/flexible_relu.hpp +17 -19
  218. mlpack/include/mlpack/methods/ann/layer/flexible_relu_impl.hpp +20 -20
  219. mlpack/include/mlpack/methods/ann/layer/ftswish.hpp +17 -18
  220. mlpack/include/mlpack/methods/ann/layer/ftswish_impl.hpp +17 -35
  221. mlpack/include/mlpack/methods/ann/layer/grouped_convolution.hpp +27 -33
  222. mlpack/include/mlpack/methods/ann/layer/grouped_convolution_impl.hpp +170 -163
  223. mlpack/include/mlpack/methods/ann/layer/gru.hpp +195 -0
  224. mlpack/include/mlpack/methods/ann/layer/gru_impl.hpp +325 -0
  225. mlpack/include/mlpack/methods/ann/layer/hard_tanh.hpp +13 -15
  226. mlpack/include/mlpack/methods/ann/layer/hard_tanh_impl.hpp +12 -12
  227. mlpack/include/mlpack/methods/ann/layer/identity.hpp +19 -20
  228. mlpack/include/mlpack/methods/ann/layer/identity_impl.hpp +12 -12
  229. mlpack/include/mlpack/methods/ann/layer/layer.hpp +37 -33
  230. mlpack/include/mlpack/methods/ann/layer/layer_norm.hpp +11 -13
  231. mlpack/include/mlpack/methods/ann/layer/layer_norm_impl.hpp +16 -16
  232. mlpack/include/mlpack/methods/ann/layer/layer_types.hpp +4 -1
  233. mlpack/include/mlpack/methods/ann/layer/leaky_relu.hpp +20 -23
  234. mlpack/include/mlpack/methods/ann/layer/leaky_relu_impl.hpp +12 -13
  235. mlpack/include/mlpack/methods/ann/layer/linear.hpp +16 -18
  236. mlpack/include/mlpack/methods/ann/layer/linear3d.hpp +18 -18
  237. mlpack/include/mlpack/methods/ann/layer/linear3d_impl.hpp +18 -18
  238. mlpack/include/mlpack/methods/ann/layer/linear_impl.hpp +15 -15
  239. mlpack/include/mlpack/methods/ann/layer/linear_no_bias.hpp +15 -17
  240. mlpack/include/mlpack/methods/ann/layer/linear_no_bias_impl.hpp +20 -20
  241. mlpack/include/mlpack/methods/ann/layer/linear_recurrent.hpp +25 -14
  242. mlpack/include/mlpack/methods/ann/layer/linear_recurrent_impl.hpp +60 -31
  243. mlpack/include/mlpack/methods/ann/layer/log_softmax.hpp +17 -36
  244. mlpack/include/mlpack/methods/ann/layer/log_softmax_impl.hpp +58 -74
  245. mlpack/include/mlpack/methods/ann/layer/lstm.hpp +26 -29
  246. mlpack/include/mlpack/methods/ann/layer/lstm_impl.hpp +128 -124
  247. mlpack/include/mlpack/methods/ann/layer/max_pooling.hpp +19 -19
  248. mlpack/include/mlpack/methods/ann/layer/max_pooling_impl.hpp +14 -14
  249. mlpack/include/mlpack/methods/ann/layer/mean_pooling.hpp +24 -24
  250. mlpack/include/mlpack/methods/ann/layer/mean_pooling_impl.hpp +16 -16
  251. mlpack/include/mlpack/methods/ann/layer/multi_layer.hpp +36 -6
  252. mlpack/include/mlpack/methods/ann/layer/multi_layer_impl.hpp +6 -2
  253. mlpack/include/mlpack/methods/ann/layer/multihead_attention.hpp +26 -22
  254. mlpack/include/mlpack/methods/ann/layer/multihead_attention_impl.hpp +161 -64
  255. mlpack/include/mlpack/methods/ann/layer/nearest_interpolation.hpp +28 -25
  256. mlpack/include/mlpack/methods/ann/layer/nearest_interpolation_impl.hpp +36 -37
  257. mlpack/include/mlpack/methods/ann/layer/noisylinear.hpp +39 -42
  258. mlpack/include/mlpack/methods/ann/layer/noisylinear_impl.hpp +18 -18
  259. mlpack/include/mlpack/methods/ann/layer/padding.hpp +21 -17
  260. mlpack/include/mlpack/methods/ann/layer/padding_impl.hpp +33 -19
  261. mlpack/include/mlpack/methods/ann/layer/parametric_relu.hpp +26 -28
  262. mlpack/include/mlpack/methods/ann/layer/parametric_relu_impl.hpp +18 -18
  263. mlpack/include/mlpack/methods/ann/layer/radial_basis_function.hpp +41 -28
  264. mlpack/include/mlpack/methods/ann/layer/radial_basis_function_impl.hpp +42 -17
  265. mlpack/include/mlpack/methods/ann/layer/recurrent_layer.hpp +13 -0
  266. mlpack/include/mlpack/methods/ann/layer/relu6.hpp +19 -21
  267. mlpack/include/mlpack/methods/ann/layer/relu6_impl.hpp +14 -14
  268. mlpack/include/mlpack/methods/ann/layer/repeat.hpp +24 -25
  269. mlpack/include/mlpack/methods/ann/layer/repeat_impl.hpp +10 -10
  270. mlpack/include/mlpack/methods/ann/layer/serialization.hpp +64 -54
  271. mlpack/include/mlpack/methods/ann/layer/softmax.hpp +20 -20
  272. mlpack/include/mlpack/methods/ann/layer/softmax_impl.hpp +10 -10
  273. mlpack/include/mlpack/methods/ann/layer/softmin.hpp +20 -23
  274. mlpack/include/mlpack/methods/ann/layer/softmin_impl.hpp +10 -10
  275. mlpack/include/mlpack/methods/ann/layer/sum_reduce.hpp +103 -0
  276. mlpack/include/mlpack/methods/ann/layer/sum_reduce_impl.hpp +143 -0
  277. mlpack/include/mlpack/methods/ann/loss_functions/cosine_embedding_loss_impl.hpp +3 -3
  278. mlpack/include/mlpack/methods/ann/loss_functions/mean_bias_error_impl.hpp +1 -1
  279. mlpack/include/mlpack/methods/ann/loss_functions/multilabel_softmargin_loss_impl.hpp +1 -1
  280. mlpack/include/mlpack/methods/ann/loss_functions/negative_log_likelihood.hpp +2 -2
  281. mlpack/include/mlpack/methods/ann/loss_functions/negative_log_likelihood_impl.hpp +29 -15
  282. mlpack/include/mlpack/methods/ann/loss_functions/poisson_nll_loss_impl.hpp +1 -1
  283. mlpack/include/mlpack/methods/ann/models/models.hpp +17 -0
  284. mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_layer.hpp +151 -0
  285. mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_layer_impl.hpp +265 -0
  286. mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_tiny.hpp +187 -0
  287. mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_tiny_impl.hpp +206 -0
  288. mlpack/include/mlpack/methods/ann/regularizer/orthogonal_regularizer_impl.hpp +5 -3
  289. mlpack/include/mlpack/methods/ann/rnn.hpp +136 -42
  290. mlpack/include/mlpack/methods/ann/rnn_impl.hpp +230 -38
  291. mlpack/include/mlpack/methods/approx_kfn/drusilla_select_impl.hpp +1 -1
  292. mlpack/include/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_main.cpp +1 -1
  293. mlpack/include/mlpack/methods/bias_svd/bias_svd_function_impl.hpp +1 -1
  294. mlpack/include/mlpack/methods/cf/cf_model.hpp +1 -1
  295. mlpack/include/mlpack/methods/decision_tree/decision_tree.hpp +6 -6
  296. mlpack/include/mlpack/methods/decision_tree/decision_tree_impl.hpp +12 -12
  297. mlpack/include/mlpack/methods/decision_tree/decision_tree_main.cpp +0 -1
  298. mlpack/include/mlpack/methods/decision_tree/decision_tree_regressor.hpp +6 -6
  299. mlpack/include/mlpack/methods/decision_tree/decision_tree_regressor_impl.hpp +12 -12
  300. mlpack/include/mlpack/methods/det/det_main.cpp +1 -1
  301. mlpack/include/mlpack/methods/hmm/hmm_train_main.cpp +4 -4
  302. mlpack/include/mlpack/methods/hmm/hmm_util_impl.hpp +2 -2
  303. mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree.hpp +6 -6
  304. mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_impl.hpp +31 -31
  305. mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp +1 -2
  306. mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_model.hpp +2 -2
  307. mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_model_impl.hpp +1 -1
  308. mlpack/include/mlpack/methods/kde/kde_rules_impl.hpp +6 -6
  309. mlpack/include/mlpack/methods/lars/lars_impl.hpp +3 -3
  310. mlpack/include/mlpack/methods/linear_svm/linear_svm_function_impl.hpp +4 -4
  311. mlpack/include/mlpack/methods/linear_svm/linear_svm_main.cpp +3 -3
  312. mlpack/include/mlpack/methods/lmnn/lmnn_main.cpp +1 -1
  313. mlpack/include/mlpack/methods/lsh/lsh_main.cpp +1 -1
  314. mlpack/include/mlpack/methods/matrix_completion/matrix_completion_impl.hpp +1 -1
  315. mlpack/include/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp +1 -1
  316. mlpack/include/mlpack/methods/naive_bayes/nbc_main.cpp +3 -3
  317. mlpack/include/mlpack/methods/nca/nca_main.cpp +1 -1
  318. mlpack/include/mlpack/methods/neighbor_search/kfn_main.cpp +8 -8
  319. mlpack/include/mlpack/methods/neighbor_search/knn_main.cpp +8 -8
  320. mlpack/include/mlpack/methods/neighbor_search/neighbor_search.hpp +154 -34
  321. mlpack/include/mlpack/methods/neighbor_search/neighbor_search_impl.hpp +190 -51
  322. mlpack/include/mlpack/methods/neighbor_search/neighbor_search_stat.hpp +10 -0
  323. mlpack/include/mlpack/methods/neighbor_search/ns_model.hpp +15 -15
  324. mlpack/include/mlpack/methods/neighbor_search/ns_model_impl.hpp +55 -46
  325. mlpack/include/mlpack/methods/neighbor_search/typedef.hpp +42 -2
  326. mlpack/include/mlpack/methods/pca/pca_impl.hpp +2 -2
  327. mlpack/include/mlpack/methods/perceptron/perceptron.hpp +2 -2
  328. mlpack/include/mlpack/methods/perceptron/perceptron_impl.hpp +1 -1
  329. mlpack/include/mlpack/methods/perceptron/perceptron_main.cpp +2 -2
  330. mlpack/include/mlpack/methods/preprocess/image_converter_main.cpp +2 -3
  331. mlpack/include/mlpack/methods/preprocess/preprocess_binarize_main.cpp +2 -2
  332. mlpack/include/mlpack/methods/preprocess/preprocess_describe_main.cpp +0 -1
  333. mlpack/include/mlpack/methods/preprocess/preprocess_imputer_main.cpp +50 -129
  334. mlpack/include/mlpack/methods/preprocess/preprocess_one_hot_encoding_main.cpp +6 -6
  335. mlpack/include/mlpack/methods/preprocess/preprocess_scale_main.cpp +2 -3
  336. mlpack/include/mlpack/methods/preprocess/preprocess_split_main.cpp +3 -4
  337. mlpack/include/mlpack/methods/preprocess/scaling_model.hpp +6 -8
  338. mlpack/include/mlpack/methods/preprocess/scaling_model_impl.hpp +18 -20
  339. mlpack/include/mlpack/methods/random_forest/random_forest.hpp +5 -5
  340. mlpack/include/mlpack/methods/random_forest/random_forest_impl.hpp +9 -9
  341. mlpack/include/mlpack/methods/range_search/range_search_main.cpp +1 -1
  342. mlpack/include/mlpack/methods/rann/krann_main.cpp +1 -1
  343. mlpack/include/mlpack/methods/regularized_svd/regularized_svd_function_impl.hpp +1 -1
  344. mlpack/include/mlpack/methods/reinforcement_learning/async_learning_impl.hpp +8 -8
  345. mlpack/include/mlpack/methods/reinforcement_learning/ddpg_impl.hpp +16 -16
  346. mlpack/include/mlpack/methods/reinforcement_learning/environment/acrobot.hpp +4 -4
  347. mlpack/include/mlpack/methods/reinforcement_learning/environment/cart_pole.hpp +3 -3
  348. mlpack/include/mlpack/methods/reinforcement_learning/environment/cont_double_pole_cart.hpp +6 -5
  349. mlpack/include/mlpack/methods/reinforcement_learning/environment/pendulum.hpp +6 -5
  350. mlpack/include/mlpack/methods/reinforcement_learning/policy/aggregated_policy.hpp +2 -2
  351. mlpack/include/mlpack/methods/reinforcement_learning/q_learning_impl.hpp +10 -10
  352. mlpack/include/mlpack/methods/reinforcement_learning/q_networks/categorical_dqn.hpp +21 -17
  353. mlpack/include/mlpack/methods/reinforcement_learning/q_networks/dueling_dqn.hpp +69 -77
  354. mlpack/include/mlpack/methods/reinforcement_learning/q_networks/simple_dqn.hpp +9 -9
  355. mlpack/include/mlpack/methods/reinforcement_learning/sac_impl.hpp +14 -14
  356. mlpack/include/mlpack/methods/reinforcement_learning/td3_impl.hpp +14 -14
  357. mlpack/include/mlpack/methods/softmax_regression/softmax_regression_function_impl.hpp +1 -1
  358. mlpack/include/mlpack/methods/svdplusplus/svdplusplus_function_impl.hpp +1 -1
  359. mlpack/include/mlpack/namespace_compat.hpp +1 -0
  360. mlpack/include/mlpack/prereqs.hpp +1 -0
  361. mlpack/kde.cp39-win_amd64.pyd +0 -0
  362. mlpack/kernel_pca.cp39-win_amd64.pyd +0 -0
  363. mlpack/kfn.cp39-win_amd64.pyd +0 -0
  364. mlpack/kmeans.cp39-win_amd64.pyd +0 -0
  365. mlpack/knn.cp39-win_amd64.pyd +0 -0
  366. mlpack/krann.cp39-win_amd64.pyd +0 -0
  367. mlpack/lars.cp39-win_amd64.pyd +0 -0
  368. mlpack/linear_regression_predict.cp39-win_amd64.pyd +0 -0
  369. mlpack/linear_regression_train.cp39-win_amd64.pyd +0 -0
  370. mlpack/linear_svm.cp39-win_amd64.pyd +0 -0
  371. mlpack/lmnn.cp39-win_amd64.pyd +0 -0
  372. mlpack/local_coordinate_coding.cp39-win_amd64.pyd +0 -0
  373. mlpack/logistic_regression.cp39-win_amd64.pyd +0 -0
  374. mlpack/lsh.cp39-win_amd64.pyd +0 -0
  375. mlpack/mean_shift.cp39-win_amd64.pyd +0 -0
  376. mlpack/nbc.cp39-win_amd64.pyd +0 -0
  377. mlpack/nca.cp39-win_amd64.pyd +0 -0
  378. mlpack/nmf.cp39-win_amd64.pyd +0 -0
  379. mlpack/pca.cp39-win_amd64.pyd +0 -0
  380. mlpack/perceptron.cp39-win_amd64.pyd +0 -0
  381. mlpack/preprocess_binarize.cp39-win_amd64.pyd +0 -0
  382. mlpack/preprocess_describe.cp39-win_amd64.pyd +0 -0
  383. mlpack/preprocess_one_hot_encoding.cp39-win_amd64.pyd +0 -0
  384. mlpack/preprocess_scale.cp39-win_amd64.pyd +0 -0
  385. mlpack/preprocess_split.cp39-win_amd64.pyd +0 -0
  386. mlpack/radical.cp39-win_amd64.pyd +0 -0
  387. mlpack/random_forest.cp39-win_amd64.pyd +0 -0
  388. mlpack/softmax_regression.cp39-win_amd64.pyd +0 -0
  389. mlpack/sparse_coding.cp39-win_amd64.pyd +0 -0
  390. mlpack-4.7.0.dist-info/DELVEWHEEL +2 -0
  391. {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/METADATA +2 -2
  392. {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/RECORD +397 -378
  393. {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/WHEEL +1 -1
  394. mlpack.libs/.load-order-mlpack-4.7.0 +2 -0
  395. mlpack/include/mlpack/core/data/format.hpp +0 -31
  396. mlpack/include/mlpack/core/data/image_info.hpp +0 -102
  397. mlpack/include/mlpack/core/data/image_info_impl.hpp +0 -84
  398. mlpack/include/mlpack/core/data/load_image_impl.hpp +0 -171
  399. mlpack/include/mlpack/core/data/load_model_impl.hpp +0 -115
  400. mlpack/include/mlpack/core/data/load_vec_impl.hpp +0 -154
  401. mlpack/include/mlpack/core/data/map_policies/missing_policy.hpp +0 -148
  402. mlpack/include/mlpack/core/data/save_image_impl.hpp +0 -170
  403. mlpack/include/mlpack/core/data/types.hpp +0 -61
  404. mlpack/include/mlpack/core/data/types_impl.hpp +0 -83
  405. mlpack/include/mlpack/core/data/utilities.hpp +0 -158
  406. mlpack/include/mlpack/core/util/gitversion.hpp +0 -1
  407. mlpack/include/mlpack/methods/ann/convolution_rules/fft_convolution.hpp +0 -213
  408. mlpack/include/mlpack/methods/ann/convolution_rules/svd_convolution.hpp +0 -201
  409. mlpack/include/mlpack/methods/ann/layer/not_adapted/gru.hpp +0 -226
  410. mlpack/include/mlpack/methods/ann/layer/not_adapted/gru_impl.hpp +0 -367
  411. mlpack/include/mlpack/methods/ann/layer/not_adapted/lookup.hpp +0 -139
  412. mlpack/include/mlpack/methods/ann/layer/not_adapted/lookup_impl.hpp +0 -98
  413. mlpack-4.6.2.dist-info/DELVEWHEEL +0 -2
  414. mlpack.libs/.load-order-mlpack-4.6.2 +0 -2
  415. {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/top_level.txt +0 -0
  416. /mlpack.libs/{libopenblas-9e6d070f769e6580e8c55c0cf83b80a5.dll → libopenblas-c7f521b507686ddc25bee7538a80c374.dll} +0 -0
  417. /mlpack.libs/{msvcp140-50208655e42969b9a5ab8a4e0186bbb9.dll → msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll} +0 -0
@@ -0,0 +1,151 @@
1
+ /**
2
+ * @file combine_options.hpp
3
+ * @author Ryan Curtin
4
+ * @author Omar Shrit
5
+ *
6
+ * Definition of operator+() for DataOptions types.
7
+ *
8
+ * mlpack is free software; you may redistribute it and/or modify it under the
9
+ * terms of the 3-clause BSD license. You should have received a copy of the
10
+ * 3-clause BSD license along with mlpack. If not, see
11
+ * http://www.opensource.org/licenses/BSD-3-Clause for more information.
12
+ */
13
+ #ifndef MLPACK_CORE_DATA_COMBINE_OPTIONS_HPP
14
+ #define MLPACK_CORE_DATA_COMBINE_OPTIONS_HPP
15
+
16
+ #include <mlpack/prereqs.hpp>
17
+
18
+ #include "data_options.hpp"
19
+ #include "matrix_options.hpp"
20
+ #include "text_options.hpp"
21
+
22
+ namespace mlpack {
23
+
24
+ // This template metaprogram encodes what the result of combining two different
25
+ // DataOptions types are. For now it exhaustively considers every possibility,
26
+ // but, in the future, perhaps it will be possible to come up with something
27
+ // that scales a little better.
28
+
29
+ template<typename DataOptionsType1, typename DataOptionsType2>
30
+ struct GetCombinedDataOptionsType
31
+ {
32
+ typedef void result; // unknown result
33
+ };
34
+
35
+ template<typename T>
36
+ struct MostDerivedType
37
+ {
38
+ typedef void result;
39
+ };
40
+
41
+ template<typename Derived>
42
+ struct MostDerivedType<DataOptionsBase<Derived>>
43
+ {
44
+ typedef Derived result;
45
+ };
46
+
47
+ template<>
48
+ struct MostDerivedType<DataOptionsBase<PlainDataOptions>>
49
+ {
50
+ typedef DataOptions result;
51
+ };
52
+
53
+ template<>
54
+ struct MostDerivedType<DataOptionsBase<MatrixOptionsBase<PlainMatrixOptions>>>
55
+ {
56
+ typedef MatrixOptions result;
57
+ };
58
+
59
+ template<>
60
+ struct MostDerivedType<DataOptionsBase<MatrixOptionsBase<TextOptions>>>
61
+ {
62
+ typedef TextOptions result;
63
+ };
64
+
65
+ // When both types are the same, we return that type.
66
+ template<typename Derived>
67
+ struct GetCombinedDataOptionsType<DataOptionsBase<Derived>,
68
+ DataOptionsBase<Derived>>
69
+ {
70
+ typedef typename MostDerivedType<DataOptionsBase<Derived>>::result result;
71
+ };
72
+
73
+ // When both types are different, the result is hardcoded.
74
+ template<>
75
+ struct GetCombinedDataOptionsType<DataOptionsBase<PlainDataOptions>,
76
+ DataOptionsBase<MatrixOptionsBase<PlainMatrixOptions>>>
77
+ {
78
+ typedef MatrixOptions result;
79
+ };
80
+
81
+ template<>
82
+ struct GetCombinedDataOptionsType<DataOptionsBase<
83
+ MatrixOptionsBase<PlainMatrixOptions>>,
84
+ DataOptionsBase<PlainDataOptions>>
85
+ {
86
+ typedef MatrixOptions result;
87
+ };
88
+
89
+ template<>
90
+ struct GetCombinedDataOptionsType<DataOptionsBase<
91
+ MatrixOptionsBase<TextOptions>>, DataOptionsBase<PlainDataOptions>>
92
+ {
93
+ typedef TextOptions result;
94
+ };
95
+
96
+ template<>
97
+ struct GetCombinedDataOptionsType<DataOptionsBase<PlainDataOptions>,
98
+ DataOptionsBase<MatrixOptionsBase<TextOptions>>>
99
+ {
100
+ typedef TextOptions result;
101
+ };
102
+
103
+ template<>
104
+ struct GetCombinedDataOptionsType<
105
+ DataOptionsBase<MatrixOptionsBase<PlainMatrixOptions>>,
106
+ DataOptionsBase<MatrixOptionsBase<TextOptions>>>
107
+ {
108
+ typedef TextOptions result;
109
+ };
110
+
111
+ template<>
112
+ struct GetCombinedDataOptionsType<
113
+ DataOptionsBase<MatrixOptionsBase<TextOptions>>,
114
+ DataOptionsBase<MatrixOptionsBase<PlainMatrixOptions>>>
115
+ {
116
+ typedef TextOptions result;
117
+ };
118
+
119
+ // Using the template metaprogram above, return a combined DataOptions.
120
+
121
+ template<typename Derived1, typename Derived2>
122
+ typename GetCombinedDataOptionsType<DataOptionsBase<Derived1>,
123
+ DataOptionsBase<Derived2>>::result
124
+ operator+(const DataOptionsBase<Derived1>& a,
125
+ const DataOptionsBase<Derived2>& b)
126
+ {
127
+ using ReturnType = typename GetCombinedDataOptionsType<
128
+ DataOptionsBase<Derived1>, DataOptionsBase<Derived2>>::result;
129
+
130
+ if (std::is_same_v<Derived1, Derived2>)
131
+ {
132
+ // This is the easy case! They are the same.
133
+ ReturnType output(a);
134
+ output += b;
135
+ return output;
136
+ }
137
+ else
138
+ {
139
+ // Here's the hard part, where the types are different.
140
+ // In this case, we can keep only the options from both sides that will be
141
+ // used in the result. If members of a or b can't be represented in
142
+ // ReturnType, then a warning will be printed.
143
+ ReturnType convertedA(a);
144
+ ReturnType convertedB(b);
145
+ return convertedA + convertedB;
146
+ }
147
+ }
148
+
149
+ } // namespace mlpack
150
+
151
+ #endif
@@ -16,7 +16,6 @@
16
16
  #include <mlpack/prereqs.hpp>
17
17
 
18
18
  namespace mlpack {
19
- namespace data {
20
19
 
21
20
  /**
22
21
  * A confusion matrix is a summary of prediction results on a classification
@@ -56,7 +55,6 @@ void ConfusionMatrix(const arma::Row<size_t> predictors,
56
55
  arma::Mat<eT>& output,
57
56
  const size_t numClasses);
58
57
 
59
- } // namespace data
60
58
  } // namespace mlpack
61
59
 
62
60
  // Include implementation.
@@ -17,7 +17,6 @@
17
17
  #include "confusion_matrix.hpp"
18
18
 
19
19
  namespace mlpack {
20
- namespace data {
21
20
 
22
21
  /**
23
22
  * A confusion matrix is a summary of prediction results on a classification
@@ -60,7 +59,6 @@ void ConfusionMatrix(const arma::Row<size_t> predictors,
60
59
  }
61
60
  }
62
61
 
63
- } // namespace data
64
62
  } // namespace mlpack
65
63
 
66
64
  #endif
@@ -13,7 +13,6 @@
13
13
  #define MLPACK_CORE_DATA_DATA_HPP
14
14
 
15
15
  #include "extension.hpp"
16
- #include "format.hpp"
17
16
  #include "has_serialize.hpp"
18
17
 
19
18
  #include "load.hpp"
@@ -31,8 +30,11 @@
31
30
  #include "dataset_mapper.hpp"
32
31
  #include "data_options.hpp"
33
32
  #include "detect_file_type.hpp"
34
- #include "image_info.hpp"
33
+ #include "image_layout.hpp"
34
+ #include "image_options.hpp"
35
35
  #include "image_resize_crop.hpp"
36
+ #include "image_letterbox.hpp"
37
+ #include "image_bounding_box.hpp"
36
38
  #include "imputer.hpp"
37
39
  #include "is_naninf.hpp"
38
40
  #include "matrix_options.hpp"
@@ -41,7 +43,7 @@
41
43
  #include "split_data.hpp"
42
44
  #include "string_algorithms.hpp"
43
45
  #include "text_options.hpp"
44
- #include "types.hpp"
45
- #include "utilities.hpp"
46
+
47
+ #include "combine_options.hpp"
46
48
 
47
49
  #endif
@@ -16,14 +16,54 @@
16
16
 
17
17
  #include <mlpack/prereqs.hpp>
18
18
 
19
- #include "types.hpp"
20
19
  #include "dataset_mapper.hpp"
21
20
  #include "map_policies/map_policies.hpp"
22
- #include "format.hpp"
23
- #include "image_info.hpp"
24
21
 
25
22
  namespace mlpack {
26
- namespace data {
23
+
24
+ enum struct FileType
25
+ {
26
+ FileTypeUnknown,
27
+ AutoDetect, // attempt to automatically detect the file type
28
+ RawASCII, // raw text (ASCII), without a header
29
+ ArmaASCII, // Armadillo text format, with a header specifying matrix type and
30
+ // size
31
+ CSVASCII, // comma separated values (CSV), without a header
32
+ RawBinary, // raw binary format (machine dependent), without a header
33
+ ArmaBinary, // Armadillo binary format (machine dependent), with a header
34
+ // specifying matrix type and size
35
+ PGMBinary, // Portable Grey Map (greyscale image)
36
+ PPMBinary, // Portable Pixel Map (colour image), used by the field and cube
37
+ // classes
38
+ HDF5Binary, // HDF5: open binary format, not specific to Armadillo, which can
39
+ // store arbitrary data
40
+ CoordASCII, // simple co-ordinate format for sparse matrices (indices start at
41
+ // zero)
42
+ ARFFASCII, // ARFF data format, with a header specifying information about
43
+ // categories of the data.
44
+ JSON, // Serialize data using Cereal library into JSON format.
45
+ XML, // Serialize data using Cereal library into xml format.
46
+ BIN, // Serialize data using Cereal library into binary format.
47
+ ImageType, // Any image type, STB will try to detect the type.
48
+ PNG, // Portable Network Graphics image type.
49
+ JPG, // Joint Photographic Experts Group image type.
50
+ TGA, // Truevision TGA image type.
51
+ BMP, // Bitmap image type.
52
+ PSD, // PhotoShop image type.
53
+ GIF, // Graphics Interchange Format image type.
54
+ PIC, // PICtor image format.
55
+ PNM // Portable Anymap format.
56
+ };
57
+
58
+ // This should be removed in mlpack 5.0.0. It is only here for backward
59
+ // compatibility.
60
+ enum format
61
+ {
62
+ autodetect,
63
+ json,
64
+ xml,
65
+ binary
66
+ };
27
67
 
28
68
  /**
29
69
  * All possible DataOptions grouped under one class.
@@ -34,15 +74,15 @@ namespace data {
34
74
  template<typename Derived>
35
75
  class DataOptionsBase
36
76
  {
37
- public:
38
- DataOptionsBase(const bool fatal = defaultFatal,
39
- const FileType format = defaultFormat) :
77
+ protected:
78
+ // Users should not construct a DataOptionsBase directly.
79
+ DataOptionsBase(const std::optional<bool> fatal = std::nullopt,
80
+ const std::optional<FileType> format = std::nullopt) :
40
81
  fatal(fatal),
41
82
  format(format)
42
- {
43
- // Do nothing.
44
- }
83
+ { }
45
84
 
85
+ public:
46
86
  template<typename Derived2>
47
87
  explicit DataOptionsBase(const DataOptionsBase<Derived2>& opts)
48
88
  {
@@ -77,7 +117,7 @@ class DataOptionsBase
77
117
  template<typename Derived2>
78
118
  DataOptionsBase& operator=(DataOptionsBase<Derived2>&& other)
79
119
  {
80
- if ((void*) &other != (void*) this)
120
+ if ((void*) &other == (void*) this)
81
121
  return *this;
82
122
 
83
123
  // Print warnings for any members that cannot be converted.
@@ -88,6 +128,63 @@ class DataOptionsBase
88
128
  return *this;
89
129
  }
90
130
 
131
+ // Augment with the options of the other `DataOptionsBase`.
132
+ template<typename Derived2>
133
+ DataOptionsBase& operator+=(const DataOptionsBase<Derived2>& other)
134
+ {
135
+ Combine(other);
136
+ return *this;
137
+ }
138
+
139
+ // Augment with the options of the other `DataOptionsBase`.
140
+ template<typename Derived2>
141
+ void Combine(const DataOptionsBase<Derived2>& other)
142
+ {
143
+ // Combine the fatal option.
144
+ fatal = CombineBooleanOption(fatal, other.fatal, "Fatal()");
145
+
146
+ // Combine the format option.
147
+ if (format.has_value() && other.format.has_value())
148
+ {
149
+ // There are two cases where we can accept the other's format---when we
150
+ // are unknown or autodetect.
151
+ if (format == FileType::FileTypeUnknown)
152
+ {
153
+ // Here we always take the other format.
154
+ format = other.format;
155
+ }
156
+ else if (format == FileType::AutoDetect && \
157
+ other.format != FileType::FileTypeUnknown)
158
+ {
159
+ format = other.format;
160
+ }
161
+ else if (other.format != FileType::FileTypeUnknown && \
162
+ other.format != FileType::AutoDetect &&
163
+ format != other.format)
164
+ {
165
+ // In any other case, we won't overwrite one specified format with
166
+ // another.
167
+ throw std::invalid_argument("DataOptions::operator+(): cannot combine "
168
+ "options with formats '" + FileTypeToString() + "' and '" +
169
+ other.FileTypeToString() + "'!");
170
+ }
171
+ }
172
+ else if (!format.has_value() && other.format.has_value())
173
+ {
174
+ // Always take the format of the other if it's unspecified.
175
+ format = other.format;
176
+ }
177
+
178
+ // If the derived type is the same, we can take any options from it.
179
+ if constexpr (std::is_same_v<Derived, Derived2>)
180
+ {
181
+ static_cast<Derived&>(*this).Combine(static_cast<const Derived2&>(other));
182
+ }
183
+
184
+ // If Derived is not the same as Derived2, we will have printed warnings in
185
+ // the standalone operator+().
186
+ }
187
+
91
188
  template<typename Derived2>
92
189
  void CopyOptions(const DataOptionsBase<Derived2>& other)
93
190
  {
@@ -127,6 +224,64 @@ class DataOptionsBase
127
224
  // Modify the file format to load.
128
225
  FileType& Format() { return ModifyMember(format, defaultFormat); }
129
226
 
227
+ /**
228
+ * Given a file type, return Armadillo type corresponding to that file type.
229
+ */
230
+ inline arma::file_type ArmaFormat() const
231
+ {
232
+ FileType f = format.has_value() ? *format : defaultFormat;
233
+ switch (f)
234
+ {
235
+ case FileType::FileTypeUnknown:
236
+ return arma::file_type_unknown;
237
+ break;
238
+
239
+ case FileType::AutoDetect:
240
+ return arma::auto_detect;
241
+ break;
242
+
243
+ case FileType::RawASCII:
244
+ return arma::raw_ascii;
245
+ break;
246
+
247
+ case FileType::ArmaASCII:
248
+ return arma::arma_ascii;
249
+ break;
250
+
251
+ case FileType::CSVASCII:
252
+ return arma::csv_ascii;
253
+ break;
254
+
255
+ case FileType::RawBinary:
256
+ return arma::raw_binary;
257
+ break;
258
+
259
+ case FileType::ArmaBinary:
260
+ return arma::arma_binary;
261
+ break;
262
+
263
+ case FileType::PGMBinary:
264
+ return arma::pgm_binary;
265
+ break;
266
+
267
+ case FileType::PPMBinary:
268
+ return arma::ppm_binary;
269
+ break;
270
+
271
+ case FileType::HDF5Binary:
272
+ return arma::hdf5_binary;
273
+ break;
274
+
275
+ case FileType::CoordASCII:
276
+ return arma::coord_ascii;
277
+ break;
278
+
279
+ default:
280
+ return arma::file_type_unknown;
281
+ break;
282
+ }
283
+ }
284
+
130
285
  /**
131
286
  * Given a file type, return a logical name corresponding to that file type.
132
287
  */
@@ -145,8 +300,21 @@ class DataOptionsBase
145
300
  case FileType::HDF5Binary: return "HDF5 data";
146
301
  case FileType::CoordASCII:
147
302
  return "ASCII formatted sparse coordinate data";
303
+ case FileType::ARFFASCII: return "ARFF data";
304
+ case FileType::XML: return "XML model";
305
+ case FileType::BIN: return "binary model";
306
+ case FileType::JSON: return "JSON model";
148
307
  case FileType::AutoDetect: return "Detect automatically data type";
149
308
  case FileType::FileTypeUnknown: return "Unknown data type";
309
+ case FileType::ImageType: return "Any Image type";
310
+ case FileType::PNG: return "Portable Network Graphics image data";
311
+ case FileType::JPG: return "JPEG image data";
312
+ case FileType::TGA: return "Truevision TGA image data";
313
+ case FileType::BMP: return "Bitmap image data";
314
+ case FileType::PSD: return "PhotoShop image data";
315
+ case FileType::GIF: return "GIF image data";
316
+ case FileType::PIC: return "PICtor image data";
317
+ case FileType::PNM: return "Portable Anymap data";
150
318
  default: return "";
151
319
  }
152
320
  }
@@ -187,33 +355,188 @@ class DataOptionsBase
187
355
  }
188
356
  }
189
357
 
358
+ std::optional<bool> CombineBooleanOption(const std::optional<bool>& a,
359
+ const std::optional<bool>& b,
360
+ const std::string name)
361
+ {
362
+ if (a.has_value() && b.has_value() && ((*a) != (*b)))
363
+ {
364
+ // If both are set, but not the same, then throw an exception---this is
365
+ // invalid.
366
+ throw std::invalid_argument("DataOptions::operator+(): cannot combine "
367
+ "options where " + name + " is set to true in one object and false "
368
+ "in the other!");
369
+ }
370
+ else if (!a.has_value() && b.has_value())
371
+ {
372
+ // If only b is set, take b.
373
+ return b;
374
+ }
375
+ else
376
+ {
377
+ // Otherwise, take a (whether or not it is set).
378
+ return a;
379
+ }
380
+ }
381
+
190
382
  private:
191
383
  std::optional<bool> fatal;
192
384
  std::optional<FileType> format;
193
385
 
194
386
  constexpr static const bool defaultFatal = false;
195
387
  constexpr static const FileType defaultFormat = FileType::AutoDetect;
196
-
197
388
  // For access to internal optional members.
198
389
  template<typename Derived2>
199
390
  friend class DataOptionsBase;
200
391
  };
201
392
 
202
- // This utility class is meant to be used as the Derived parameter for an option
203
- // that is not actually a derived type. It provides the WarnBaseConversion()
204
- // member, which does nothing.
205
- class EmptyOptions : public DataOptionsBase<EmptyOptions>
393
+ // This is the class that should be used if a DataOptions with no extra options
394
+ // is meant to be constructed.
395
+ class PlainDataOptions : public DataOptionsBase<PlainDataOptions>
206
396
  {
207
397
  public:
398
+ // Allow access to all DataOptionsBase non-protected constructors and
399
+ // operators, but with the PlainDataOptions type name.
400
+ using DataOptionsBase::DataOptionsBase;
401
+ using DataOptionsBase::operator=;
402
+
403
+ // However, C++ does not allow inheriting copy and move constructors or
404
+ // operators, and any inherited protected constructors will still be
405
+ // protected, so forward those manually.
406
+ PlainDataOptions(const std::optional<bool> fatal = std::nullopt,
407
+ const std::optional<FileType> format = std::nullopt) :
408
+ DataOptionsBase(fatal, format) { }
409
+ PlainDataOptions(const DataOptionsBase<PlainDataOptions>& other) :
410
+ DataOptionsBase(other) { }
411
+ PlainDataOptions(DataOptionsBase<PlainDataOptions>&& other) :
412
+ DataOptionsBase(std::move(other)) { }
413
+
414
+ PlainDataOptions& operator=(const DataOptionsBase<PlainDataOptions>& other)
415
+ {
416
+ return static_cast<PlainDataOptions&>(DataOptionsBase::operator=(other));
417
+ }
418
+
419
+ PlainDataOptions& operator=(DataOptionsBase<PlainDataOptions>&& other)
420
+ {
421
+ return static_cast<PlainDataOptions&>(
422
+ DataOptionsBase::operator=(std::move(other)));
423
+ }
424
+
208
425
  void WarnBaseConversion(const char* /* dataDescription */) const { }
209
426
  static const char* DataDescription() { return "general data"; }
210
427
  void Reset() { }
428
+ void Combine(const PlainDataOptions&) { }
429
+ };
430
+
431
+ using DataOptions = PlainDataOptions;
432
+
433
+ // Boolean options
434
+ static const DataOptions Fatal = DataOptions(true);
435
+ static const DataOptions NoFatal = DataOptions(false);
436
+
437
+ //! File options
438
+ static const DataOptions CSV = DataOptions(std::nullopt, FileType::CSVASCII);
439
+ static const DataOptions PGM = DataOptions(std::nullopt, FileType::PGMBinary);
440
+ static const DataOptions PPM = DataOptions(std::nullopt, FileType::PPMBinary);
441
+ static const DataOptions HDF5 = DataOptions(std::nullopt,
442
+ FileType::HDF5Binary);
443
+ static const DataOptions ArmaAscii = DataOptions(std::nullopt,
444
+ FileType::ArmaASCII);
445
+ static const DataOptions ArmaBin = DataOptions(std::nullopt,
446
+ FileType::ArmaBinary);
447
+ static const DataOptions RawAscii = DataOptions(std::nullopt,
448
+ FileType::RawASCII);
449
+ static const DataOptions BinAscii = DataOptions(std::nullopt,
450
+ FileType::RawBinary);
451
+ static const DataOptions CoordAscii = DataOptions(std::nullopt,
452
+ FileType::CoordASCII);
453
+ static const DataOptions ARFF = DataOptions(std::nullopt,
454
+ FileType::ARFFASCII);
455
+ static const DataOptions AutoDetect = DataOptions(std::nullopt,
456
+ FileType::AutoDetect);
457
+ static const DataOptions JSON = DataOptions(std::nullopt, FileType::JSON);
458
+ static const DataOptions XML = DataOptions(std::nullopt, FileType::XML);
459
+ static const DataOptions BIN = DataOptions(std::nullopt, FileType::BIN);
460
+ static const DataOptions PNG = DataOptions(std::nullopt, FileType::PNG);
461
+ static const DataOptions JPG = DataOptions(std::nullopt, FileType::JPG);
462
+ static const DataOptions TGA = DataOptions(std::nullopt, FileType::TGA);
463
+ static const DataOptions BMP = DataOptions(std::nullopt, FileType::BMP);
464
+ static const DataOptions PSD = DataOptions(std::nullopt, FileType::PSD);
465
+ static const DataOptions GIF = DataOptions(std::nullopt, FileType::GIF);
466
+ static const DataOptions PIC = DataOptions(std::nullopt, FileType::PIC);
467
+ static const DataOptions PNM = DataOptions(std::nullopt, FileType::PNM);
468
+ static const DataOptions Image = DataOptions(std::nullopt,
469
+ FileType::ImageType);
470
+
471
+ // Utility struct to detect when something is a `DataOptions`.
472
+
473
+ template<typename T>
474
+ struct IsDataOptions
475
+ {
476
+ constexpr static bool value = false;
477
+ };
478
+
479
+ template<typename T>
480
+ struct IsDataOptions<DataOptionsBase<T>>
481
+ {
482
+ constexpr static bool value = true;
211
483
  };
212
484
 
213
- using DataOptions = DataOptionsBase<EmptyOptions>;
485
+ template<>
486
+ struct IsDataOptions<DataOptions>
487
+ {
488
+ constexpr static bool value = true;
489
+ };
214
490
 
491
+ template<typename Derived>
492
+ bool HandleError(const std::stringstream& oss,
493
+ const DataOptionsBase<Derived>& opts)
494
+ {
495
+ bool success = true; // this should never be returned as true.
496
+ if (opts.Fatal())
497
+ {
498
+ Log::Fatal << oss.str() << std::endl;
499
+ }
500
+ else
501
+ {
502
+ Log::Warn << oss.str() << std::endl;
503
+ success = false;
504
+ }
505
+ return success;
506
+ }
507
+
508
+ template<typename Derived>
509
+ bool HandleError(const std::string& msg,
510
+ const DataOptionsBase<Derived>& opts)
511
+ {
512
+ std::stringstream oss;
513
+ oss << msg;
514
+ return HandleError(oss, opts);
515
+ }
516
+
517
+ // Required for backward compatibility.
518
+ inline bool HandleError(const std::stringstream& oss, bool fatal)
519
+ {
520
+ bool success = true; // this should never be returned as true.
521
+ if (fatal)
522
+ {
523
+ Log::Fatal << oss.str() << std::endl;
524
+ }
525
+ else
526
+ {
527
+ Log::Warn << oss.str() << std::endl;
528
+ success = false;
529
+ }
530
+ return success;
531
+ }
532
+
533
+ inline bool HandleError(const std::string& msg, bool fatal)
534
+ {
535
+ std::stringstream oss;
536
+ oss << msg;
537
+ return HandleError(oss, fatal);
538
+ }
215
539
 
216
- } // namespace data
217
540
  } // namespace mlpack
218
541
 
219
542
  #endif
@@ -21,12 +21,11 @@
21
21
  #include "map_policies/increment_policy.hpp"
22
22
 
23
23
  namespace mlpack {
24
- namespace data {
25
24
 
26
25
  /**
27
26
  * Auxiliary information for a dataset, including mappings to/from strings (or
28
27
  * other types) and the datatype of each dimension. DatasetMapper objects are
29
- * optionally produced by data::Load(), and store the type of each dimension
28
+ * optionally produced by Load(), and store the type of each dimension
30
29
  * (Datatype::numeric or Datatype::categorical) as well as mappings from strings
31
30
  * to unsigned integers and vice versa.
32
31
  *
@@ -142,7 +141,7 @@ class DatasetMapper
142
141
  /**
143
142
  * Get the dimensionality of the DatasetMapper object (that is, how many
144
143
  * dimensions it has information for). If this object was created by a call
145
- * to mlpack::data::Load(), then the dimensionality will be the same as the
144
+ * to mlpack::Load(), then the dimensionality will be the same as the
146
145
  * number of rows (dimensions) in the dataset.
147
146
  */
148
147
  size_t Dimensionality() const;
@@ -193,9 +192,8 @@ class DatasetMapper
193
192
  };
194
193
 
195
194
  // Use typedef to provide backward compatibility
196
- using DatasetInfo = DatasetMapper<data::IncrementPolicy>;
195
+ using DatasetInfo = DatasetMapper<IncrementPolicy>;
197
196
 
198
- } // namespace data
199
197
  } // namespace mlpack
200
198
 
201
199
  #include "dataset_mapper_impl.hpp"
@@ -17,7 +17,6 @@
17
17
  #include "dataset_mapper.hpp"
18
18
 
19
19
  namespace mlpack {
20
- namespace data {
21
20
 
22
21
  // Default constructor.
23
22
  template<typename PolicyType, typename InputType>
@@ -248,7 +247,6 @@ inline void DatasetMapper<PolicyType, InputType>::Policy(PolicyType&& policy)
248
247
  this->policy = std::forward<PolicyType>(policy);
249
248
  }
250
249
 
251
- } // namespace data
252
250
  } // namespace mlpack
253
251
 
254
252
  #endif