mlpack 4.6.2__cp313-cp313-win_amd64.whl → 4.7.0__cp313-cp313-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.
- mlpack/__init__.py +4 -4
- mlpack/adaboost_classify.cp313-win_amd64.pyd +0 -0
- mlpack/adaboost_probabilities.cp313-win_amd64.pyd +0 -0
- mlpack/adaboost_train.cp313-win_amd64.pyd +0 -0
- mlpack/approx_kfn.cp313-win_amd64.pyd +0 -0
- mlpack/arma_numpy.cp313-win_amd64.pyd +0 -0
- mlpack/bayesian_linear_regression.cp313-win_amd64.pyd +0 -0
- mlpack/cf.cp313-win_amd64.pyd +0 -0
- mlpack/dbscan.cp313-win_amd64.pyd +0 -0
- mlpack/decision_tree.cp313-win_amd64.pyd +0 -0
- mlpack/det.cp313-win_amd64.pyd +0 -0
- mlpack/emst.cp313-win_amd64.pyd +0 -0
- mlpack/fastmks.cp313-win_amd64.pyd +0 -0
- mlpack/gmm_generate.cp313-win_amd64.pyd +0 -0
- mlpack/gmm_probability.cp313-win_amd64.pyd +0 -0
- mlpack/gmm_train.cp313-win_amd64.pyd +0 -0
- mlpack/hmm_generate.cp313-win_amd64.pyd +0 -0
- mlpack/hmm_loglik.cp313-win_amd64.pyd +0 -0
- mlpack/hmm_train.cp313-win_amd64.pyd +0 -0
- mlpack/hmm_viterbi.cp313-win_amd64.pyd +0 -0
- mlpack/hoeffding_tree.cp313-win_amd64.pyd +0 -0
- mlpack/image_converter.cp313-win_amd64.pyd +0 -0
- mlpack/include/mlpack/base.hpp +1 -0
- mlpack/include/mlpack/core/arma_extend/find_nan.hpp +63 -0
- mlpack/include/mlpack/core/cereal/low_precision.hpp +48 -0
- mlpack/include/mlpack/core/cv/cv_base.hpp +11 -11
- mlpack/include/mlpack/core/cv/cv_base_impl.hpp +7 -7
- mlpack/include/mlpack/core/cv/k_fold_cv.hpp +4 -4
- mlpack/include/mlpack/core/cv/k_fold_cv_impl.hpp +4 -4
- mlpack/include/mlpack/core/cv/meta_info_extractor.hpp +10 -10
- mlpack/include/mlpack/core/cv/metrics/f1_impl.hpp +1 -1
- mlpack/include/mlpack/core/cv/metrics/facilities.hpp +2 -1
- mlpack/include/mlpack/core/cv/metrics/precision_impl.hpp +1 -1
- mlpack/include/mlpack/core/cv/metrics/r2_score_impl.hpp +1 -1
- mlpack/include/mlpack/core/cv/metrics/silhouette_score_impl.hpp +1 -1
- mlpack/include/mlpack/core/cv/simple_cv.hpp +4 -4
- mlpack/include/mlpack/core/cv/simple_cv_impl.hpp +2 -2
- mlpack/include/mlpack/core/data/binarize.hpp +0 -2
- mlpack/include/mlpack/core/data/check_categorical_param.hpp +0 -2
- mlpack/include/mlpack/core/data/combine_options.hpp +151 -0
- mlpack/include/mlpack/core/data/confusion_matrix.hpp +0 -2
- mlpack/include/mlpack/core/data/confusion_matrix_impl.hpp +0 -2
- mlpack/include/mlpack/core/data/data.hpp +6 -4
- mlpack/include/mlpack/core/data/data_options.hpp +341 -18
- mlpack/include/mlpack/core/data/dataset_mapper.hpp +3 -5
- mlpack/include/mlpack/core/data/dataset_mapper_impl.hpp +0 -2
- mlpack/include/mlpack/core/data/detect_file_type.hpp +34 -5
- mlpack/include/mlpack/core/data/detect_file_type_impl.hpp +185 -11
- mlpack/include/mlpack/core/data/extension.hpp +2 -4
- mlpack/include/mlpack/core/data/font8x8_basic.h +152 -0
- mlpack/include/mlpack/core/data/has_serialize.hpp +0 -2
- mlpack/include/mlpack/core/data/image_bounding_box.hpp +36 -0
- mlpack/include/mlpack/core/data/image_bounding_box_impl.hpp +155 -0
- mlpack/include/mlpack/core/data/image_layout.hpp +63 -0
- mlpack/include/mlpack/core/data/image_layout_impl.hpp +75 -0
- mlpack/include/mlpack/core/data/image_letterbox.hpp +116 -0
- mlpack/include/mlpack/core/data/image_options.hpp +257 -0
- mlpack/include/mlpack/core/data/image_resize_crop.hpp +113 -48
- mlpack/include/mlpack/core/data/imputation_methods/custom_imputation.hpp +16 -32
- mlpack/include/mlpack/core/data/imputation_methods/listwise_deletion.hpp +19 -29
- mlpack/include/mlpack/core/data/imputation_methods/mean_imputation.hpp +113 -44
- mlpack/include/mlpack/core/data/imputation_methods/median_imputation.hpp +44 -43
- mlpack/include/mlpack/core/data/imputer.hpp +41 -49
- mlpack/include/mlpack/core/data/is_naninf.hpp +0 -2
- mlpack/include/mlpack/core/data/load.hpp +49 -233
- mlpack/include/mlpack/core/data/load_arff.hpp +0 -2
- mlpack/include/mlpack/core/data/load_arff_impl.hpp +2 -4
- mlpack/include/mlpack/core/data/load_categorical.hpp +1 -4
- mlpack/include/mlpack/core/data/load_categorical_impl.hpp +10 -26
- mlpack/include/mlpack/core/data/load_dense.hpp +279 -0
- mlpack/include/mlpack/core/data/load_deprecated.hpp +466 -0
- mlpack/include/mlpack/core/data/load_image.hpp +71 -43
- mlpack/include/mlpack/core/data/load_impl.hpp +95 -274
- mlpack/include/mlpack/core/data/load_model.hpp +62 -0
- mlpack/include/mlpack/core/data/load_numeric.hpp +124 -87
- mlpack/include/mlpack/core/data/load_sparse.hpp +91 -0
- mlpack/include/mlpack/core/data/map_policies/datatype.hpp +0 -2
- mlpack/include/mlpack/core/data/map_policies/increment_policy.hpp +0 -2
- mlpack/include/mlpack/core/data/map_policies/map_policies.hpp +0 -1
- mlpack/include/mlpack/core/data/matrix_options.hpp +152 -20
- mlpack/include/mlpack/core/data/normalize_labels.hpp +0 -2
- mlpack/include/mlpack/core/data/normalize_labels_impl.hpp +0 -2
- mlpack/include/mlpack/core/data/one_hot_encoding.hpp +2 -4
- mlpack/include/mlpack/core/data/one_hot_encoding_impl.hpp +3 -5
- mlpack/include/mlpack/core/data/save.hpp +26 -120
- mlpack/include/mlpack/core/data/save_dense.hpp +42 -0
- mlpack/include/mlpack/core/data/save_deprecated.hpp +308 -0
- mlpack/include/mlpack/core/data/save_image.hpp +82 -42
- mlpack/include/mlpack/core/data/save_impl.hpp +60 -245
- mlpack/include/mlpack/core/data/save_matrix.hpp +45 -0
- mlpack/include/mlpack/core/data/save_model.hpp +61 -0
- mlpack/include/mlpack/core/data/save_numeric.hpp +60 -0
- mlpack/include/mlpack/core/data/save_sparse.hpp +44 -0
- mlpack/include/mlpack/core/data/scaler_methods/max_abs_scaler.hpp +0 -2
- mlpack/include/mlpack/core/data/scaler_methods/mean_normalization.hpp +2 -4
- mlpack/include/mlpack/core/data/scaler_methods/min_max_scaler.hpp +0 -2
- mlpack/include/mlpack/core/data/scaler_methods/pca_whitening.hpp +1 -3
- mlpack/include/mlpack/core/data/scaler_methods/standard_scaler.hpp +2 -4
- mlpack/include/mlpack/core/data/scaler_methods/zca_whitening.hpp +0 -2
- mlpack/include/mlpack/core/data/split_data.hpp +6 -8
- mlpack/include/mlpack/core/data/string_algorithms.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding_dictionary.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding_impl.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding_policies/bag_of_words_encoding_policy.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding_policies/dictionary_encoding_policy.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding_policies/policy_traits.hpp +0 -2
- mlpack/include/mlpack/core/data/string_encoding_policies/tf_idf_encoding_policy.hpp +0 -2
- mlpack/include/mlpack/core/data/text_options.hpp +91 -53
- mlpack/include/mlpack/core/data/tokenizers/char_extract.hpp +0 -2
- mlpack/include/mlpack/core/data/tokenizers/split_by_any_of.hpp +0 -2
- mlpack/include/mlpack/core/distributions/gamma_distribution_impl.hpp +4 -4
- mlpack/include/mlpack/core/distributions/laplace_distribution.hpp +9 -9
- mlpack/include/mlpack/core/distributions/laplace_distribution_impl.hpp +7 -7
- mlpack/include/mlpack/core/hpt/cv_function.hpp +2 -2
- mlpack/include/mlpack/core/hpt/cv_function_impl.hpp +2 -2
- mlpack/include/mlpack/core/hpt/hpt.hpp +4 -4
- mlpack/include/mlpack/core/hpt/hpt_impl.hpp +9 -9
- mlpack/include/mlpack/core/math/make_alias.hpp +7 -5
- mlpack/include/mlpack/core/math/random.hpp +19 -5
- mlpack/include/mlpack/core/math/shuffle_data.hpp +79 -245
- mlpack/include/mlpack/core/metrics/non_maximal_suppression_impl.hpp +9 -10
- mlpack/include/mlpack/core/stb/bundled/stb_image_resize2.h +291 -239
- mlpack/include/mlpack/core/tree/binary_space_tree/rp_tree_mean_split_impl.hpp +7 -7
- mlpack/include/mlpack/core/tree/cellbound.hpp +2 -2
- mlpack/include/mlpack/core/tree/cosine_tree/cosine_tree_impl.hpp +10 -10
- mlpack/include/mlpack/core/tree/octree/octree.hpp +10 -0
- mlpack/include/mlpack/core/tree/octree/octree_impl.hpp +14 -4
- mlpack/include/mlpack/core/util/arma_traits.hpp +25 -38
- mlpack/include/mlpack/core/util/coot_traits.hpp +97 -0
- mlpack/include/mlpack/core/util/forward.hpp +0 -2
- mlpack/include/mlpack/core/util/param.hpp +4 -4
- mlpack/include/mlpack/core/util/params_impl.hpp +2 -2
- mlpack/include/mlpack/core/util/using.hpp +29 -2
- mlpack/include/mlpack/core/util/version.hpp +5 -3
- mlpack/include/mlpack/core/util/version_impl.hpp +3 -6
- mlpack/include/mlpack/methods/adaboost/adaboost_classify_main.cpp +1 -1
- mlpack/include/mlpack/methods/adaboost/adaboost_main.cpp +3 -3
- mlpack/include/mlpack/methods/adaboost/adaboost_train_main.cpp +2 -2
- mlpack/include/mlpack/methods/ann/activation_functions/activation_functions.hpp +1 -0
- mlpack/include/mlpack/methods/ann/activation_functions/bipolar_sigmoid_function.hpp +6 -4
- mlpack/include/mlpack/methods/ann/activation_functions/elish_function.hpp +17 -12
- mlpack/include/mlpack/methods/ann/activation_functions/elliot_function.hpp +9 -7
- mlpack/include/mlpack/methods/ann/activation_functions/gaussian_function.hpp +7 -6
- mlpack/include/mlpack/methods/ann/activation_functions/gelu_exact_function.hpp +73 -0
- mlpack/include/mlpack/methods/ann/activation_functions/gelu_function.hpp +27 -16
- mlpack/include/mlpack/methods/ann/activation_functions/hard_sigmoid_function.hpp +8 -6
- mlpack/include/mlpack/methods/ann/activation_functions/hard_swish_function.hpp +6 -4
- mlpack/include/mlpack/methods/ann/activation_functions/hyper_sinh_function.hpp +13 -8
- mlpack/include/mlpack/methods/ann/activation_functions/identity_function.hpp +6 -4
- mlpack/include/mlpack/methods/ann/activation_functions/inverse_quadratic_function.hpp +8 -6
- mlpack/include/mlpack/methods/ann/activation_functions/lisht_function.hpp +7 -5
- mlpack/include/mlpack/methods/ann/activation_functions/logistic_function.hpp +14 -12
- mlpack/include/mlpack/methods/ann/activation_functions/mish_function.hpp +7 -5
- mlpack/include/mlpack/methods/ann/activation_functions/multi_quadratic_function.hpp +6 -4
- mlpack/include/mlpack/methods/ann/activation_functions/poisson1_function.hpp +4 -2
- mlpack/include/mlpack/methods/ann/activation_functions/quadratic_function.hpp +6 -4
- mlpack/include/mlpack/methods/ann/activation_functions/rectifier_function.hpp +10 -10
- mlpack/include/mlpack/methods/ann/activation_functions/silu_function.hpp +10 -8
- mlpack/include/mlpack/methods/ann/activation_functions/softplus_function.hpp +12 -9
- mlpack/include/mlpack/methods/ann/activation_functions/softsign_function.hpp +15 -23
- mlpack/include/mlpack/methods/ann/activation_functions/spline_function.hpp +9 -7
- mlpack/include/mlpack/methods/ann/activation_functions/swish_function.hpp +11 -9
- mlpack/include/mlpack/methods/ann/activation_functions/tanh_exponential_function.hpp +9 -7
- mlpack/include/mlpack/methods/ann/activation_functions/tanh_function.hpp +10 -7
- mlpack/include/mlpack/methods/ann/ann.hpp +3 -0
- mlpack/include/mlpack/methods/ann/convolution_rules/base_convolution.hpp +197 -0
- mlpack/include/mlpack/methods/ann/convolution_rules/convolution_rules.hpp +1 -2
- mlpack/include/mlpack/methods/ann/convolution_rules/im2col_convolution.hpp +215 -0
- mlpack/include/mlpack/methods/ann/convolution_rules/naive_convolution.hpp +109 -154
- mlpack/include/mlpack/methods/ann/dag_network.hpp +728 -0
- mlpack/include/mlpack/methods/ann/dag_network_impl.hpp +1640 -0
- mlpack/include/mlpack/methods/ann/dists/bernoulli_distribution_impl.hpp +1 -1
- mlpack/include/mlpack/methods/ann/dists/normal_distribution_impl.hpp +7 -2
- mlpack/include/mlpack/methods/ann/ffn.hpp +39 -3
- mlpack/include/mlpack/methods/ann/ffn_impl.hpp +14 -32
- mlpack/include/mlpack/methods/ann/init_rules/const_init.hpp +4 -4
- mlpack/include/mlpack/methods/ann/init_rules/gaussian_init.hpp +6 -2
- mlpack/include/mlpack/methods/ann/init_rules/he_init.hpp +4 -2
- mlpack/include/mlpack/methods/ann/init_rules/kathirvalavakumar_subavathi_init.hpp +3 -3
- mlpack/include/mlpack/methods/ann/init_rules/lecun_normal_init.hpp +4 -2
- mlpack/include/mlpack/methods/ann/init_rules/nguyen_widrow_init.hpp +2 -2
- mlpack/include/mlpack/methods/ann/init_rules/oivs_init.hpp +2 -2
- mlpack/include/mlpack/methods/ann/init_rules/orthogonal_init.hpp +2 -2
- mlpack/include/mlpack/methods/ann/init_rules/random_init.hpp +8 -4
- mlpack/include/mlpack/methods/ann/layer/adaptive_max_pooling.hpp +21 -23
- mlpack/include/mlpack/methods/ann/layer/adaptive_max_pooling_impl.hpp +15 -15
- mlpack/include/mlpack/methods/ann/layer/adaptive_mean_pooling.hpp +21 -23
- mlpack/include/mlpack/methods/ann/layer/adaptive_mean_pooling_impl.hpp +16 -16
- mlpack/include/mlpack/methods/ann/layer/add.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/add_impl.hpp +13 -13
- mlpack/include/mlpack/methods/ann/layer/add_merge.hpp +19 -18
- mlpack/include/mlpack/methods/ann/layer/add_merge_impl.hpp +13 -13
- mlpack/include/mlpack/methods/ann/layer/alpha_dropout.hpp +17 -16
- mlpack/include/mlpack/methods/ann/layer/alpha_dropout_impl.hpp +14 -13
- mlpack/include/mlpack/methods/ann/layer/base_layer.hpp +28 -51
- mlpack/include/mlpack/methods/ann/layer/batch_norm.hpp +16 -18
- mlpack/include/mlpack/methods/ann/layer/batch_norm_impl.hpp +55 -54
- mlpack/include/mlpack/methods/ann/layer/c_relu.hpp +18 -20
- mlpack/include/mlpack/methods/ann/layer/c_relu_impl.hpp +20 -25
- mlpack/include/mlpack/methods/ann/layer/celu.hpp +14 -19
- mlpack/include/mlpack/methods/ann/layer/celu_impl.hpp +25 -34
- mlpack/include/mlpack/methods/ann/layer/concat.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/concat_impl.hpp +13 -13
- mlpack/include/mlpack/methods/ann/layer/concatenate.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/concatenate_impl.hpp +14 -14
- mlpack/include/mlpack/methods/ann/layer/convolution.hpp +42 -47
- mlpack/include/mlpack/methods/ann/layer/convolution_impl.hpp +170 -159
- mlpack/include/mlpack/methods/ann/layer/dropconnect.hpp +18 -20
- mlpack/include/mlpack/methods/ann/layer/dropconnect_impl.hpp +20 -20
- mlpack/include/mlpack/methods/ann/layer/dropout.hpp +17 -19
- mlpack/include/mlpack/methods/ann/layer/dropout_impl.hpp +14 -21
- mlpack/include/mlpack/methods/ann/layer/elu.hpp +23 -25
- mlpack/include/mlpack/methods/ann/layer/elu_impl.hpp +20 -27
- mlpack/include/mlpack/methods/ann/layer/embedding.hpp +160 -0
- mlpack/include/mlpack/methods/ann/layer/embedding_impl.hpp +189 -0
- mlpack/include/mlpack/methods/ann/layer/flexible_relu.hpp +17 -19
- mlpack/include/mlpack/methods/ann/layer/flexible_relu_impl.hpp +20 -20
- mlpack/include/mlpack/methods/ann/layer/ftswish.hpp +17 -18
- mlpack/include/mlpack/methods/ann/layer/ftswish_impl.hpp +17 -35
- mlpack/include/mlpack/methods/ann/layer/grouped_convolution.hpp +27 -33
- mlpack/include/mlpack/methods/ann/layer/grouped_convolution_impl.hpp +170 -163
- mlpack/include/mlpack/methods/ann/layer/gru.hpp +195 -0
- mlpack/include/mlpack/methods/ann/layer/gru_impl.hpp +325 -0
- mlpack/include/mlpack/methods/ann/layer/hard_tanh.hpp +13 -15
- mlpack/include/mlpack/methods/ann/layer/hard_tanh_impl.hpp +12 -12
- mlpack/include/mlpack/methods/ann/layer/identity.hpp +19 -20
- mlpack/include/mlpack/methods/ann/layer/identity_impl.hpp +12 -12
- mlpack/include/mlpack/methods/ann/layer/layer.hpp +37 -33
- mlpack/include/mlpack/methods/ann/layer/layer_norm.hpp +11 -13
- mlpack/include/mlpack/methods/ann/layer/layer_norm_impl.hpp +16 -16
- mlpack/include/mlpack/methods/ann/layer/layer_types.hpp +4 -1
- mlpack/include/mlpack/methods/ann/layer/leaky_relu.hpp +20 -23
- mlpack/include/mlpack/methods/ann/layer/leaky_relu_impl.hpp +12 -13
- mlpack/include/mlpack/methods/ann/layer/linear.hpp +16 -18
- mlpack/include/mlpack/methods/ann/layer/linear3d.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/linear3d_impl.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/linear_impl.hpp +15 -15
- mlpack/include/mlpack/methods/ann/layer/linear_no_bias.hpp +15 -17
- mlpack/include/mlpack/methods/ann/layer/linear_no_bias_impl.hpp +20 -20
- mlpack/include/mlpack/methods/ann/layer/linear_recurrent.hpp +25 -14
- mlpack/include/mlpack/methods/ann/layer/linear_recurrent_impl.hpp +60 -31
- mlpack/include/mlpack/methods/ann/layer/log_softmax.hpp +17 -36
- mlpack/include/mlpack/methods/ann/layer/log_softmax_impl.hpp +58 -74
- mlpack/include/mlpack/methods/ann/layer/lstm.hpp +26 -29
- mlpack/include/mlpack/methods/ann/layer/lstm_impl.hpp +128 -124
- mlpack/include/mlpack/methods/ann/layer/max_pooling.hpp +19 -19
- mlpack/include/mlpack/methods/ann/layer/max_pooling_impl.hpp +14 -14
- mlpack/include/mlpack/methods/ann/layer/mean_pooling.hpp +24 -24
- mlpack/include/mlpack/methods/ann/layer/mean_pooling_impl.hpp +16 -16
- mlpack/include/mlpack/methods/ann/layer/multi_layer.hpp +36 -6
- mlpack/include/mlpack/methods/ann/layer/multi_layer_impl.hpp +6 -2
- mlpack/include/mlpack/methods/ann/layer/multihead_attention.hpp +26 -22
- mlpack/include/mlpack/methods/ann/layer/multihead_attention_impl.hpp +161 -64
- mlpack/include/mlpack/methods/ann/layer/nearest_interpolation.hpp +28 -25
- mlpack/include/mlpack/methods/ann/layer/nearest_interpolation_impl.hpp +36 -37
- mlpack/include/mlpack/methods/ann/layer/noisylinear.hpp +39 -42
- mlpack/include/mlpack/methods/ann/layer/noisylinear_impl.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/padding.hpp +21 -17
- mlpack/include/mlpack/methods/ann/layer/padding_impl.hpp +33 -19
- mlpack/include/mlpack/methods/ann/layer/parametric_relu.hpp +26 -28
- mlpack/include/mlpack/methods/ann/layer/parametric_relu_impl.hpp +18 -18
- mlpack/include/mlpack/methods/ann/layer/radial_basis_function.hpp +41 -28
- mlpack/include/mlpack/methods/ann/layer/radial_basis_function_impl.hpp +42 -17
- mlpack/include/mlpack/methods/ann/layer/recurrent_layer.hpp +13 -0
- mlpack/include/mlpack/methods/ann/layer/relu6.hpp +19 -21
- mlpack/include/mlpack/methods/ann/layer/relu6_impl.hpp +14 -14
- mlpack/include/mlpack/methods/ann/layer/repeat.hpp +24 -25
- mlpack/include/mlpack/methods/ann/layer/repeat_impl.hpp +10 -10
- mlpack/include/mlpack/methods/ann/layer/serialization.hpp +64 -54
- mlpack/include/mlpack/methods/ann/layer/softmax.hpp +20 -20
- mlpack/include/mlpack/methods/ann/layer/softmax_impl.hpp +10 -10
- mlpack/include/mlpack/methods/ann/layer/softmin.hpp +20 -23
- mlpack/include/mlpack/methods/ann/layer/softmin_impl.hpp +10 -10
- mlpack/include/mlpack/methods/ann/layer/sum_reduce.hpp +103 -0
- mlpack/include/mlpack/methods/ann/layer/sum_reduce_impl.hpp +143 -0
- mlpack/include/mlpack/methods/ann/loss_functions/cosine_embedding_loss_impl.hpp +3 -3
- mlpack/include/mlpack/methods/ann/loss_functions/mean_bias_error_impl.hpp +1 -1
- mlpack/include/mlpack/methods/ann/loss_functions/multilabel_softmargin_loss_impl.hpp +1 -1
- mlpack/include/mlpack/methods/ann/loss_functions/negative_log_likelihood.hpp +2 -2
- mlpack/include/mlpack/methods/ann/loss_functions/negative_log_likelihood_impl.hpp +29 -15
- mlpack/include/mlpack/methods/ann/loss_functions/poisson_nll_loss_impl.hpp +1 -1
- mlpack/include/mlpack/methods/ann/models/models.hpp +17 -0
- mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_layer.hpp +151 -0
- mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_layer_impl.hpp +265 -0
- mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_tiny.hpp +187 -0
- mlpack/include/mlpack/methods/ann/models/yolov3/yolov3_tiny_impl.hpp +206 -0
- mlpack/include/mlpack/methods/ann/regularizer/orthogonal_regularizer_impl.hpp +5 -3
- mlpack/include/mlpack/methods/ann/rnn.hpp +136 -42
- mlpack/include/mlpack/methods/ann/rnn_impl.hpp +230 -38
- mlpack/include/mlpack/methods/approx_kfn/drusilla_select_impl.hpp +1 -1
- mlpack/include/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_main.cpp +1 -1
- mlpack/include/mlpack/methods/bias_svd/bias_svd_function_impl.hpp +1 -1
- mlpack/include/mlpack/methods/cf/cf_model.hpp +1 -1
- mlpack/include/mlpack/methods/decision_tree/decision_tree.hpp +6 -6
- mlpack/include/mlpack/methods/decision_tree/decision_tree_impl.hpp +12 -12
- mlpack/include/mlpack/methods/decision_tree/decision_tree_main.cpp +0 -1
- mlpack/include/mlpack/methods/decision_tree/decision_tree_regressor.hpp +6 -6
- mlpack/include/mlpack/methods/decision_tree/decision_tree_regressor_impl.hpp +12 -12
- mlpack/include/mlpack/methods/det/det_main.cpp +1 -1
- mlpack/include/mlpack/methods/hmm/hmm_train_main.cpp +4 -4
- mlpack/include/mlpack/methods/hmm/hmm_util_impl.hpp +2 -2
- mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree.hpp +6 -6
- mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_impl.hpp +31 -31
- mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp +1 -2
- mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_model.hpp +2 -2
- mlpack/include/mlpack/methods/hoeffding_trees/hoeffding_tree_model_impl.hpp +1 -1
- mlpack/include/mlpack/methods/kde/kde_rules_impl.hpp +6 -6
- mlpack/include/mlpack/methods/lars/lars_impl.hpp +3 -3
- mlpack/include/mlpack/methods/linear_svm/linear_svm_function_impl.hpp +4 -4
- mlpack/include/mlpack/methods/linear_svm/linear_svm_main.cpp +3 -3
- mlpack/include/mlpack/methods/lmnn/lmnn_main.cpp +1 -1
- mlpack/include/mlpack/methods/lsh/lsh_main.cpp +1 -1
- mlpack/include/mlpack/methods/matrix_completion/matrix_completion_impl.hpp +1 -1
- mlpack/include/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp +1 -1
- mlpack/include/mlpack/methods/naive_bayes/nbc_main.cpp +3 -3
- mlpack/include/mlpack/methods/nca/nca_main.cpp +1 -1
- mlpack/include/mlpack/methods/neighbor_search/kfn_main.cpp +8 -8
- mlpack/include/mlpack/methods/neighbor_search/knn_main.cpp +8 -8
- mlpack/include/mlpack/methods/neighbor_search/neighbor_search.hpp +154 -34
- mlpack/include/mlpack/methods/neighbor_search/neighbor_search_impl.hpp +190 -51
- mlpack/include/mlpack/methods/neighbor_search/neighbor_search_stat.hpp +10 -0
- mlpack/include/mlpack/methods/neighbor_search/ns_model.hpp +15 -15
- mlpack/include/mlpack/methods/neighbor_search/ns_model_impl.hpp +55 -46
- mlpack/include/mlpack/methods/neighbor_search/typedef.hpp +42 -2
- mlpack/include/mlpack/methods/pca/pca_impl.hpp +2 -2
- mlpack/include/mlpack/methods/perceptron/perceptron.hpp +2 -2
- mlpack/include/mlpack/methods/perceptron/perceptron_impl.hpp +1 -1
- mlpack/include/mlpack/methods/perceptron/perceptron_main.cpp +2 -2
- mlpack/include/mlpack/methods/preprocess/image_converter_main.cpp +2 -3
- mlpack/include/mlpack/methods/preprocess/preprocess_binarize_main.cpp +2 -2
- mlpack/include/mlpack/methods/preprocess/preprocess_describe_main.cpp +0 -1
- mlpack/include/mlpack/methods/preprocess/preprocess_imputer_main.cpp +50 -129
- mlpack/include/mlpack/methods/preprocess/preprocess_one_hot_encoding_main.cpp +6 -6
- mlpack/include/mlpack/methods/preprocess/preprocess_scale_main.cpp +2 -3
- mlpack/include/mlpack/methods/preprocess/preprocess_split_main.cpp +3 -4
- mlpack/include/mlpack/methods/preprocess/scaling_model.hpp +6 -8
- mlpack/include/mlpack/methods/preprocess/scaling_model_impl.hpp +18 -20
- mlpack/include/mlpack/methods/random_forest/random_forest.hpp +5 -5
- mlpack/include/mlpack/methods/random_forest/random_forest_impl.hpp +9 -9
- mlpack/include/mlpack/methods/range_search/range_search_main.cpp +1 -1
- mlpack/include/mlpack/methods/rann/krann_main.cpp +1 -1
- mlpack/include/mlpack/methods/regularized_svd/regularized_svd_function_impl.hpp +1 -1
- mlpack/include/mlpack/methods/reinforcement_learning/async_learning_impl.hpp +8 -8
- mlpack/include/mlpack/methods/reinforcement_learning/ddpg_impl.hpp +16 -16
- mlpack/include/mlpack/methods/reinforcement_learning/environment/acrobot.hpp +4 -4
- mlpack/include/mlpack/methods/reinforcement_learning/environment/cart_pole.hpp +3 -3
- mlpack/include/mlpack/methods/reinforcement_learning/environment/cont_double_pole_cart.hpp +6 -5
- mlpack/include/mlpack/methods/reinforcement_learning/environment/pendulum.hpp +6 -5
- mlpack/include/mlpack/methods/reinforcement_learning/policy/aggregated_policy.hpp +2 -2
- mlpack/include/mlpack/methods/reinforcement_learning/q_learning_impl.hpp +10 -10
- mlpack/include/mlpack/methods/reinforcement_learning/q_networks/categorical_dqn.hpp +21 -17
- mlpack/include/mlpack/methods/reinforcement_learning/q_networks/dueling_dqn.hpp +69 -77
- mlpack/include/mlpack/methods/reinforcement_learning/q_networks/simple_dqn.hpp +9 -9
- mlpack/include/mlpack/methods/reinforcement_learning/sac_impl.hpp +14 -14
- mlpack/include/mlpack/methods/reinforcement_learning/td3_impl.hpp +14 -14
- mlpack/include/mlpack/methods/softmax_regression/softmax_regression_function_impl.hpp +1 -1
- mlpack/include/mlpack/methods/svdplusplus/svdplusplus_function_impl.hpp +1 -1
- mlpack/include/mlpack/namespace_compat.hpp +1 -0
- mlpack/include/mlpack/prereqs.hpp +1 -0
- mlpack/kde.cp313-win_amd64.pyd +0 -0
- mlpack/kernel_pca.cp313-win_amd64.pyd +0 -0
- mlpack/kfn.cp313-win_amd64.pyd +0 -0
- mlpack/kmeans.cp313-win_amd64.pyd +0 -0
- mlpack/knn.cp313-win_amd64.pyd +0 -0
- mlpack/krann.cp313-win_amd64.pyd +0 -0
- mlpack/lars.cp313-win_amd64.pyd +0 -0
- mlpack/linear_regression_predict.cp313-win_amd64.pyd +0 -0
- mlpack/linear_regression_train.cp313-win_amd64.pyd +0 -0
- mlpack/linear_svm.cp313-win_amd64.pyd +0 -0
- mlpack/lmnn.cp313-win_amd64.pyd +0 -0
- mlpack/local_coordinate_coding.cp313-win_amd64.pyd +0 -0
- mlpack/logistic_regression.cp313-win_amd64.pyd +0 -0
- mlpack/lsh.cp313-win_amd64.pyd +0 -0
- mlpack/mean_shift.cp313-win_amd64.pyd +0 -0
- mlpack/nbc.cp313-win_amd64.pyd +0 -0
- mlpack/nca.cp313-win_amd64.pyd +0 -0
- mlpack/nmf.cp313-win_amd64.pyd +0 -0
- mlpack/pca.cp313-win_amd64.pyd +0 -0
- mlpack/perceptron.cp313-win_amd64.pyd +0 -0
- mlpack/preprocess_binarize.cp313-win_amd64.pyd +0 -0
- mlpack/preprocess_describe.cp313-win_amd64.pyd +0 -0
- mlpack/preprocess_one_hot_encoding.cp313-win_amd64.pyd +0 -0
- mlpack/preprocess_scale.cp313-win_amd64.pyd +0 -0
- mlpack/preprocess_split.cp313-win_amd64.pyd +0 -0
- mlpack/radical.cp313-win_amd64.pyd +0 -0
- mlpack/random_forest.cp313-win_amd64.pyd +0 -0
- mlpack/softmax_regression.cp313-win_amd64.pyd +0 -0
- mlpack/sparse_coding.cp313-win_amd64.pyd +0 -0
- mlpack-4.7.0.dist-info/DELVEWHEEL +2 -0
- {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/METADATA +2 -2
- {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/RECORD +396 -377
- {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/WHEEL +1 -1
- mlpack/include/mlpack/core/data/format.hpp +0 -31
- mlpack/include/mlpack/core/data/image_info.hpp +0 -102
- mlpack/include/mlpack/core/data/image_info_impl.hpp +0 -84
- mlpack/include/mlpack/core/data/load_image_impl.hpp +0 -171
- mlpack/include/mlpack/core/data/load_model_impl.hpp +0 -115
- mlpack/include/mlpack/core/data/load_vec_impl.hpp +0 -154
- mlpack/include/mlpack/core/data/map_policies/missing_policy.hpp +0 -148
- mlpack/include/mlpack/core/data/save_image_impl.hpp +0 -170
- mlpack/include/mlpack/core/data/types.hpp +0 -61
- mlpack/include/mlpack/core/data/types_impl.hpp +0 -83
- mlpack/include/mlpack/core/data/utilities.hpp +0 -158
- mlpack/include/mlpack/core/util/gitversion.hpp +0 -1
- mlpack/include/mlpack/methods/ann/convolution_rules/fft_convolution.hpp +0 -213
- mlpack/include/mlpack/methods/ann/convolution_rules/svd_convolution.hpp +0 -201
- mlpack/include/mlpack/methods/ann/layer/not_adapted/gru.hpp +0 -226
- mlpack/include/mlpack/methods/ann/layer/not_adapted/gru_impl.hpp +0 -367
- mlpack/include/mlpack/methods/ann/layer/not_adapted/lookup.hpp +0 -139
- mlpack/include/mlpack/methods/ann/layer/not_adapted/lookup_impl.hpp +0 -98
- mlpack-4.6.2.dist-info/DELVEWHEEL +0 -2
- {mlpack-4.6.2.dist-info → mlpack-4.7.0.dist-info}/top_level.txt +0 -0
- /mlpack.libs/{libopenblas-9e6d070f769e6580e8c55c0cf83b80a5.dll → libopenblas-c7f521b507686ddc25bee7538a80c374.dll} +0 -0
- /mlpack.libs/{msvcp140-50208655e42969b9a5ab8a4e0186bbb9.dll → msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file core/data/
|
|
2
|
+
* @file core/data/load_numeric.hpp
|
|
3
3
|
* @author Omar Shrit
|
|
4
4
|
*
|
|
5
5
|
* Load numeric csv using Armadillo parser. Distinguish between the cases, if
|
|
@@ -13,118 +13,155 @@
|
|
|
13
13
|
#ifndef MLPACK_CORE_DATA_LOAD_NUMERIC_HPP
|
|
14
14
|
#define MLPACK_CORE_DATA_LOAD_NUMERIC_HPP
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
inline const arma::csv_opts::opts& NoTransposeOpt(const bool noTranspose)
|
|
21
|
-
{
|
|
22
|
-
if (noTranspose)
|
|
23
|
-
return arma::csv_opts::none;
|
|
24
|
-
else
|
|
25
|
-
return arma::csv_opts::trans;
|
|
26
|
-
}
|
|
16
|
+
#include "text_options.hpp"
|
|
17
|
+
#include "load_categorical.hpp"
|
|
18
|
+
#include "load_dense.hpp"
|
|
19
|
+
#include "load_sparse.hpp"
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
if (hasHeaders)
|
|
31
|
-
return arma::csv_opts::with_header;
|
|
32
|
-
else
|
|
33
|
-
return arma::csv_opts::no_header;
|
|
34
|
-
}
|
|
21
|
+
namespace mlpack {
|
|
35
22
|
|
|
36
|
-
|
|
23
|
+
template<typename MatType>
|
|
24
|
+
bool LoadNumeric(const std::string& filename,
|
|
25
|
+
MatType& matrix,
|
|
26
|
+
std::fstream& stream,
|
|
27
|
+
TextOptions& opts)
|
|
37
28
|
{
|
|
38
|
-
|
|
39
|
-
return arma::csv_opts::semicolon;
|
|
40
|
-
else
|
|
41
|
-
return arma::csv_opts::none;
|
|
42
|
-
}
|
|
29
|
+
bool success = false;
|
|
43
30
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
TextOptions txtOpts(std::move(opts));
|
|
32
|
+
if constexpr (IsSparseMat<MatType>::value)
|
|
33
|
+
{
|
|
34
|
+
success = LoadSparse(filename, matrix, txtOpts, stream);
|
|
35
|
+
}
|
|
36
|
+
else if (txtOpts.Categorical() ||
|
|
37
|
+
(txtOpts.Format() == FileType::ARFFASCII))
|
|
38
|
+
{
|
|
39
|
+
success = LoadCategorical(filename, matrix, txtOpts);
|
|
40
|
+
}
|
|
41
|
+
else if constexpr (IsCol<MatType>::value)
|
|
47
42
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
success = LoadDenseCol(filename, matrix, txtOpts, stream);
|
|
44
|
+
}
|
|
45
|
+
else if constexpr (IsRow<MatType>::value)
|
|
46
|
+
{
|
|
47
|
+
success = LoadDenseRow(filename, matrix, txtOpts, stream);
|
|
48
|
+
}
|
|
49
|
+
else if constexpr (IsDense<MatType>::value)
|
|
50
|
+
{
|
|
51
|
+
success = LoadDense(filename, matrix, txtOpts, stream);
|
|
53
52
|
}
|
|
54
53
|
else
|
|
55
54
|
{
|
|
56
|
-
return
|
|
55
|
+
return HandleError("Load(): unknown matrix-like type given!",
|
|
56
|
+
txtOpts);
|
|
57
57
|
}
|
|
58
|
+
opts = std::move(txtOpts);
|
|
59
|
+
return success;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
template<typename MatType>
|
|
61
|
-
bool
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
bool LoadNumericMultifile(const std::vector<std::string>& filenames,
|
|
64
|
+
MatType& matrix,
|
|
65
|
+
const TextOptions& opts)
|
|
66
|
+
{
|
|
67
|
+
TextOptions copyOpts(opts);
|
|
68
|
+
return Load(filenames, matrix, copyOpts);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
template<typename MatType>
|
|
72
|
+
bool LoadNumericMultifile(const std::vector<std::string>& filenames,
|
|
73
|
+
MatType& matrix,
|
|
74
|
+
TextOptions& opts)
|
|
64
75
|
{
|
|
65
76
|
bool success = false;
|
|
77
|
+
MatType tmp;
|
|
78
|
+
arma::field<std::string> firstHeaders;
|
|
79
|
+
if (filenames.empty())
|
|
80
|
+
{
|
|
81
|
+
return HandleError("Load(): given set of filenames is empty;"
|
|
82
|
+
" loading failed.", opts);
|
|
83
|
+
}
|
|
66
84
|
|
|
67
|
-
|
|
68
|
-
#if ARMA_VERSION_MAJOR < 12
|
|
69
|
-
if (opts.MissingToNan())
|
|
85
|
+
for (size_t i = 0; i < filenames.size(); ++i)
|
|
70
86
|
{
|
|
71
|
-
|
|
87
|
+
success = Load(filenames.at(i), matrix, opts);
|
|
88
|
+
if (opts.HasHeaders())
|
|
72
89
|
{
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
if (i == 0)
|
|
91
|
+
firstHeaders = opts.Headers();
|
|
92
|
+
else
|
|
93
|
+
{
|
|
94
|
+
arma::field<std::string>& headers = opts.Headers();
|
|
95
|
+
|
|
96
|
+
// Make sure that the headers in this file match the first file's
|
|
97
|
+
// headers.
|
|
98
|
+
for (size_t j = 0; j < headers.size(); ++j)
|
|
99
|
+
{
|
|
100
|
+
if (firstHeaders.at(j) != headers.at(j))
|
|
101
|
+
{
|
|
102
|
+
std::stringstream oss;
|
|
103
|
+
oss << "Load(): header column " << j << " in file '"
|
|
104
|
+
<< filenames[j] << "' ('" << headers[j] << "') does not match"
|
|
105
|
+
<< " header column " << j << " in first file '"
|
|
106
|
+
<< filenames[0] << "' ('" << firstHeaders[j] << "'); load "
|
|
107
|
+
<< "failed.";
|
|
108
|
+
matrix.clear();
|
|
109
|
+
return HandleError(oss, opts);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
75
113
|
}
|
|
76
|
-
|
|
114
|
+
|
|
115
|
+
if (success)
|
|
77
116
|
{
|
|
78
|
-
|
|
79
|
-
|
|
117
|
+
if (i == 0)
|
|
118
|
+
{
|
|
119
|
+
tmp = std::move(matrix);
|
|
120
|
+
}
|
|
121
|
+
else
|
|
122
|
+
{
|
|
123
|
+
if (!opts.NoTranspose()) // if transpose
|
|
124
|
+
{
|
|
125
|
+
if (tmp.n_rows != matrix.n_rows)
|
|
126
|
+
{
|
|
127
|
+
std::stringstream oss;
|
|
128
|
+
oss << "Load(): dimension mismatch; file '" << filenames[i]
|
|
129
|
+
<< "' has " << matrix.n_rows << " dimensions, but first file "
|
|
130
|
+
<< "'" << filenames[0] << "' has " << tmp.n_rows
|
|
131
|
+
<< " dimensions.";
|
|
132
|
+
return HandleError(oss, opts);
|
|
133
|
+
}
|
|
134
|
+
else
|
|
135
|
+
tmp = join_rows(tmp, matrix);
|
|
136
|
+
}
|
|
137
|
+
else
|
|
138
|
+
{
|
|
139
|
+
if (tmp.n_cols != matrix.n_cols)
|
|
140
|
+
{
|
|
141
|
+
std::stringstream oss;
|
|
142
|
+
oss << "Load(): dimension mismatch; file '" << filenames[i]
|
|
143
|
+
<< "' has " << matrix.n_cols << " dimensions, but first file "
|
|
144
|
+
<< "'" << filenames[0] << "' has " << tmp.n_cols
|
|
145
|
+
<< " dimensions.";
|
|
146
|
+
return HandleError(oss, opts);
|
|
147
|
+
}
|
|
148
|
+
else
|
|
149
|
+
{
|
|
150
|
+
tmp = join_cols(tmp, matrix);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
80
154
|
}
|
|
155
|
+
else
|
|
156
|
+
break;
|
|
81
157
|
}
|
|
82
|
-
#endif
|
|
83
158
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
NoTransposeOpt(opts.NoTranspose()) +
|
|
87
|
-
HasHeadersOpt(opts.HasHeaders()) +
|
|
88
|
-
SemicolonOpt(opts.Semicolon()) +
|
|
89
|
-
MissingToNanOpt(opts.MissingToNan());
|
|
90
|
-
|
|
91
|
-
if (opts.HasHeaders())
|
|
92
|
-
{
|
|
93
|
-
success = matrix.load(arma::csv_name(filename, opts.Headers(), flags),
|
|
94
|
-
arma::csv_ascii);
|
|
95
|
-
}
|
|
96
|
-
else
|
|
97
|
-
{
|
|
98
|
-
success = matrix.load(arma::csv_name(filename, flags), arma::csv_ascii);
|
|
99
|
-
}
|
|
159
|
+
if (success)
|
|
160
|
+
matrix = std::move(tmp);
|
|
100
161
|
|
|
101
162
|
return success;
|
|
102
163
|
}
|
|
103
164
|
|
|
104
|
-
template<typename eT, typename DataOptionsType>
|
|
105
|
-
bool LoadHDF5(const std::string& filename,
|
|
106
|
-
arma::Mat<eT>& matrix,
|
|
107
|
-
const DataOptionsBase<DataOptionsType>& opts)
|
|
108
|
-
{
|
|
109
|
-
#ifndef ARMA_USE_HDF5
|
|
110
|
-
// Ensure that HDF5 is supported.
|
|
111
|
-
Timer::Stop("loading_data");
|
|
112
|
-
if (opts.Fatal())
|
|
113
|
-
Log::Fatal << "Attempted to load '" << filename << "' as HDF5 data, but "
|
|
114
|
-
<< "Armadillo was compiled without HDF5 support. Load failed."
|
|
115
|
-
<< std::endl;
|
|
116
|
-
else
|
|
117
|
-
Log::Warn << "Attempted to load '" << filename << "' as HDF5 data, but "
|
|
118
|
-
<< "Armadillo was compiled without HDF5 support. Load failed."
|
|
119
|
-
<< std::endl;
|
|
120
|
-
|
|
121
|
-
return false;
|
|
122
|
-
#endif
|
|
123
|
-
|
|
124
|
-
return matrix.load(filename, ToArmaFileType(opts.Format()));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
} // namespace data
|
|
128
165
|
} // namespace mlpack
|
|
129
166
|
|
|
130
167
|
#endif
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file core/data/load_sparse.hpp
|
|
3
|
+
* @author Omar Shrit
|
|
4
|
+
*
|
|
5
|
+
* Implementation of templatized load() function defined in load.hpp.
|
|
6
|
+
*
|
|
7
|
+
* mlpack is free software; you may redistribute it and/or modify it under the
|
|
8
|
+
* terms of the 3-clause BSD license. You should have received a copy of the
|
|
9
|
+
* 3-clause BSD license along with mlpack. If not, see
|
|
10
|
+
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
|
11
|
+
*/
|
|
12
|
+
#ifndef MLPACK_CORE_DATA_LOAD_SPARSE_HPP
|
|
13
|
+
#define MLPACK_CORE_DATA_LOAD_SPARSE_HPP
|
|
14
|
+
|
|
15
|
+
#include <mlpack/prereqs.hpp>
|
|
16
|
+
|
|
17
|
+
#include "text_options.hpp"
|
|
18
|
+
|
|
19
|
+
namespace mlpack {
|
|
20
|
+
|
|
21
|
+
template <typename eT>
|
|
22
|
+
bool LoadSparse(const std::string& filename,
|
|
23
|
+
arma::SpMat<eT>& matrix,
|
|
24
|
+
TextOptions& opts,
|
|
25
|
+
std::fstream& stream)
|
|
26
|
+
{
|
|
27
|
+
bool success;
|
|
28
|
+
// There is still a small amount of differentiation that needs to be done:
|
|
29
|
+
// if we got a text type, it could be a coordinate list. We will make an
|
|
30
|
+
// educated guess based on the shape of the input.
|
|
31
|
+
if (opts.Format() == FileType::RawASCII)
|
|
32
|
+
{
|
|
33
|
+
// Get the number of columns in the file. If it is the right shape, we
|
|
34
|
+
// will assume it is sparse.
|
|
35
|
+
const size_t cols = CountCols(stream);
|
|
36
|
+
if (cols == 3)
|
|
37
|
+
{
|
|
38
|
+
// We have the right number of columns, so assume the type is a
|
|
39
|
+
// coordinate list.
|
|
40
|
+
opts.Format() = FileType::CoordASCII;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Filter out invalid types.
|
|
45
|
+
if ((opts.Format() == FileType::PGMBinary) ||
|
|
46
|
+
(opts.Format() == FileType::PPMBinary) ||
|
|
47
|
+
(opts.Format() == FileType::ArmaASCII) ||
|
|
48
|
+
(opts.Format() == FileType::RawBinary))
|
|
49
|
+
{
|
|
50
|
+
std::stringstream oss;
|
|
51
|
+
oss << "Cannot load '" << filename << "' with type "
|
|
52
|
+
<< opts.FileTypeToString() << " into a sparse matrix; format is "
|
|
53
|
+
<< "only supported for dense matrices.";
|
|
54
|
+
return HandleError(oss, opts);
|
|
55
|
+
}
|
|
56
|
+
else if (opts.Format() == FileType::CSVASCII)
|
|
57
|
+
{
|
|
58
|
+
// Armadillo sparse matrices can't load CSVs, so we have to load a separate
|
|
59
|
+
// matrix to do that. If the CSV has three columns, we assume it's a
|
|
60
|
+
// coordinate list.
|
|
61
|
+
arma::Mat<eT> dense;
|
|
62
|
+
success = dense.load(stream, opts.ArmaFormat());
|
|
63
|
+
if (dense.n_cols == 3)
|
|
64
|
+
{
|
|
65
|
+
arma::umat locations = arma::conv_to<arma::umat>::from(
|
|
66
|
+
dense.cols(0, 1).t());
|
|
67
|
+
matrix = arma::SpMat<eT>(locations, dense.col(2));
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
{
|
|
71
|
+
matrix = arma::conv_to<arma::SpMat<eT>>::from(dense);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else
|
|
75
|
+
{
|
|
76
|
+
success = matrix.load(stream, opts.ArmaFormat());
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!opts.NoTranspose())
|
|
80
|
+
{
|
|
81
|
+
// It seems that there is no direct way to use inplace_trans() on
|
|
82
|
+
// sparse matrices.
|
|
83
|
+
matrix = matrix.t();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return success;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
} // namespace mlpack
|
|
90
|
+
|
|
91
|
+
#endif
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
#include <mlpack/prereqs.hpp>
|
|
15
15
|
|
|
16
16
|
namespace mlpack {
|
|
17
|
-
namespace data {
|
|
18
17
|
/**
|
|
19
18
|
* The Datatype enum specifies the types of data mlpack algorithms can use.
|
|
20
19
|
* The vast majority of mlpack algorithms can only use numeric data (i.e.
|
|
@@ -27,7 +26,6 @@ enum Datatype : bool /* [> bool is all the precision we need for two types <] */
|
|
|
27
26
|
categorical = 1
|
|
28
27
|
};
|
|
29
28
|
|
|
30
|
-
} // namespace data
|
|
31
29
|
} // namespace mlpack
|
|
32
30
|
|
|
33
31
|
#endif
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#include <mlpack/core/data/map_policies/datatype.hpp>
|
|
18
18
|
|
|
19
19
|
namespace mlpack {
|
|
20
|
-
namespace data {
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* IncrementPolicy is used as a helper class for DatasetMapper. It tells how the
|
|
@@ -147,7 +146,6 @@ class IncrementPolicy
|
|
|
147
146
|
bool forceAllMappings;
|
|
148
147
|
}; // class IncrementPolicy
|
|
149
148
|
|
|
150
|
-
} // namespace data
|
|
151
149
|
} // namespace mlpack
|
|
152
150
|
|
|
153
151
|
#endif
|
|
@@ -19,40 +19,42 @@
|
|
|
19
19
|
#include "data_options.hpp"
|
|
20
20
|
|
|
21
21
|
namespace mlpack {
|
|
22
|
-
namespace data {
|
|
23
22
|
|
|
24
23
|
template<typename Derived>
|
|
25
24
|
class MatrixOptionsBase : public DataOptionsBase<MatrixOptionsBase<Derived>>
|
|
26
25
|
{
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
protected:
|
|
27
|
+
// Users should not construct a MatrixOptionsBase directly.
|
|
28
|
+
MatrixOptionsBase(std::optional<bool> noTranspose = std::nullopt) :
|
|
29
29
|
DataOptionsBase<MatrixOptionsBase<Derived>>(),
|
|
30
30
|
noTranspose(noTranspose)
|
|
31
|
-
{
|
|
32
|
-
// Do Nothing.
|
|
33
|
-
}
|
|
31
|
+
{ }
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
public:
|
|
34
|
+
//
|
|
35
|
+
// Handling for copying and moving MatrixOptionsBase of the exact same type.
|
|
36
|
+
//
|
|
37
|
+
|
|
38
|
+
MatrixOptionsBase(const DataOptionsBase<MatrixOptionsBase<Derived>>& opts) :
|
|
37
39
|
DataOptionsBase<MatrixOptionsBase<Derived>>()
|
|
38
40
|
{
|
|
39
41
|
// Delegate to copy operator.
|
|
40
42
|
*this = opts;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
explicit MatrixOptionsBase(MatrixOptionsBase<Derived2>&& opts) :
|
|
45
|
+
MatrixOptionsBase(DataOptionsBase<MatrixOptionsBase<Derived>>&& opts) :
|
|
45
46
|
DataOptionsBase<MatrixOptionsBase<Derived>>()
|
|
46
47
|
{
|
|
47
48
|
// Delegate to move operator.
|
|
48
49
|
*this = std::move(opts);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
MatrixOptionsBase& operator=(const MatrixOptionsBase& other)
|
|
52
|
+
MatrixOptionsBase& operator=(
|
|
53
|
+
const DataOptionsBase<MatrixOptionsBase<Derived>>& otherIn)
|
|
55
54
|
{
|
|
55
|
+
const MatrixOptionsBase& other =
|
|
56
|
+
static_cast<const MatrixOptionsBase&>(otherIn);
|
|
57
|
+
|
|
56
58
|
if (&other == this)
|
|
57
59
|
return *this;
|
|
58
60
|
|
|
@@ -63,8 +65,11 @@ class MatrixOptionsBase : public DataOptionsBase<MatrixOptionsBase<Derived>>
|
|
|
63
65
|
return *this;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
MatrixOptionsBase& operator=(
|
|
68
|
+
MatrixOptionsBase& operator=(
|
|
69
|
+
DataOptionsBase<MatrixOptionsBase<Derived>>&& otherIn)
|
|
67
70
|
{
|
|
71
|
+
MatrixOptionsBase&& other = static_cast<MatrixOptionsBase&&>(otherIn);
|
|
72
|
+
|
|
68
73
|
if (&other == this)
|
|
69
74
|
return *this;
|
|
70
75
|
|
|
@@ -74,9 +79,69 @@ class MatrixOptionsBase : public DataOptionsBase<MatrixOptionsBase<Derived>>
|
|
|
74
79
|
return *this;
|
|
75
80
|
}
|
|
76
81
|
|
|
82
|
+
//
|
|
83
|
+
// Handling for copying and moving entirely different DataOptionsBase types.
|
|
84
|
+
//
|
|
85
|
+
|
|
86
|
+
template<typename Derived2>
|
|
87
|
+
explicit MatrixOptionsBase(const DataOptionsBase<Derived2>& opts) :
|
|
88
|
+
DataOptionsBase<MatrixOptionsBase<Derived>>()
|
|
89
|
+
{
|
|
90
|
+
// Delegate to copy operator.
|
|
91
|
+
*this = opts;
|
|
92
|
+
}
|
|
93
|
+
|
|
77
94
|
template<typename Derived2>
|
|
78
|
-
MatrixOptionsBase
|
|
95
|
+
explicit MatrixOptionsBase(DataOptionsBase<Derived2>&& opts) :
|
|
96
|
+
DataOptionsBase<MatrixOptionsBase<Derived>>()
|
|
79
97
|
{
|
|
98
|
+
// Delegate to move operator.
|
|
99
|
+
*this = std::move(opts);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
template<typename Derived2>
|
|
103
|
+
MatrixOptionsBase& operator=(const DataOptionsBase<Derived2>& otherIn)
|
|
104
|
+
{
|
|
105
|
+
// Call out to base operator=.
|
|
106
|
+
return static_cast<MatrixOptionsBase&>(
|
|
107
|
+
DataOptionsBase<MatrixOptionsBase>::operator=(otherIn));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
template<typename Derived2>
|
|
111
|
+
MatrixOptionsBase& operator=(DataOptionsBase<Derived2>&& otherIn)
|
|
112
|
+
{
|
|
113
|
+
// Call out to base operator=.
|
|
114
|
+
return static_cast<MatrixOptionsBase&>(
|
|
115
|
+
DataOptionsBase<MatrixOptionsBase>::operator=(std::move(otherIn)));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//
|
|
119
|
+
// Handling for copying and moving different child types of MatrixOptionsBase.
|
|
120
|
+
//
|
|
121
|
+
|
|
122
|
+
template<typename Derived2>
|
|
123
|
+
MatrixOptionsBase(const DataOptionsBase<MatrixOptionsBase<Derived2>>& opts) :
|
|
124
|
+
DataOptionsBase<MatrixOptionsBase<Derived>>()
|
|
125
|
+
{
|
|
126
|
+
// Delegate to copy operator.
|
|
127
|
+
*this = opts;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
template<typename Derived2>
|
|
131
|
+
MatrixOptionsBase(DataOptionsBase<MatrixOptionsBase<Derived2>>&& opts) :
|
|
132
|
+
DataOptionsBase<MatrixOptionsBase<Derived>>()
|
|
133
|
+
{
|
|
134
|
+
// Delegate to move operator.
|
|
135
|
+
*this = std::move(opts);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
template<typename Derived2>
|
|
139
|
+
MatrixOptionsBase& operator=(
|
|
140
|
+
const DataOptionsBase<MatrixOptionsBase<Derived2>>& otherIn)
|
|
141
|
+
{
|
|
142
|
+
const MatrixOptionsBase<Derived2>& other =
|
|
143
|
+
static_cast<const MatrixOptionsBase<Derived2>&>(otherIn);
|
|
144
|
+
|
|
80
145
|
if ((void*) &other == (void*) this)
|
|
81
146
|
return *this;
|
|
82
147
|
|
|
@@ -95,8 +160,12 @@ class MatrixOptionsBase : public DataOptionsBase<MatrixOptionsBase<Derived>>
|
|
|
95
160
|
}
|
|
96
161
|
|
|
97
162
|
template<typename Derived2>
|
|
98
|
-
MatrixOptionsBase& operator=(
|
|
163
|
+
MatrixOptionsBase& operator=(
|
|
164
|
+
DataOptionsBase<MatrixOptionsBase<Derived2>>&& otherIn)
|
|
99
165
|
{
|
|
166
|
+
MatrixOptionsBase<Derived2>&& other =
|
|
167
|
+
static_cast<MatrixOptionsBase<Derived2>&&>(otherIn);
|
|
168
|
+
|
|
100
169
|
if ((void*) this == (void*) &other)
|
|
101
170
|
return *this;
|
|
102
171
|
|
|
@@ -112,6 +181,25 @@ class MatrixOptionsBase : public DataOptionsBase<MatrixOptionsBase<Derived>>
|
|
|
112
181
|
return *this;
|
|
113
182
|
}
|
|
114
183
|
|
|
184
|
+
// Augment with the options of the other `MatrixOptionsBase`.
|
|
185
|
+
template<typename Derived2>
|
|
186
|
+
void Combine(const MatrixOptionsBase<Derived2>& other)
|
|
187
|
+
{
|
|
188
|
+
// Combine the noTranspose option.
|
|
189
|
+
noTranspose =
|
|
190
|
+
DataOptionsBase<MatrixOptionsBase<Derived>>::CombineBooleanOption(
|
|
191
|
+
noTranspose, other.noTranspose, "NoTranspose()");
|
|
192
|
+
|
|
193
|
+
// If the derived type is the same, we can take any options from it.
|
|
194
|
+
if constexpr (std::is_same_v<Derived, Derived2>)
|
|
195
|
+
{
|
|
196
|
+
static_cast<Derived&>(*this).Combine(static_cast<const Derived2&>(other));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// If Derived is not the same as Derived2, we will have printed warnings in
|
|
200
|
+
// the standalone operator+().
|
|
201
|
+
}
|
|
202
|
+
|
|
115
203
|
void WarnBaseConversion(const char* dataDescription) const
|
|
116
204
|
{
|
|
117
205
|
if (noTranspose.has_value() && noTranspose != defaultNoTranspose)
|
|
@@ -156,17 +244,61 @@ class MatrixOptionsBase : public DataOptionsBase<MatrixOptionsBase<Derived>>
|
|
|
156
244
|
// This utility class is meant to be used as the Derived parameter for a matrix
|
|
157
245
|
// option that is not actually a derived type. It provides the
|
|
158
246
|
// WarnBaseConversion() member, which does nothing.
|
|
159
|
-
class
|
|
247
|
+
class PlainMatrixOptions : public MatrixOptionsBase<PlainMatrixOptions>
|
|
160
248
|
{
|
|
161
249
|
public:
|
|
250
|
+
// Allow access to all public MatrixOptionsBase constructors and operators,
|
|
251
|
+
// but with the PlainMatrixOptions type name.
|
|
252
|
+
using MatrixOptionsBase::MatrixOptionsBase;
|
|
253
|
+
using MatrixOptionsBase::operator=;
|
|
254
|
+
|
|
255
|
+
// However, C++ does not allow inheriting copy and move constructors or
|
|
256
|
+
// operators, and the inherited protected constructor will still be protected,
|
|
257
|
+
// so forward those manually.
|
|
258
|
+
PlainMatrixOptions(const std::optional<bool> noTranspose = std::nullopt) :
|
|
259
|
+
MatrixOptionsBase(noTranspose) { }
|
|
260
|
+
PlainMatrixOptions(const MatrixOptionsBase<PlainMatrixOptions>& other) :
|
|
261
|
+
MatrixOptionsBase(other) { }
|
|
262
|
+
PlainMatrixOptions(MatrixOptionsBase<PlainMatrixOptions>&& other) :
|
|
263
|
+
MatrixOptionsBase(std::move(other)) { }
|
|
264
|
+
|
|
265
|
+
PlainMatrixOptions& operator=(
|
|
266
|
+
const MatrixOptionsBase<PlainMatrixOptions>& other)
|
|
267
|
+
{
|
|
268
|
+
return static_cast<PlainMatrixOptions&>(
|
|
269
|
+
MatrixOptionsBase::operator=(other));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
PlainMatrixOptions& operator=(MatrixOptionsBase<PlainMatrixOptions>&& other)
|
|
273
|
+
{
|
|
274
|
+
return static_cast<PlainMatrixOptions&>(
|
|
275
|
+
MatrixOptionsBase::operator=(std::move(other)));
|
|
276
|
+
}
|
|
277
|
+
|
|
162
278
|
void WarnBaseConversion(const char* /* dataDescription */) const { }
|
|
163
279
|
static const char* DataDescription() { return "general data"; }
|
|
164
280
|
void Reset() { }
|
|
281
|
+
void Combine(const PlainMatrixOptions&) { }
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
using MatrixOptions = PlainMatrixOptions;
|
|
285
|
+
|
|
286
|
+
// Boolean options.
|
|
287
|
+
static const MatrixOptions Transpose = MatrixOptions(false);
|
|
288
|
+
static const MatrixOptions NoTranspose = MatrixOptions(true);
|
|
289
|
+
|
|
290
|
+
template<typename T>
|
|
291
|
+
struct IsDataOptions<MatrixOptionsBase<T>>
|
|
292
|
+
{
|
|
293
|
+
constexpr static bool value = true;
|
|
165
294
|
};
|
|
166
295
|
|
|
167
|
-
|
|
296
|
+
template<>
|
|
297
|
+
struct IsDataOptions<PlainMatrixOptions>
|
|
298
|
+
{
|
|
299
|
+
constexpr static bool value = true;
|
|
300
|
+
};
|
|
168
301
|
|
|
169
|
-
} // namespace data
|
|
170
302
|
} // namespace mlpack
|
|
171
303
|
|
|
172
304
|
#endif
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#include <mlpack/prereqs.hpp>
|
|
18
18
|
|
|
19
19
|
namespace mlpack {
|
|
20
|
-
namespace data {
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Given a set of labels of a particular datatype, convert them to unsigned
|
|
@@ -47,7 +46,6 @@ void RevertLabels(const arma::Row<size_t>& labels,
|
|
|
47
46
|
const arma::Col<eT>& mapping,
|
|
48
47
|
arma::Row<eT>& labelsOut);
|
|
49
48
|
|
|
50
|
-
} // namespace data
|
|
51
49
|
} // namespace mlpack
|
|
52
50
|
|
|
53
51
|
// Include implementation.
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#include "normalize_labels.hpp"
|
|
18
18
|
|
|
19
19
|
namespace mlpack {
|
|
20
|
-
namespace data {
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Given a set of labels of a particular datatype, convert them to unsigned
|
|
@@ -86,7 +85,6 @@ void RevertLabels(const arma::Row<size_t>& labels,
|
|
|
86
85
|
labelsOut[i] = mapping[labels[i]];
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
} // namespace data
|
|
90
88
|
} // namespace mlpack
|
|
91
89
|
|
|
92
90
|
#endif
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#include <mlpack/core.hpp>
|
|
18
18
|
|
|
19
19
|
namespace mlpack {
|
|
20
|
-
namespace data {
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Given a set of labels of a particular datatype, convert them to binary
|
|
@@ -51,7 +50,7 @@ void OneHotEncoding(const arma::Mat<eT>& input,
|
|
|
51
50
|
* Overloaded function for the above function, which takes a matrix as input
|
|
52
51
|
* and also a DatasetInfo object and outputs a matrix.
|
|
53
52
|
* This function encodes all the dimensions marked `Datatype::categorical`
|
|
54
|
-
* in the
|
|
53
|
+
* in the DatasetInfo.
|
|
55
54
|
*
|
|
56
55
|
* @param input Input dataset to be encoded.
|
|
57
56
|
* @param output Encoded matrix.
|
|
@@ -60,9 +59,8 @@ void OneHotEncoding(const arma::Mat<eT>& input,
|
|
|
60
59
|
template<typename eT>
|
|
61
60
|
void OneHotEncoding(const arma::Mat<eT>& input,
|
|
62
61
|
arma::Mat<eT>& output,
|
|
63
|
-
const
|
|
62
|
+
const DatasetInfo& datasetInfo);
|
|
64
63
|
|
|
65
|
-
} // namespace data
|
|
66
64
|
} // namespace mlpack
|
|
67
65
|
|
|
68
66
|
// Include implementation.
|