Upload scikit-learn/SCIKIT-LEARN_USER_GUIDE.txt with huggingface_hub
Browse files
scikit-learn/SCIKIT-LEARN_USER_GUIDE.txt
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
================================================================================
|
| 2 |
+
SCIKIT-LEARN - USER GUIDE (Android Python STB) - Generated by RIMI
|
| 3 |
+
================================================================================
|
| 4 |
+
|
| 5 |
+
What is scikit-learn?
|
| 6 |
+
---------------------
|
| 7 |
+
scikit-learn is a Python module for machine learning built on top of SciPy
|
| 8 |
+
(numpy, scipy) and distributed under BSD-3-Clause. It provides simple and
|
| 9 |
+
efficient tools for predictive data analysis: classification, regression,
|
| 10 |
+
clustering, dimensionality reduction, model selection, preprocessing.
|
| 11 |
+
|
| 12 |
+
This wheel is cross-compiled for Android (cp312, android_24_x86_64 /
|
| 13 |
+
android_24_arm64_v8a, 16KB page, NoRELRO, single libc++_shared.so).
|
| 14 |
+
|
| 15 |
+
Installation
|
| 16 |
+
------------
|
| 17 |
+
Via PipManager in app or via Install_WHEELS_to_DEVICE.ps1 (option 1 ALL or 2 single):
|
| 18 |
+
pip install scikit_learn-1.7.1-cp312-cp312-android_24_x86_64.whl
|
| 19 |
+
|
| 20 |
+
Requires at runtime (all in WHEELS, pure+native):
|
| 21 |
+
numpy>=1.22.0 (6.4M android_24_x86_64, 16KB)
|
| 22 |
+
scipy>=1.8.0 (31M android_24_x86_64, 16KB, no C: RUNPATH)
|
| 23 |
+
joblib>=1.2.0 (0.29M pure)
|
| 24 |
+
threadpoolctl>=3.1.0 (0.02M pure)
|
| 25 |
+
|
| 26 |
+
No extra build deps needed at runtime (cython, meson-python only for building).
|
| 27 |
+
|
| 28 |
+
Quick Start (Android)
|
| 29 |
+
---------------------
|
| 30 |
+
import sklearn
|
| 31 |
+
print(sklearn.__version__) # 1.7.1
|
| 32 |
+
|
| 33 |
+
from sklearn.datasets import load_iris
|
| 34 |
+
X, y = load_iris(return_X_y=True) # X shape (150,4)
|
| 35 |
+
|
| 36 |
+
from sklearn.preprocessing import StandardScaler
|
| 37 |
+
scaler = StandardScaler()
|
| 38 |
+
Xt = scaler.fit_transform(X)
|
| 39 |
+
|
| 40 |
+
from sklearn.decomposition import PCA
|
| 41 |
+
pca = PCA(n_components=2)
|
| 42 |
+
Xt2 = pca.fit_transform(X) # shape (150,2)
|
| 43 |
+
|
| 44 |
+
from sklearn.cluster import KMeans
|
| 45 |
+
km = KMeans(n_clusters=3, n_init=10, random_state=42)
|
| 46 |
+
labels = km.fit_predict(X)
|
| 47 |
+
|
| 48 |
+
from sklearn.linear_model import LogisticRegression
|
| 49 |
+
clf = LogisticRegression(max_iter=200)
|
| 50 |
+
clf.fit(X[:100], y[:100])
|
| 51 |
+
pred = clf.predict(X[:5])
|
| 52 |
+
|
| 53 |
+
from sklearn.ensemble import RandomForestClassifier
|
| 54 |
+
clf = RandomForestClassifier(n_estimators=10, random_state=42)
|
| 55 |
+
clf.fit(X[:100], y[:100])
|
| 56 |
+
|
| 57 |
+
from sklearn.metrics import accuracy_score
|
| 58 |
+
acc = accuracy_score(y_true, y_pred)
|
| 59 |
+
|
| 60 |
+
from sklearn.model_selection import train_test_split, cross_val_score
|
| 61 |
+
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=0.25, random_state=42)
|
| 62 |
+
scores = cross_val_score(clf, X, y, cv=3)
|
| 63 |
+
|
| 64 |
+
API Gotchas (Android)
|
| 65 |
+
---------------------
|
| 66 |
+
- All 69 Cython extensions are 16KB page aligned (LOAD 0x4000, no GNU_RELRO,
|
| 67 |
+
NEEDED libc++_shared.so only, no C: RUNPATH). Verified via llvm-readelf.
|
| 68 |
+
- sklearn imports numpy/scipy/joblib/threadpoolctl — ensure those wheels
|
| 69 |
+
are installed first (Install_WHEELS_to_DEVICE.ps1 does it in sorted order).
|
| 70 |
+
- No tkinter/matplotlib required for core; plotting via matplotlib is optional
|
| 71 |
+
(extra, not needed for ML).
|
| 72 |
+
- For XGBoost sklearn interface (XGBRegressor/XGBClassifier), sklearn must be
|
| 73 |
+
installed (now in WHEELS 1.7.1, 7-8M).
|
| 74 |
+
|
| 75 |
+
Tested Features (Test_ScikitLearn.py)
|
| 76 |
+
-------------------------------------
|
| 77 |
+
- import sklearn, C extension _tree
|
| 78 |
+
- load_iris, load_digits
|
| 79 |
+
- StandardScaler, MinMaxScaler
|
| 80 |
+
- PCA (10->2)
|
| 81 |
+
- KMeans (3 clusters)
|
| 82 |
+
- LogisticRegression, LinearRegression
|
| 83 |
+
- RandomForestClassifier (10 trees)
|
| 84 |
+
- accuracy_score, mean_squared_error
|
| 85 |
+
- train_test_split, cross_val_score (3-fold)
|
| 86 |
+
|
| 87 |
+
All 15 tests PASS, 0 SKIP, 0 FAIL on Android x86_64 emulator (Python 3.12.14).
|
| 88 |
+
|
| 89 |
+
Platform Notes (Android)
|
| 90 |
+
------------------------
|
| 91 |
+
- Arch: x86_64 (emulator) and arm64-v8a (phone) — both 16KB, NoRELRO
|
| 92 |
+
- NDK r26, clang 17.0.2, LLD, -z norelro -z max-page-size=16384
|
| 93 |
+
- Links only to /data/app/.../lib/x86_64/libc++_shared.so (custom 1.3M, not NDK 4K)
|
| 94 |
+
+ librimi.so + libpython3.12.so.1.0 — no libc++.so/libc++abi.so/libunwind.
|
| 95 |
+
- No Windows C:/ paths in any .so (strings check 0).
|
| 96 |
+
|
| 97 |
+
Troubleshooting
|
| 98 |
+
---------------
|
| 99 |
+
- ImportError: No module named 'sklearn' → install wheel via PipManager
|
| 100 |
+
- ImportError: libomp.so → already handled via threadpoolctl, no extra
|
| 101 |
+
- If Test_ScikitLearn shows SKIP for missing joblib/threadpoolctl, install
|
| 102 |
+
those pure wheels first (they are in WHEELS).
|
| 103 |
+
|
| 104 |
+
================================================================================
|
| 105 |
+
Generated by RIMI
|
| 106 |
+
================================================================================
|