mlpack 4.6.1__cp39-cp39-win_amd64.whl → 4.6.2__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 (103) hide show
  1. mlpack/__init__.py +3 -3
  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/core/cv/k_fold_cv.hpp +21 -12
  24. mlpack/include/mlpack/core/cv/k_fold_cv_impl.hpp +49 -39
  25. mlpack/include/mlpack/core/data/detect_file_type_impl.hpp +9 -46
  26. mlpack/include/mlpack/core/data/save_impl.hpp +315 -315
  27. mlpack/include/mlpack/core/data/utilities.hpp +158 -158
  28. mlpack/include/mlpack/core/math/ccov.hpp +1 -0
  29. mlpack/include/mlpack/core/math/ccov_impl.hpp +4 -5
  30. mlpack/include/mlpack/core/math/make_alias.hpp +98 -3
  31. mlpack/include/mlpack/core/util/arma_traits.hpp +19 -2
  32. mlpack/include/mlpack/core/util/gitversion.hpp +1 -1
  33. mlpack/include/mlpack/core/util/sfinae_utility.hpp +24 -2
  34. mlpack/include/mlpack/core/util/version.hpp +1 -1
  35. mlpack/include/mlpack/methods/ann/dists/bernoulli_distribution_impl.hpp +1 -2
  36. mlpack/include/mlpack/methods/ann/init_rules/network_init.hpp +5 -5
  37. mlpack/include/mlpack/methods/ann/layer/batch_norm.hpp +3 -2
  38. mlpack/include/mlpack/methods/ann/layer/batch_norm_impl.hpp +19 -20
  39. mlpack/include/mlpack/methods/ann/layer/concat.hpp +1 -0
  40. mlpack/include/mlpack/methods/ann/layer/concat_impl.hpp +6 -7
  41. mlpack/include/mlpack/methods/ann/layer/convolution_impl.hpp +3 -3
  42. mlpack/include/mlpack/methods/ann/layer/grouped_convolution_impl.hpp +3 -3
  43. mlpack/include/mlpack/methods/ann/layer/linear3d.hpp +1 -0
  44. mlpack/include/mlpack/methods/ann/layer/linear3d_impl.hpp +11 -14
  45. mlpack/include/mlpack/methods/ann/layer/max_pooling.hpp +5 -4
  46. mlpack/include/mlpack/methods/ann/layer/max_pooling_impl.hpp +15 -14
  47. mlpack/include/mlpack/methods/ann/layer/mean_pooling.hpp +3 -2
  48. mlpack/include/mlpack/methods/ann/layer/mean_pooling_impl.hpp +14 -15
  49. mlpack/include/mlpack/methods/ann/layer/multihead_attention.hpp +6 -5
  50. mlpack/include/mlpack/methods/ann/layer/multihead_attention_impl.hpp +24 -25
  51. mlpack/include/mlpack/methods/ann/layer/nearest_interpolation.hpp +1 -0
  52. mlpack/include/mlpack/methods/ann/layer/nearest_interpolation_impl.hpp +4 -4
  53. mlpack/include/mlpack/methods/ann/layer/padding.hpp +1 -0
  54. mlpack/include/mlpack/methods/ann/layer/padding_impl.hpp +12 -13
  55. mlpack/include/mlpack/methods/ann/layer/recurrent_layer.hpp +3 -2
  56. mlpack/include/mlpack/methods/ann/loss_functions/cosine_embedding_loss_impl.hpp +5 -4
  57. mlpack/include/mlpack/methods/ann/rnn.hpp +19 -18
  58. mlpack/include/mlpack/methods/ann/rnn_impl.hpp +15 -15
  59. mlpack/include/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_impl.hpp +3 -8
  60. mlpack/include/mlpack/methods/decision_tree/fitness_functions/gini_gain.hpp +5 -8
  61. mlpack/include/mlpack/methods/decision_tree/fitness_functions/information_gain.hpp +5 -8
  62. mlpack/include/mlpack/methods/gmm/diagonal_gmm_impl.hpp +2 -1
  63. mlpack/include/mlpack/methods/gmm/eigenvalue_ratio_constraint.hpp +3 -3
  64. mlpack/include/mlpack/methods/gmm/gmm_impl.hpp +2 -1
  65. mlpack/include/mlpack/methods/hmm/hmm_impl.hpp +10 -5
  66. mlpack/include/mlpack/methods/random_forest/random_forest.hpp +57 -37
  67. mlpack/include/mlpack/methods/random_forest/random_forest_impl.hpp +69 -59
  68. mlpack/kde.cp39-win_amd64.pyd +0 -0
  69. mlpack/kernel_pca.cp39-win_amd64.pyd +0 -0
  70. mlpack/kfn.cp39-win_amd64.pyd +0 -0
  71. mlpack/kmeans.cp39-win_amd64.pyd +0 -0
  72. mlpack/knn.cp39-win_amd64.pyd +0 -0
  73. mlpack/krann.cp39-win_amd64.pyd +0 -0
  74. mlpack/lars.cp39-win_amd64.pyd +0 -0
  75. mlpack/linear_regression_predict.cp39-win_amd64.pyd +0 -0
  76. mlpack/linear_regression_train.cp39-win_amd64.pyd +0 -0
  77. mlpack/linear_svm.cp39-win_amd64.pyd +0 -0
  78. mlpack/lmnn.cp39-win_amd64.pyd +0 -0
  79. mlpack/local_coordinate_coding.cp39-win_amd64.pyd +0 -0
  80. mlpack/logistic_regression.cp39-win_amd64.pyd +0 -0
  81. mlpack/lsh.cp39-win_amd64.pyd +0 -0
  82. mlpack/mean_shift.cp39-win_amd64.pyd +0 -0
  83. mlpack/nbc.cp39-win_amd64.pyd +0 -0
  84. mlpack/nca.cp39-win_amd64.pyd +0 -0
  85. mlpack/nmf.cp39-win_amd64.pyd +0 -0
  86. mlpack/pca.cp39-win_amd64.pyd +0 -0
  87. mlpack/perceptron.cp39-win_amd64.pyd +0 -0
  88. mlpack/preprocess_binarize.cp39-win_amd64.pyd +0 -0
  89. mlpack/preprocess_describe.cp39-win_amd64.pyd +0 -0
  90. mlpack/preprocess_one_hot_encoding.cp39-win_amd64.pyd +0 -0
  91. mlpack/preprocess_scale.cp39-win_amd64.pyd +0 -0
  92. mlpack/preprocess_split.cp39-win_amd64.pyd +0 -0
  93. mlpack/radical.cp39-win_amd64.pyd +0 -0
  94. mlpack/random_forest.cp39-win_amd64.pyd +0 -0
  95. mlpack/softmax_regression.cp39-win_amd64.pyd +0 -0
  96. mlpack/sparse_coding.cp39-win_amd64.pyd +0 -0
  97. mlpack-4.6.2.dist-info/DELVEWHEEL +2 -0
  98. {mlpack-4.6.1.dist-info → mlpack-4.6.2.dist-info}/METADATA +2 -2
  99. {mlpack-4.6.1.dist-info → mlpack-4.6.2.dist-info}/RECORD +102 -102
  100. {mlpack-4.6.1.dist-info → mlpack-4.6.2.dist-info}/WHEEL +1 -1
  101. mlpack-4.6.1.dist-info/DELVEWHEEL +0 -2
  102. {mlpack-4.6.1.dist-info → mlpack-4.6.2.dist-info}/top_level.txt +0 -0
  103. /mlpack.libs/{.load-order-mlpack-4.6.1 → .load-order-mlpack-4.6.2} +0 -0
mlpack/__init__.py CHANGED
@@ -22,10 +22,10 @@ def _delvewheel_patch_1_10_1():
22
22
  if os.path.isdir(libs_dir):
23
23
  os.add_dll_directory(libs_dir)
24
24
  else:
25
- load_order_filepath = os.path.join(libs_dir, '.load-order-mlpack-4.6.1')
25
+ load_order_filepath = os.path.join(libs_dir, '.load-order-mlpack-4.6.2')
26
26
  if os.path.isfile(load_order_filepath):
27
27
  import ctypes.wintypes
28
- with open(os.path.join(libs_dir, '.load-order-mlpack-4.6.1')) as file:
28
+ with open(os.path.join(libs_dir, '.load-order-mlpack-4.6.2')) as file:
29
29
  load_order = file.read().split()
30
30
  kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
31
31
  kernel32.LoadLibraryExW.restype = ctypes.wintypes.HMODULE
@@ -93,4 +93,4 @@ from .adaboost import *
93
93
  from .linear_regression_train import linear_regression_train
94
94
  from .linear_regression_predict import linear_regression_predict
95
95
  from .linear_regression import *
96
- __version__='4.6.1'
96
+ __version__='4.6.2'
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -14,6 +14,7 @@
14
14
 
15
15
  #include <mlpack/core/cv/meta_info_extractor.hpp>
16
16
  #include <mlpack/core/cv/cv_base.hpp>
17
+ #include <mlpack/core/util/arma_traits.hpp>
17
18
 
18
19
  namespace mlpack {
19
20
 
@@ -280,30 +281,38 @@ class KFoldCV
280
281
  /**
281
282
  * Get the ith training subset from a variable of a matrix type.
282
283
  */
283
- template<typename ElementType>
284
- inline arma::Mat<ElementType> GetTrainingSubset(arma::Mat<ElementType>& m,
285
- const size_t i);
284
+ template<typename SubsetMatType>
285
+ inline SubsetMatType GetTrainingSubset(
286
+ SubsetMatType& m,
287
+ const size_t i,
288
+ const typename std::enable_if_t<IsMatrix<SubsetMatType>::value>* = 0);
286
289
 
287
290
  /**
288
291
  * Get the ith training subset from a variable of a row type.
289
292
  */
290
- template<typename ElementType>
291
- inline arma::Row<ElementType> GetTrainingSubset(arma::Row<ElementType>& r,
292
- const size_t i);
293
+ template<typename SubsetRowType>
294
+ inline SubsetRowType GetTrainingSubset(
295
+ SubsetRowType& r,
296
+ const size_t i,
297
+ const typename std::enable_if_t<IsRow<SubsetRowType>::value>* = 0);
293
298
 
294
299
  /**
295
300
  * Get the ith validation subset from a variable of a matrix type.
296
301
  */
297
- template<typename ElementType>
298
- inline arma::Mat<ElementType> GetValidationSubset(arma::Mat<ElementType>& m,
299
- const size_t i);
302
+ template<typename SubsetMatType>
303
+ inline SubsetMatType GetValidationSubset(
304
+ SubsetMatType& m,
305
+ const size_t i,
306
+ const typename std::enable_if_t<IsMatrix<SubsetMatType>::value>* = 0);
300
307
 
301
308
  /**
302
309
  * Get the ith validation subset from a variable of a row type.
303
310
  */
304
- template<typename ElementType>
305
- inline arma::Row<ElementType> GetValidationSubset(arma::Row<ElementType>& r,
306
- const size_t i);
311
+ template<typename SubsetRowType>
312
+ inline SubsetRowType GetValidationSubset(
313
+ SubsetRowType& r,
314
+ const size_t i,
315
+ const typename std::enable_if_t<IsRow<SubsetRowType>::value>* = 0);
307
316
  };
308
317
 
309
318
  } // namespace mlpack
@@ -375,14 +375,15 @@ template<typename MLAlgorithm,
375
375
  typename MatType,
376
376
  typename PredictionsType,
377
377
  typename WeightsType>
378
- template<typename ElementType>
379
- arma::Mat<ElementType> KFoldCV<MLAlgorithm,
380
- Metric,
381
- MatType,
382
- PredictionsType,
383
- WeightsType>::GetTrainingSubset(
384
- arma::Mat<ElementType>& m,
385
- const size_t i)
378
+ template<typename SubsetMatType>
379
+ SubsetMatType KFoldCV<MLAlgorithm,
380
+ Metric,
381
+ MatType,
382
+ PredictionsType,
383
+ WeightsType>::GetTrainingSubset(
384
+ SubsetMatType& m,
385
+ const size_t i,
386
+ const typename std::enable_if_t<IsMatrix<SubsetMatType>::value>*)
386
387
  {
387
388
  // If this is not the first fold, we have to handle it a little bit
388
389
  // differently, since the last fold may contain slightly more than 'binSize'
@@ -390,8 +391,9 @@ arma::Mat<ElementType> KFoldCV<MLAlgorithm,
390
391
  const size_t subsetSize = (i != 0) ? lastBinSize + (k - 2) * binSize :
391
392
  (k - 1) * binSize;
392
393
 
393
- return arma::Mat<ElementType>(m.colptr(binSize * i), m.n_rows, subsetSize,
394
- false, true);
394
+ SubsetMatType alias;
395
+ MakeAlias(alias, m, m.n_rows, subsetSize, m.n_rows * binSize * i);
396
+ return alias;
395
397
  }
396
398
 
397
399
  template<typename MLAlgorithm,
@@ -399,14 +401,15 @@ template<typename MLAlgorithm,
399
401
  typename MatType,
400
402
  typename PredictionsType,
401
403
  typename WeightsType>
402
- template<typename ElementType>
403
- arma::Row<ElementType> KFoldCV<MLAlgorithm,
404
- Metric,
405
- MatType,
406
- PredictionsType,
407
- WeightsType>::GetTrainingSubset(
408
- arma::Row<ElementType>& r,
409
- const size_t i)
404
+ template<typename SubsetRowType>
405
+ SubsetRowType KFoldCV<MLAlgorithm,
406
+ Metric,
407
+ MatType,
408
+ PredictionsType,
409
+ WeightsType>::GetTrainingSubset(
410
+ SubsetRowType& r,
411
+ const size_t i,
412
+ const typename std::enable_if_t<IsRow<SubsetRowType>::value>*)
410
413
  {
411
414
  // If this is not the first fold, we have to handle it a little bit
412
415
  // differently, since the last fold may contain slightly more than 'binSize'
@@ -414,7 +417,9 @@ arma::Row<ElementType> KFoldCV<MLAlgorithm,
414
417
  const size_t subsetSize = (i != 0) ? lastBinSize + (k - 2) * binSize :
415
418
  (k - 1) * binSize;
416
419
 
417
- return arma::Row<ElementType>(r.colptr(binSize * i), subsetSize, false, true);
420
+ SubsetRowType alias;
421
+ MakeAlias(alias, r, subsetSize, r.n_rows * binSize * i);
422
+ return alias;
418
423
  }
419
424
 
420
425
  template<typename MLAlgorithm,
@@ -422,18 +427,21 @@ template<typename MLAlgorithm,
422
427
  typename MatType,
423
428
  typename PredictionsType,
424
429
  typename WeightsType>
425
- template<typename ElementType>
426
- arma::Mat<ElementType> KFoldCV<MLAlgorithm,
427
- Metric,
428
- MatType,
429
- PredictionsType,
430
- WeightsType>::GetValidationSubset(
431
- arma::Mat<ElementType>& m,
432
- const size_t i)
430
+ template<typename SubsetMatType>
431
+ SubsetMatType KFoldCV<MLAlgorithm,
432
+ Metric,
433
+ MatType,
434
+ PredictionsType,
435
+ WeightsType>::GetValidationSubset(
436
+ SubsetMatType& m,
437
+ const size_t i,
438
+ const typename std::enable_if_t<IsMatrix<SubsetMatType>::value>*)
433
439
  {
434
440
  const size_t subsetSize = (i == 0) ? lastBinSize : binSize;
435
- return arma::Mat<ElementType>(m.colptr(ValidationSubsetFirstCol(i)), m.n_rows,
436
- subsetSize, false, true);
441
+ SubsetMatType alias;
442
+ MakeAlias(alias, m, m.n_rows, subsetSize,
443
+ m.n_rows * ValidationSubsetFirstCol(i));
444
+ return alias;
437
445
  }
438
446
 
439
447
  template<typename MLAlgorithm,
@@ -441,18 +449,20 @@ template<typename MLAlgorithm,
441
449
  typename MatType,
442
450
  typename PredictionsType,
443
451
  typename WeightsType>
444
- template<typename ElementType>
445
- arma::Row<ElementType> KFoldCV<MLAlgorithm,
446
- Metric,
447
- MatType,
448
- PredictionsType,
449
- WeightsType>::GetValidationSubset(
450
- arma::Row<ElementType>& r,
451
- const size_t i)
452
+ template<typename SubsetRowType>
453
+ SubsetRowType KFoldCV<MLAlgorithm,
454
+ Metric,
455
+ MatType,
456
+ PredictionsType,
457
+ WeightsType>::GetValidationSubset(
458
+ SubsetRowType& r,
459
+ const size_t i,
460
+ const typename std::enable_if_t<IsRow<SubsetRowType>::value>*)
452
461
  {
453
462
  const size_t subsetSize = (i == 0) ? lastBinSize : binSize;
454
- return arma::Row<ElementType>(r.colptr(ValidationSubsetFirstCol(i)),
455
- subsetSize, false, true);
463
+ SubsetRowType alias;
464
+ MakeAlias(alias, r, subsetSize, r.n_rows * ValidationSubsetFirstCol(i));
465
+ return alias;
456
466
  }
457
467
 
458
468
  } // namespace mlpack
@@ -73,6 +73,7 @@ inline FileType GuessFileType(std::istream& f)
73
73
  bool hasBinary = false;
74
74
  bool hasBracket = false;
75
75
  bool hasComma = false;
76
+ bool hasSemicolon = false;
76
77
 
77
78
  for (arma::uword i = 0; i < nUse; ++i)
78
79
  {
@@ -87,57 +88,16 @@ inline FileType GuessFileType(std::istream& f)
87
88
  {
88
89
  hasBracket = true;
89
90
  }
90
- if (val == ',')
91
+
92
+ if (val == ';')
91
93
  {
92
- hasComma = true;
94
+ hasSemicolon = true;
93
95
  }
94
- }
95
96
 
96
- if (hasComma && (hasBracket == false))
97
- {
98
- // If we believe we have a CSV file, then we want to try to skip any header
99
- // row. We'll detect a header row by simply seeing if anything in the first
100
- // line doesn't parse as a number.
101
- //
102
- // TODO: this is not a foolproof algorithm, so there should eventually be a
103
- // way added for the user to explicitly indicate that there is or isn't a
104
- // header.
105
- std::string firstLine;
106
- std::getline(f, firstLine);
107
-
108
- std::stringstream str(firstLine);
109
- std::string token;
110
- bool allNumeric = true;
111
- // We'll abuse 'getline()' to split on commas.
112
- while (std::getline(str, token, ','))
97
+ if (val == ',')
113
98
  {
114
- // Let's see if we can parse the token into a number.
115
- double num;
116
- std::string rest;
117
-
118
- // Try to parse into a number.
119
- std::stringstream s(token);
120
- s >> num;
121
- if (s.fail())
122
- {
123
- allNumeric = false;
124
- break;
125
- }
126
-
127
- // Now check to see there isn't anything else. (This catches cases like,
128
- // e.g., "1a".)
129
- s >> rest;
130
- if (rest.length() > 0)
131
- {
132
- allNumeric = false;
133
- break;
134
- }
99
+ hasComma = true;
135
100
  }
136
-
137
- // If we could parse everything into a number, then let's rewind `f` so that
138
- // it's at the start of the file.
139
- if (allNumeric)
140
- f.seekg(pos1);
141
101
  }
142
102
 
143
103
  delete[] dataMem;
@@ -145,6 +105,9 @@ inline FileType GuessFileType(std::istream& f)
145
105
  if (hasBinary)
146
106
  return FileType::RawBinary;
147
107
 
108
+ if (hasSemicolon && (hasBracket == false))
109
+ return FileType::CSVASCII;
110
+
148
111
  if (hasComma && (hasBracket == false))
149
112
  return FileType::CSVASCII;
150
113