scm2cpp-lasso 0.9.0__tar.gz → 0.10.0__tar.gz

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 (63) hide show
  1. {scm2cpp_lasso-0.9.0/src/scm2cpp_lasso.egg-info → scm2cpp_lasso-0.10.0}/PKG-INFO +69 -2
  2. scm2cpp_lasso-0.9.0/PKG-INFO → scm2cpp_lasso-0.10.0/README.md +67 -18
  3. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/pyproject.toml +2 -2
  4. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/setup.py +3 -2
  5. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/__init__.py +486 -25
  6. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_classifiers.py +38 -18
  7. scm2cpp_lasso-0.10.0/src/scm2cpp_lasso/_generated/_loader_gramops_blas.py +387 -0
  8. scm2cpp_lasso-0.10.0/src/scm2cpp_lasso/_generated/_loader_gramops_loops.py +387 -0
  9. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/classifiers.cpp +3 -0
  10. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/classifiers.hpp +401 -74
  11. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/classifiers_capi.cpp +21 -12
  12. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/gramops_blas/gramops.cpp +34 -0
  13. scm2cpp_lasso-0.10.0/src/scm2cpp_lasso/_generated/gramops_blas/gramops.hpp +2223 -0
  14. scm2cpp_lasso-0.10.0/src/scm2cpp_lasso/_generated/gramops_blas/gramops_capi.cpp +133 -0
  15. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/gramops_loops/gramops.cpp +34 -0
  16. scm2cpp_lasso-0.10.0/src/scm2cpp_lasso/_generated/gramops_loops/gramops.hpp +2408 -0
  17. scm2cpp_lasso-0.10.0/src/scm2cpp_lasso/_generated/gramops_loops/gramops_capi.cpp +133 -0
  18. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/scm2cpp-blas.hpp +14 -4
  19. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_libfind.py +1 -1
  20. scm2cpp_lasso-0.9.0/README.md → scm2cpp_lasso-0.10.0/src/scm2cpp_lasso.egg-info/PKG-INFO +85 -0
  21. scm2cpp_lasso-0.9.0/src/scm2cpp_lasso/_generated/_loader_gramops_blas.py +0 -75
  22. scm2cpp_lasso-0.9.0/src/scm2cpp_lasso/_generated/_loader_gramops_loops.py +0 -75
  23. scm2cpp_lasso-0.9.0/src/scm2cpp_lasso/_generated/gramops_blas/gramops.hpp +0 -469
  24. scm2cpp_lasso-0.9.0/src/scm2cpp_lasso/_generated/gramops_blas/gramops_capi.cpp +0 -31
  25. scm2cpp_lasso-0.9.0/src/scm2cpp_lasso/_generated/gramops_loops/gramops.hpp +0 -499
  26. scm2cpp_lasso-0.9.0/src/scm2cpp_lasso/_generated/gramops_loops/gramops_capi.cpp +0 -31
  27. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/setup.cfg +0 -0
  28. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/__init__.py +0 -0
  29. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader.py +0 -0
  30. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_derived_blas.py +0 -0
  31. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_derived_cublas.py +0 -0
  32. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_derived_loops.py +0 -0
  33. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_nmf_blas.py +0 -0
  34. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_nmf_cublas.py +0 -0
  35. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/_loader_nmf_loops.py +0 -0
  36. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_blas/lasso_design.cpp +0 -0
  37. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_blas/lasso_design.hpp +0 -0
  38. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_blas/lasso_design_capi.cpp +0 -0
  39. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_cublas/lasso_design.cpp +0 -0
  40. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_cublas/lasso_design.hpp +0 -0
  41. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_cublas/lasso_design_capi.cpp +0 -0
  42. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_loops/lasso_design.cpp +0 -0
  43. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_loops/lasso_design.hpp +0 -0
  44. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/derived_loops/lasso_design_capi.cpp +0 -0
  45. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/lasso_cov.cpp +0 -0
  46. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/lasso_cov.hpp +0 -0
  47. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/lasso_cov_capi.cpp +0 -0
  48. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_blas/nmf_cd.cpp +0 -0
  49. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_blas/nmf_cd.hpp +0 -0
  50. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_blas/nmf_cd_capi.cpp +0 -0
  51. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_cublas/nmf_cd.cpp +0 -0
  52. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_cublas/nmf_cd.hpp +0 -0
  53. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_cublas/nmf_cd_capi.cpp +0 -0
  54. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_loops/nmf_cd.cpp +0 -0
  55. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_loops/nmf_cd.hpp +0 -0
  56. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/nmf_loops/nmf_cd_capi.cpp +0 -0
  57. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/scm2cpp-cublas.hpp +0 -0
  58. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/_generated/scm2cpp.hpp +0 -0
  59. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso/batch_capi.cu +0 -0
  60. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso.egg-info/SOURCES.txt +0 -0
  61. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso.egg-info/dependency_links.txt +0 -0
  62. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso.egg-info/requires.txt +0 -0
  63. {scm2cpp_lasso-0.9.0 → scm2cpp_lasso-0.10.0}/src/scm2cpp_lasso.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scm2cpp-lasso
3
- Version: 0.9.0
4
- Summary: Lasso, elastic net, ridge, SVM, SVR, L1 logistic, NMF, graphical lasso, RANSAC, SGD, OMP and LARS translated from Scheme to C++ by scm2cpp; GPU batch solver included
3
+ Version: 0.10.0
4
+ Summary: scikit-learn estimators (lasso, elastic net, ridge, ARD, SVM, SVR, logistic regression, Huber, NMF, Gaussian mixture, FastICA, PCA, graphical lasso, RANSAC, SGD, OMP, LARS) translated from Scheme to C++ by scm2cpp; GPU batch solver included
5
5
  Author: Hirotaka Niitsuma
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/niitsuma/scm2cpp
@@ -623,6 +623,73 @@ repository README's table: 1.0-3.3x for SGD, 1.1-2.8x for OMP and
623
623
  1.2-5.0x for LARS, largest on small problems, where scikit-learn's
624
624
  Python between steps dominates.
625
625
 
626
+ ## L2 logistic regression and Huber: `LBFGSLogisticRegression`, `LBFGSHuberRegressor`
627
+
628
+ `LogisticRegression(solver="lbfgs")` (the default; two classes
629
+ binomial, more multinomial) and `HuberRegressor`, with scipy's
630
+ L-BFGS-B written out in the subset under them. The products are dgemm
631
+ or dgemv where a CBLAS links.
632
+
633
+ ```python
634
+ from scm2cpp_lasso import LBFGSLogisticRegression, LBFGSHuberRegressor
635
+ LBFGSLogisticRegression(C=1.0).fit(X, y).predict_proba(X_new)
636
+ LBFGSHuberRegressor(epsilon=1.35).fit(X, y).coef_
637
+ ```
638
+
639
+ Both take scikit-learn's iterations one for one and give its
640
+ coefficients to rounding (1e-13 at worst). The speed is the repository
641
+ README's table: 1.1-8x for the logistic regression (near 1x on a large
642
+ binary problem, where both sides are two matrix-vector products per
643
+ evaluation) and 2.5-18x for Huber.
644
+
645
+ ## Gaussian mixture, FastICA, PCA: `EMGaussianMixture`, `ParallelFastICA`, `CovPCA`
646
+
647
+ `GaussianMixture(covariance_type="full")`, `FastICA` at its defaults
648
+ and `PCA` by the covariance's eigenvectors (scikit-learn's
649
+ "covariance_eigh", what "auto" picks for a tall design), each
650
+ scikit-learn's algorithm translated, the products dgemm / dsyrk where a
651
+ CBLAS links and the eigenproblem written in the subset.
652
+
653
+ ```python
654
+ from scm2cpp_lasso import EMGaussianMixture, ParallelFastICA, CovPCA
655
+ EMGaussianMixture(4, random_state=0).fit(X).predict(X) # KMeans start: scikit-learn's
656
+ ParallelFastICA(random_state=0).fit(X).transform(X)
657
+ CovPCA(n_components=10).fit(X).components_
658
+ ```
659
+
660
+ From the same `random_state` each takes scikit-learn's iterations and
661
+ lands on its parameters to rounding. The speed is the repository
662
+ README's table: 1.6-2.4x for the mixture, 1.1-1.4x for FastICA, and
663
+ for PCA 1.3-4x up to about 100 features, 0.6-0.8x at 200-500, where
664
+ LAPACK's eigensolver wins.
665
+
666
+ ## Perceptron, ARD, LassoLarsIC, L1 linear SVM: `SGDPerceptron`, `CovARDRegression`, `GramLassoLarsIC`, `L1LinearSVM`
667
+
668
+ - `SGDPerceptron` is `Perceptron`. `SGDLinearClassifier` /
669
+ `SGDLinearRegressor` also take `loss="perceptron"` /
670
+ `"epsilon_insensitive"`, `learning_rate="constant"` / `"pa1"` /
671
+ `"pa2"` and `penalty=None`, which covers scikit-learn's replacements
672
+ for the passive-aggressive estimators. All run with shuffle=False.
673
+ - `CovARDRegression` is `ARDRegression` (n >= p). With `hoist=True`,
674
+ the default, the kept features' Gram comes from X'X formed once;
675
+ `hoist=False` forms it every iteration, as scikit-learn does.
676
+ - `GramLassoLarsIC` is `LassoLarsIC`. The whole lasso path comes from
677
+ the translated LARS, and the criterion is evaluated from the Gram.
678
+ - `L1LinearSVM` is `LinearSVC(penalty="l1", dual=False)`, liblinear's
679
+ solve_l1r_l2_svc. It agrees with scikit-learn to the tolerance,
680
+ because the coordinate order comes from another generator.
681
+
682
+ ```python
683
+ from scm2cpp_lasso import SGDPerceptron, CovARDRegression, GramLassoLarsIC, L1LinearSVM
684
+ SGDPerceptron().fit(X, y)
685
+ CovARDRegression().fit(X, y).coef_
686
+ GramLassoLarsIC("bic").fit(X, y).alpha_
687
+ L1LinearSVM(C=1.0).fit(X, y).coef_
688
+ ```
689
+
690
+ Speed, from the repository README's table: SGD 1.2-3x, ARD 1.6-1.9x
691
+ (3x with the Gram hoisted), LassoLarsIC 8-20x, the L1 SVM 1.1-1.5x.
692
+
626
693
  ## Logistic regression with L1
627
694
 
628
695
  `CovLogistic` solves L1-penalized logistic regression by
@@ -1,21 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: scm2cpp-lasso
3
- Version: 0.9.0
4
- Summary: Lasso, elastic net, ridge, SVM, SVR, L1 logistic, NMF, graphical lasso, RANSAC, SGD, OMP and LARS translated from Scheme to C++ by scm2cpp; GPU batch solver included
5
- Author: Hirotaka Niitsuma
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/niitsuma/scm2cpp
8
- Project-URL: Source, https://github.com/niitsuma/scm2cpp/tree/master/python/scm2cpp-lasso
9
- Keywords: lasso,elastic-net,ridge,svm,logistic-regression,coordinate-descent,cuda,compiler
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: C++
13
- Classifier: Topic :: Scientific/Engineering :: Mathematics
14
- Classifier: Intended Audience :: Science/Research
15
- Requires-Python: >=3.8
16
- Description-Content-Type: text/markdown
17
- Requires-Dist: numpy>=1.17
18
-
19
1
  # scm2cpp-lasso
20
2
 
21
3
  *[Japanese (README.ja.md)](README.ja.md)*
@@ -623,6 +605,73 @@ repository README's table: 1.0-3.3x for SGD, 1.1-2.8x for OMP and
623
605
  1.2-5.0x for LARS, largest on small problems, where scikit-learn's
624
606
  Python between steps dominates.
625
607
 
608
+ ## L2 logistic regression and Huber: `LBFGSLogisticRegression`, `LBFGSHuberRegressor`
609
+
610
+ `LogisticRegression(solver="lbfgs")` (the default; two classes
611
+ binomial, more multinomial) and `HuberRegressor`, with scipy's
612
+ L-BFGS-B written out in the subset under them. The products are dgemm
613
+ or dgemv where a CBLAS links.
614
+
615
+ ```python
616
+ from scm2cpp_lasso import LBFGSLogisticRegression, LBFGSHuberRegressor
617
+ LBFGSLogisticRegression(C=1.0).fit(X, y).predict_proba(X_new)
618
+ LBFGSHuberRegressor(epsilon=1.35).fit(X, y).coef_
619
+ ```
620
+
621
+ Both take scikit-learn's iterations one for one and give its
622
+ coefficients to rounding (1e-13 at worst). The speed is the repository
623
+ README's table: 1.1-8x for the logistic regression (near 1x on a large
624
+ binary problem, where both sides are two matrix-vector products per
625
+ evaluation) and 2.5-18x for Huber.
626
+
627
+ ## Gaussian mixture, FastICA, PCA: `EMGaussianMixture`, `ParallelFastICA`, `CovPCA`
628
+
629
+ `GaussianMixture(covariance_type="full")`, `FastICA` at its defaults
630
+ and `PCA` by the covariance's eigenvectors (scikit-learn's
631
+ "covariance_eigh", what "auto" picks for a tall design), each
632
+ scikit-learn's algorithm translated, the products dgemm / dsyrk where a
633
+ CBLAS links and the eigenproblem written in the subset.
634
+
635
+ ```python
636
+ from scm2cpp_lasso import EMGaussianMixture, ParallelFastICA, CovPCA
637
+ EMGaussianMixture(4, random_state=0).fit(X).predict(X) # KMeans start: scikit-learn's
638
+ ParallelFastICA(random_state=0).fit(X).transform(X)
639
+ CovPCA(n_components=10).fit(X).components_
640
+ ```
641
+
642
+ From the same `random_state` each takes scikit-learn's iterations and
643
+ lands on its parameters to rounding. The speed is the repository
644
+ README's table: 1.6-2.4x for the mixture, 1.1-1.4x for FastICA, and
645
+ for PCA 1.3-4x up to about 100 features, 0.6-0.8x at 200-500, where
646
+ LAPACK's eigensolver wins.
647
+
648
+ ## Perceptron, ARD, LassoLarsIC, L1 linear SVM: `SGDPerceptron`, `CovARDRegression`, `GramLassoLarsIC`, `L1LinearSVM`
649
+
650
+ - `SGDPerceptron` is `Perceptron`. `SGDLinearClassifier` /
651
+ `SGDLinearRegressor` also take `loss="perceptron"` /
652
+ `"epsilon_insensitive"`, `learning_rate="constant"` / `"pa1"` /
653
+ `"pa2"` and `penalty=None`, which covers scikit-learn's replacements
654
+ for the passive-aggressive estimators. All run with shuffle=False.
655
+ - `CovARDRegression` is `ARDRegression` (n >= p). With `hoist=True`,
656
+ the default, the kept features' Gram comes from X'X formed once;
657
+ `hoist=False` forms it every iteration, as scikit-learn does.
658
+ - `GramLassoLarsIC` is `LassoLarsIC`. The whole lasso path comes from
659
+ the translated LARS, and the criterion is evaluated from the Gram.
660
+ - `L1LinearSVM` is `LinearSVC(penalty="l1", dual=False)`, liblinear's
661
+ solve_l1r_l2_svc. It agrees with scikit-learn to the tolerance,
662
+ because the coordinate order comes from another generator.
663
+
664
+ ```python
665
+ from scm2cpp_lasso import SGDPerceptron, CovARDRegression, GramLassoLarsIC, L1LinearSVM
666
+ SGDPerceptron().fit(X, y)
667
+ CovARDRegression().fit(X, y).coef_
668
+ GramLassoLarsIC("bic").fit(X, y).alpha_
669
+ L1LinearSVM(C=1.0).fit(X, y).coef_
670
+ ```
671
+
672
+ Speed, from the repository README's table: SGD 1.2-3x, ARD 1.6-1.9x
673
+ (3x with the Gram hoisted), LassoLarsIC 8-20x, the L1 SVM 1.1-1.5x.
674
+
626
675
  ## Logistic regression with L1
627
676
 
628
677
  `CovLogistic` solves L1-penalized logistic regression by
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scm2cpp-lasso"
7
- version = "0.9.0"
8
- description = "Lasso, elastic net, ridge, SVM, SVR, L1 logistic, NMF, graphical lasso, RANSAC, SGD, OMP and LARS translated from Scheme to C++ by scm2cpp; GPU batch solver included"
7
+ version = "0.10.0"
8
+ description = "scikit-learn estimators (lasso, elastic net, ridge, ARD, SVM, SVR, logistic regression, Huber, NMF, Gaussian mixture, FastICA, PCA, graphical lasso, RANSAC, SGD, OMP, LARS) translated from Scheme to C++ by scm2cpp; GPU batch solver included"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
11
  license = {text = "MIT"}
@@ -170,8 +170,9 @@ else:
170
170
  extra_compile_args=_cls_flags,
171
171
  )
172
172
 
173
- # The Gram solvers (graphical lasso, OMP): their products as dgemv /
174
- # dsyrk where a CBLAS links, loops otherwise.
173
+ # The solvers with BLAS products (graphical lasso, OMP, L-BFGS for the
174
+ # logistic and Huber objectives): dgemm / dgemv / dsyrk where a CBLAS
175
+ # links, loops otherwise.
175
176
  if _blas is not None:
176
177
  gramops = Extension(
177
178
  "scm2cpp_lasso._gramops_blas",