Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
thierrymoudiki committed Oct 6, 2024
1 parent f99dd1c commit 07c8b1c
Show file tree
Hide file tree
Showing 44 changed files with 10,119 additions and 10,599 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ clean-build: ## remove build artifacts
rm -fr build/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
find . -name '*.egg' -exec rm -rf {} +
find . -name '*.so' -exec rm -f {} +
find . -name '*.c' -exec rm -f {} +

Expand Down
8,415 changes: 4,300 additions & 4,115 deletions mlsauce-docs/mlsauce.html

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions mlsauce-docs/mlsauce/_config.html

Large diffs are not rendered by default.

407 changes: 16 additions & 391 deletions mlsauce-docs/mlsauce/adaopt.html

Large diffs are not rendered by default.

4,026 changes: 1,539 additions & 2,487 deletions mlsauce-docs/mlsauce/booster.html

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions mlsauce-docs/mlsauce/datasets.html

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions mlsauce-docs/mlsauce/datasets/dowload.html

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions mlsauce-docs/mlsauce/demo.html

Large diffs are not rendered by default.

409 changes: 136 additions & 273 deletions mlsauce-docs/mlsauce/elasticnet.html

Large diffs are not rendered by default.

680 changes: 265 additions & 415 deletions mlsauce-docs/mlsauce/lasso.html

Large diffs are not rendered by default.

2,344 changes: 2,344 additions & 0 deletions mlsauce-docs/mlsauce/lazybooster.html

Large diffs are not rendered by default.

881 changes: 29 additions & 852 deletions mlsauce-docs/mlsauce/nonconformist.html

Large diffs are not rendered by default.

372 changes: 13 additions & 359 deletions mlsauce-docs/mlsauce/predictioninterval.html

Large diffs are not rendered by default.

566 changes: 221 additions & 345 deletions mlsauce-docs/mlsauce/ridge.html

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions mlsauce-docs/mlsauce/setup.html

Large diffs are not rendered by default.

199 changes: 16 additions & 183 deletions mlsauce-docs/mlsauce/stump.html

Large diffs are not rendered by default.

350 changes: 59 additions & 291 deletions mlsauce-docs/mlsauce/utils.html

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions mlsauce-docs/mlsauce/utils/get_beta.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mlsauce-docs/search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mlsauce.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: mlsauce
Version: 0.20.2
Version: 0.20.3
Summary: Miscellaneous Statistical/Machine Learning tools
Maintainer: T. Moudiki
Maintainer-email: [email protected]
Expand Down
314 changes: 157 additions & 157 deletions mlsauce/adaopt/_adaoptc.c

Large diffs are not rendered by default.

Binary file added mlsauce/adaopt/_adaoptc.cpython-311-darwin.so
Binary file not shown.
Binary file not shown.
200 changes: 199 additions & 1 deletion mlsauce/booster/_booster_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,204 @@ class LSBoostClassifier(BaseEstimator, ClassifierMixin):
distribution of weights for constructing the model's hidden layer;
currently 'uniform', 'gaussian'
Examples:
```python
import numpy as np
from sklearn.datasets import load_digits, load_breast_cancer, load_wine, load_iris
from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score
from sklearn.tree import DecisionTreeRegressor
from sklearn.kernel_ridge import KernelRidge
from time import time
from os import chdir
from sklearn import metrics
import os
import mlsauce as ms
print("\n")
print("GenericBoosting Decision tree -----")
print("\n")
print("\n")
print("breast_cancer data -----")
# data 1
breast_cancer = load_breast_cancer()
X = breast_cancer.data
y = breast_cancer.target
# split data into training test and test set
np.random.seed(15029)
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.2)
clf = DecisionTreeRegressor()
clf2 = KernelRidge()
obj = ms.GenericBoostingClassifier(clf, tolerance=1e-2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
obj = ms.GenericBoostingClassifier(clf, tolerance=1e-2, n_clusters=2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
# data 2
print("\n")
print("wine data -----")
wine = load_wine()
Z = wine.data
t = wine.target
np.random.seed(879423)
X_train, X_test, y_train, y_test = train_test_split(Z, t,
test_size=0.2)
obj = ms.GenericBoostingClassifier(clf)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
obj = ms.GenericBoostingClassifier(clf, n_clusters=3)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
# data 3
print("\n")
print("iris data -----")
iris = load_iris()
Z = iris.data
t = iris.target
np.random.seed(734563)
X_train, X_test, y_train, y_test = train_test_split(Z, t,
test_size=0.2)
obj = ms.GenericBoostingClassifier(clf)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
print("\n")
print("GenericBoosting KRR -----")
print("\n")
obj = ms.GenericBoostingClassifier(clf2, tolerance=1e-2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
obj = ms.GenericBoostingClassifier(clf2, tolerance=1e-2, n_clusters=2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
# data 2
print("\n")
print("wine data -----")
wine = load_wine()
Z = wine.data
t = wine.target
np.random.seed(879423)
X_train, X_test, y_train, y_test = train_test_split(Z, t,
test_size=0.2)
obj = ms.GenericBoostingClassifier(clf2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
obj = ms.GenericBoostingClassifier(clf2, n_clusters=3)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
# data 3
print("\n")
print("iris data -----")
iris = load_iris()
Z = iris.data
t = iris.target
np.random.seed(734563)
X_train, X_test, y_train, y_test = train_test_split(Z, t,
test_size=0.2)
obj = ms.GenericBoostingClassifier(clf2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(obj.score(X_test, y_test))
print(time()-start)
print(obj.obj['loss'])
```
"""

def __init__(
Expand Down Expand Up @@ -302,7 +500,7 @@ def predict_proba(self, X, **kwargs):
self.obj, np.asarray(X, order="C")
)
except ValueError:
pass
pass


class GenericBoostingClassifier(LSBoostClassifier):
Expand Down
56 changes: 54 additions & 2 deletions mlsauce/booster/_booster_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,58 @@ class LSBoostRegressor(BaseEstimator, RegressorMixin):
distribution of weights for constructing the model's hidden layer;
either 'uniform' or 'gaussian'
Examples:
```python
import subprocess
import sys
import os
subprocess.check_call([sys.executable, "-m", "pip", "install", "matplotlib"])
import mlsauce as ms
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score
from sklearn.tree import DecisionTreeRegressor
from time import time
from os import chdir
from sklearn import metrics
regr = DecisionTreeRegressor()
diabetes = load_diabetes()
X = diabetes.data
y = diabetes.target
# split data into training test and test set
np.random.seed(15029)
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.2)
obj = ms.GenericBoostingRegressor(regr, col_sample=0.9, row_sample=0.9)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(np.sqrt(np.mean(np.square(obj.predict(X_test) - y_test))))
print(time()-start)
print(obj.obj['loss'])
obj = ms.GenericBoostingRegressor(regr, col_sample=0.9, row_sample=0.9, n_clusters=2)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print(time()-start)
start = time()
print(np.sqrt(np.mean(np.square(obj.predict(X_test) - y_test))))
print(time()-start)
print(obj.obj['loss'])
```
"""

def __init__(
Expand Down Expand Up @@ -251,7 +303,7 @@ def fit(self, X, y, **kwargs):
obj=self.base_model,
)
except ValueError:
pass
pass

self.n_estimators = self.obj["n_estimators"]

Expand Down Expand Up @@ -329,7 +381,7 @@ def predict(self, X, level=95, method=None, **kwargs):
self.obj, np.asarray(X, order="C")
)
except ValueError:
pass
pass


class GenericBoostingRegressor(LSBoostRegressor):
Expand Down
Loading

0 comments on commit 07c8b1c

Please sign in to comment.