update project
Browse files- .pre-commit-config.yaml +34 -0
- README.md +4 -4
- app.py +260 -0
- poetry.lock +0 -0
- poetry.toml +2 -0
- pyproject.toml +53 -0
- requirements.txt +74 -0
.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# See https://pre-commit.com for more information
|
| 2 |
+
# See https://pre-commit.com/hooks.html for more hooks
|
| 3 |
+
repos:
|
| 4 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
| 5 |
+
rev: v4.4.0
|
| 6 |
+
hooks:
|
| 7 |
+
- id: trailing-whitespace
|
| 8 |
+
- id: end-of-file-fixer
|
| 9 |
+
- id: check-yaml
|
| 10 |
+
# - id: check-added-large-files
|
| 11 |
+
- repo: https://github.com/psf/black
|
| 12 |
+
rev: 23.3.0
|
| 13 |
+
hooks:
|
| 14 |
+
# - id: black
|
| 15 |
+
- id: black-jupyter
|
| 16 |
+
- repo: https://github.com/pycqa/isort
|
| 17 |
+
rev: 5.12.0
|
| 18 |
+
hooks:
|
| 19 |
+
- id: isort
|
| 20 |
+
name: isort (python)
|
| 21 |
+
- repo: https://github.com/asottile/pyupgrade
|
| 22 |
+
rev: v3.3.1
|
| 23 |
+
hooks:
|
| 24 |
+
- id: pyupgrade
|
| 25 |
+
args: [--py311-plus]
|
| 26 |
+
- repo: https://github.com/nbQA-dev/nbQA
|
| 27 |
+
rev: 1.7.0
|
| 28 |
+
hooks:
|
| 29 |
+
- id: nbqa-isort
|
| 30 |
+
- id: nbqa-black
|
| 31 |
+
- id: nbqa-pyupgrade
|
| 32 |
+
args: [--py311-plus]
|
| 33 |
+
default_language_version:
|
| 34 |
+
python: python3.11
|
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
title: Sklearn
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.24.1
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Sklearn Lm L1 L2 Sparsity
|
| 3 |
+
emoji: 📉
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.24.1
|
| 8 |
app_file: app.py
|
app.py
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import matplotlib
|
| 5 |
+
from sklearn.svm import OneClassSVM
|
| 6 |
+
from sklearn.linear_model import SGDOneClassSVM
|
| 7 |
+
from sklearn.kernel_approximation import Nystroem
|
| 8 |
+
from sklearn.pipeline import make_pipeline
|
| 9 |
+
|
| 10 |
+
font = {"weight": "normal", "size": 15}
|
| 11 |
+
|
| 12 |
+
matplotlib.rc("font", **font)
|
| 13 |
+
|
| 14 |
+
random_state = 42
|
| 15 |
+
rng = np.random.default_rng(random_state)
|
| 16 |
+
|
| 17 |
+
# Generate train data
|
| 18 |
+
X = 0.3 * rng.random((500, 2))
|
| 19 |
+
X_train = np.r_[X + 2, X - 2]
|
| 20 |
+
# Generate some regular novel observations
|
| 21 |
+
X = 0.3 * rng.random((20, 2))
|
| 22 |
+
X_test = np.r_[X + 2, X - 2]
|
| 23 |
+
# Generate some abnormal novel observations
|
| 24 |
+
X_outliers = rng.uniform(low=-4, high=4, size=(20, 2))
|
| 25 |
+
|
| 26 |
+
xx, yy = np.meshgrid(np.linspace(-4.5, 4.5, 50), np.linspace(-4.5, 4.5, 50))
|
| 27 |
+
|
| 28 |
+
# OCSVM hyperparameters
|
| 29 |
+
# nu = 0.05
|
| 30 |
+
# gamma = 2.0
|
| 31 |
+
|
| 32 |
+
md_description = """
|
| 33 |
+
# A 1D regression with decision tree.
|
| 34 |
+
|
| 35 |
+
The [decision trees](https://scikit-learn.org/stable/modules/tree.html#tree) is used to fit a sine curve with addition noisy observation. As a result, it learns local linear regressions approximating the sine curve.
|
| 36 |
+
|
| 37 |
+
We can see that if the maximum depth of the tree (controlled by the max_depth parameter) is set too high, the decision trees learn too fine details of the training data and learn from the noise, i.e. they overfit.
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def make_regression(nu, gamma):
|
| 42 |
+
clf = OneClassSVM(gamma=gamma, kernel="rbf", nu=nu)
|
| 43 |
+
clf.fit(X_train)
|
| 44 |
+
y_pred_train = clf.predict(X_train)
|
| 45 |
+
y_pred_test = clf.predict(X_test)
|
| 46 |
+
y_pred_outliers = clf.predict(X_outliers)
|
| 47 |
+
n_error_train = y_pred_train[y_pred_train == -1].size
|
| 48 |
+
n_error_test = y_pred_test[y_pred_test == -1].size
|
| 49 |
+
n_error_outliers = y_pred_outliers[y_pred_outliers == 1].size
|
| 50 |
+
|
| 51 |
+
Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])
|
| 52 |
+
Z = Z.reshape(xx.shape)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# Fit the One-Class SVM using a kernel approximation and SGD
|
| 56 |
+
transform = Nystroem(gamma=gamma, random_state=random_state)
|
| 57 |
+
clf_sgd = SGDOneClassSVM(
|
| 58 |
+
nu=nu, shuffle=True, fit_intercept=True, random_state=random_state, tol=1e-4
|
| 59 |
+
)
|
| 60 |
+
pipe_sgd = make_pipeline(transform, clf_sgd)
|
| 61 |
+
pipe_sgd.fit(X_train)
|
| 62 |
+
y_pred_train_sgd = pipe_sgd.predict(X_train)
|
| 63 |
+
y_pred_test_sgd = pipe_sgd.predict(X_test)
|
| 64 |
+
y_pred_outliers_sgd = pipe_sgd.predict(X_outliers)
|
| 65 |
+
n_error_train_sgd = y_pred_train_sgd[y_pred_train_sgd == -1].size
|
| 66 |
+
n_error_test_sgd = y_pred_test_sgd[y_pred_test_sgd == -1].size
|
| 67 |
+
n_error_outliers_sgd = y_pred_outliers_sgd[y_pred_outliers_sgd == 1].size
|
| 68 |
+
|
| 69 |
+
Z_sgd = pipe_sgd.decision_function(np.c_[xx.ravel(), yy.ravel()])
|
| 70 |
+
Z_sgd = Z_sgd.reshape(xx.shape)
|
| 71 |
+
|
| 72 |
+
def make_fig_1():
|
| 73 |
+
# plot the level sets of the decision function
|
| 74 |
+
fig = plt.figure(figsize=(9, 6))
|
| 75 |
+
# fig, ax = plt.subplots(1, 1, figsize=(9,6))
|
| 76 |
+
ax = fig.add_subplot(111)
|
| 77 |
+
|
| 78 |
+
ax.set_title("One Class SVM")
|
| 79 |
+
ax.contourf(xx, yy, Z, levels=np.linspace(Z.min(), 0, 7), cmap=plt.cm.PuBu)
|
| 80 |
+
a = ax.contour(xx, yy, Z, levels=[0], linewidths=2, colors="darkred")
|
| 81 |
+
ax.contourf(xx, yy, Z, levels=[0, Z.max()], colors="palevioletred")
|
| 82 |
+
|
| 83 |
+
s = 20
|
| 84 |
+
b1 = ax.scatter(X_train[:, 0], X_train[:, 1], c="white", s=s, edgecolors="k")
|
| 85 |
+
b2 = ax.scatter(X_test[:, 0], X_test[:, 1], c="blueviolet", s=s, edgecolors="k")
|
| 86 |
+
c = ax.scatter(X_outliers[:, 0], X_outliers[:, 1], c="gold", s=s, edgecolors="k")
|
| 87 |
+
ax.axis("tight")
|
| 88 |
+
ax.set_xlim((-4.5, 4.5))
|
| 89 |
+
ax.set_ylim((-4.5, 4.5))
|
| 90 |
+
ax.legend(
|
| 91 |
+
[a.collections[0], b1, b2, c],
|
| 92 |
+
[
|
| 93 |
+
"learned frontier",
|
| 94 |
+
"training observations",
|
| 95 |
+
"new regular observations",
|
| 96 |
+
"new abnormal observations",
|
| 97 |
+
],
|
| 98 |
+
loc="upper left",
|
| 99 |
+
)
|
| 100 |
+
ax.set_xlabel(
|
| 101 |
+
"error train: %d/%d; errors novel regular: %d/%d; errors novel abnormal: %d/%d"
|
| 102 |
+
% (
|
| 103 |
+
n_error_train,
|
| 104 |
+
X_train.shape[0],
|
| 105 |
+
n_error_test,
|
| 106 |
+
X_test.shape[0],
|
| 107 |
+
n_error_outliers,
|
| 108 |
+
X_outliers.shape[0],
|
| 109 |
+
)
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
return fig
|
| 113 |
+
|
| 114 |
+
def make_fig_2():
|
| 115 |
+
fig = plt.figure(figsize=(9, 6))
|
| 116 |
+
ax = fig.add_subplot(111)
|
| 117 |
+
# fig, ax = plt.subplots(1, 1)
|
| 118 |
+
|
| 119 |
+
ax.set_title("Online One-Class SVM2")
|
| 120 |
+
ax.contourf(xx, yy, Z_sgd, levels=np.linspace(Z_sgd.min(), 0, 7), cmap=plt.cm.PuBu)
|
| 121 |
+
a = plt.contour(xx, yy, Z_sgd, levels=[0], linewidths=2, colors="darkred")
|
| 122 |
+
ax.contourf(xx, yy, Z_sgd, levels=[0, Z_sgd.max()], colors="palevioletred")
|
| 123 |
+
|
| 124 |
+
s = 20
|
| 125 |
+
b1 = ax.scatter(X_train[:, 0], X_train[:, 1], c="white", s=s, edgecolors="k")
|
| 126 |
+
b2 = ax.scatter(X_test[:, 0], X_test[:, 1], c="blueviolet", s=s, edgecolors="k")
|
| 127 |
+
c = ax.scatter(X_outliers[:, 0], X_outliers[:, 1], c="gold", s=s, edgecolors="k")
|
| 128 |
+
ax.axis("tight")
|
| 129 |
+
ax.set_xlim((-4.5, 4.5))
|
| 130 |
+
ax.set_ylim((-4.5, 4.5))
|
| 131 |
+
ax.legend(
|
| 132 |
+
[a.collections[0], b1, b2, c],
|
| 133 |
+
[
|
| 134 |
+
"learned frontier",
|
| 135 |
+
"training observations",
|
| 136 |
+
"new regular observations",
|
| 137 |
+
"new abnormal observations",
|
| 138 |
+
],
|
| 139 |
+
loc="upper left",
|
| 140 |
+
)
|
| 141 |
+
ax.set_xlabel(
|
| 142 |
+
"error train: %d/%d; errors novel regular: %d/%d; errors novel abnormal: %d/%d"
|
| 143 |
+
% (
|
| 144 |
+
n_error_train_sgd,
|
| 145 |
+
X_train.shape[0],
|
| 146 |
+
n_error_test_sgd,
|
| 147 |
+
X_test.shape[0],
|
| 148 |
+
n_error_outliers_sgd,
|
| 149 |
+
X_outliers.shape[0],
|
| 150 |
+
)
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
return fig
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
return make_fig_2(), make_fig_2()
|
| 159 |
+
|
| 160 |
+
# def make_figure():
|
| 161 |
+
# fig = plt.figure(figsize=(9, 6))
|
| 162 |
+
|
| 163 |
+
# plt.title("One Class SVM")
|
| 164 |
+
# plt.contourf(xx, yy, Z, levels=np.linspace(Z.min(), 0, 7), cmap=plt.cm.PuBu)
|
| 165 |
+
# a = plt.contour(xx, yy, Z, levels=[0], linewidths=2, colors="darkred")
|
| 166 |
+
# plt.contourf(xx, yy, Z, levels=[0, Z.max()], colors="palevioletred")
|
| 167 |
+
|
| 168 |
+
# s = 20
|
| 169 |
+
# b1 = plt.scatter(X_train[:, 0], X_train[:, 1], c="white", s=s, edgecolors="k")
|
| 170 |
+
# b2 = plt.scatter(X_test[:, 0], X_test[:, 1], c="blueviolet", s=s, edgecolors="k")
|
| 171 |
+
# c = plt.scatter(X_outliers[:, 0], X_outliers[:, 1], c="gold", s=s, edgecolors="k")
|
| 172 |
+
# plt.axis("tight")
|
| 173 |
+
# plt.xlim((-4.5, 4.5))
|
| 174 |
+
# plt.ylim((-4.5, 4.5))
|
| 175 |
+
# plt.legend(
|
| 176 |
+
# [a.collections[0], b1, b2, c],
|
| 177 |
+
# [
|
| 178 |
+
# "learned frontier",
|
| 179 |
+
# "training observations",
|
| 180 |
+
# "new regular observations",
|
| 181 |
+
# "new abnormal observations",
|
| 182 |
+
# ],
|
| 183 |
+
# loc="upper left",
|
| 184 |
+
# )
|
| 185 |
+
# plt.xlabel(
|
| 186 |
+
# "error train: %d/%d; errors novel regular: %d/%d; errors novel abnormal: %d/%d"
|
| 187 |
+
# % (
|
| 188 |
+
# n_error_train,
|
| 189 |
+
# X_train.shape[0],
|
| 190 |
+
# n_error_test,
|
| 191 |
+
# X_test.shape[0],
|
| 192 |
+
# n_error_outliers,
|
| 193 |
+
# X_outliers.shape[0],
|
| 194 |
+
# )
|
| 195 |
+
# )
|
| 196 |
+
# plt.show()
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def make_example(model_1_depth, model_2_depth):
|
| 200 |
+
return f"""
|
| 201 |
+
With the following code you can reproduce this example with the current values of the sliders and the same data in a notebook:
|
| 202 |
+
|
| 203 |
+
```python
|
| 204 |
+
import numpy as np
|
| 205 |
+
import plotly.graph_objects as go
|
| 206 |
+
from sklearn.tree import DecisionTreeRegressor
|
| 207 |
+
|
| 208 |
+
rng = np.random.default_rng(0)
|
| 209 |
+
|
| 210 |
+
X = np.sort(5 * rng.random((80, 1)), axis=0)
|
| 211 |
+
y = np.sin(X).ravel()
|
| 212 |
+
y[::5] += 3 * (0.5 - rng.random(16))
|
| 213 |
+
|
| 214 |
+
regr_1 = DecisionTreeRegressor(max_depth={model_1_depth}, random_state=0)
|
| 215 |
+
regr_2 = DecisionTreeRegressor(max_depth={model_2_depth}, random_state=0)
|
| 216 |
+
regr_1.fit(X, y)
|
| 217 |
+
regr_2.fit(X, y)
|
| 218 |
+
|
| 219 |
+
# Predict
|
| 220 |
+
X_test = np.arange(0.0, 5.0, 0.01)[:, np.newaxis]
|
| 221 |
+
y_1 = regr_1.predict(X_test)
|
| 222 |
+
y_2 = regr_2.predict(X_test)
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
fig = go.Figure()
|
| 226 |
+
fig.add_trace(go.Scatter(x=X[:,0], y=y, mode='markers', name='data'))
|
| 227 |
+
fig.add_trace(go.Scatter(x=X_test[:,0], y=y_1, mode='lines', name=f"max_depth={model_1_depth}"))
|
| 228 |
+
fig.add_trace(go.Scatter(x=X_test[:,0], y=y_2, mode='lines', name=f"max_depth={model_2_depth}"))
|
| 229 |
+
|
| 230 |
+
fig.update_layout(title='Decision Tree Regression')
|
| 231 |
+
fig.update_xaxes(title_text='data')
|
| 232 |
+
fig.update_yaxes(title_text='target')
|
| 233 |
+
fig.show()
|
| 234 |
+
```
|
| 235 |
+
"""
|
| 236 |
+
|
| 237 |
+
with gr.Blocks() as demo:
|
| 238 |
+
with gr.Row():
|
| 239 |
+
gr.Markdown(md_description)
|
| 240 |
+
with gr.Row():
|
| 241 |
+
# with gr.Column():
|
| 242 |
+
slider_nu = gr.Slider(minimum=0.01, maximum=1, label='Nu', step=0.025, value=0.05)
|
| 243 |
+
slider_gamma = gr.Slider(minimum=0.1, maximum=3, label='Gamma', step=0.1, value=2.0)
|
| 244 |
+
button = gr.Button("Generate")
|
| 245 |
+
with gr.Row():
|
| 246 |
+
plot1 = gr.Plot(label='Output')
|
| 247 |
+
with gr.Row():
|
| 248 |
+
plot2 = gr.Plot(label='Output')
|
| 249 |
+
|
| 250 |
+
with gr.Row():
|
| 251 |
+
example = gr.Markdown(make_example(slider_nu.value, slider_gamma.value))
|
| 252 |
+
slider_nu.change(fn=make_regression,
|
| 253 |
+
inputs=[slider_nu, slider_gamma],
|
| 254 |
+
outputs=[plot1, plot2])
|
| 255 |
+
slider_gamma.change(fn=make_regression,
|
| 256 |
+
inputs=[slider_nu, slider_gamma],
|
| 257 |
+
outputs=[plot1, plot2])
|
| 258 |
+
button.click(make_regression, inputs=[slider_nu, slider_gamma], outputs=[plot1, plot2])
|
| 259 |
+
|
| 260 |
+
demo.launch()
|
poetry.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
poetry.toml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[virtualenvs]
|
| 2 |
+
in-project = true
|
pyproject.toml
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[tool.poetry]
|
| 2 |
+
name = "sklearn-decision-tree-regression"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Hugging Face Scikit Learn Demos"
|
| 5 |
+
authors = ["Niels van Galen Last <nvangalenlast@gmail.com>"]
|
| 6 |
+
license = "MIT"
|
| 7 |
+
readme = "README.md"
|
| 8 |
+
# packages = [{ include = "huggingface_sklearn" }]
|
| 9 |
+
|
| 10 |
+
[tool.poetry.dependencies]
|
| 11 |
+
python = ">=3.8.9,<3.12"
|
| 12 |
+
numpy = "^1.24.2"
|
| 13 |
+
scikit-learn = "^1.2.2"
|
| 14 |
+
matplotlib = "^3.7.1"
|
| 15 |
+
plotly = "^5.14.0"
|
| 16 |
+
gradio = "^3.24.1"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
[tool.poetry.group.dev.dependencies]
|
| 20 |
+
black = { extras = ["jupyter"], version = "^23.3.0" }
|
| 21 |
+
isort = "^5.12.0"
|
| 22 |
+
pre-commit = "^3.2.1"
|
| 23 |
+
pylint = "^2.17.1"
|
| 24 |
+
pytest = "^7.2.2"
|
| 25 |
+
jupyterlab = "^3.6.3"
|
| 26 |
+
jupyterlab-widgets = "^3.0.7"
|
| 27 |
+
ipywidgets = "^8.0.6"
|
| 28 |
+
|
| 29 |
+
[build-system]
|
| 30 |
+
requires = ["poetry-core"]
|
| 31 |
+
build-backend = "poetry.core.masonry.api"
|
| 32 |
+
|
| 33 |
+
[tool.black]
|
| 34 |
+
line-length = 100
|
| 35 |
+
target_version = ['py311']
|
| 36 |
+
include = '\.py$'
|
| 37 |
+
|
| 38 |
+
[tool.isort]
|
| 39 |
+
profile = "black"
|
| 40 |
+
# force_single_line = "false"
|
| 41 |
+
force_sort_within_sections = "true"
|
| 42 |
+
line_length = 100
|
| 43 |
+
|
| 44 |
+
[tool.pylint]
|
| 45 |
+
[tool.pylint.messages_control]
|
| 46 |
+
#line-too-long='off'
|
| 47 |
+
disable = """
|
| 48 |
+
invalid-name,
|
| 49 |
+
logging-fstring-interpolation,
|
| 50 |
+
missing-class-docstring,
|
| 51 |
+
missing-function-docstring,
|
| 52 |
+
missing-module-docstring,
|
| 53 |
+
"""
|
requirements.txt
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiofiles==22.1.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 2 |
+
aiohttp==3.8.4 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 3 |
+
aiosignal==1.3.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 4 |
+
altair==4.2.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 5 |
+
anyio==3.6.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 6 |
+
async-timeout==4.0.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 7 |
+
attrs==22.2.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 8 |
+
certifi==2022.12.7 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 9 |
+
charset-normalizer==3.1.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 10 |
+
click==8.1.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 11 |
+
colorama==0.4.6 ; python_full_version >= "3.8.9" and python_version < "3.12" and platform_system == "Windows"
|
| 12 |
+
contourpy==1.0.7 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 13 |
+
cycler==0.11.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 14 |
+
entrypoints==0.4 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 15 |
+
fastapi==0.95.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 16 |
+
ffmpy==0.3.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 17 |
+
filelock==3.10.7 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 18 |
+
fonttools==4.39.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 19 |
+
frozenlist==1.3.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 20 |
+
fsspec==2023.3.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 21 |
+
gradio-client==0.0.5 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 22 |
+
gradio==3.24.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 23 |
+
h11==0.14.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 24 |
+
httpcore==0.16.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 25 |
+
httpx==0.23.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 26 |
+
huggingface-hub==0.13.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 27 |
+
idna==3.4 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 28 |
+
importlib-resources==5.12.0 ; python_full_version >= "3.8.9" and python_version < "3.10"
|
| 29 |
+
jinja2==3.1.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 30 |
+
joblib==1.2.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 31 |
+
jsonschema==4.17.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 32 |
+
kiwisolver==1.4.4 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 33 |
+
linkify-it-py==2.0.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 34 |
+
markdown-it-py==2.2.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 35 |
+
markdown-it-py[linkify]==2.2.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 36 |
+
markupsafe==2.1.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 37 |
+
matplotlib==3.7.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 38 |
+
mdit-py-plugins==0.3.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 39 |
+
mdurl==0.1.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 40 |
+
multidict==6.0.4 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 41 |
+
numpy==1.24.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 42 |
+
orjson==3.8.9 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 43 |
+
packaging==23.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 44 |
+
pandas==1.5.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 45 |
+
pillow==9.5.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 46 |
+
pkgutil-resolve-name==1.3.10 ; python_full_version >= "3.8.9" and python_version < "3.9"
|
| 47 |
+
plotly==5.14.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 48 |
+
pydantic==1.10.7 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 49 |
+
pydub==0.25.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 50 |
+
pyparsing==3.0.9 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 51 |
+
pyrsistent==0.19.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 52 |
+
python-dateutil==2.8.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 53 |
+
python-multipart==0.0.6 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 54 |
+
pytz==2023.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 55 |
+
pyyaml==6.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 56 |
+
requests==2.28.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 57 |
+
rfc3986[idna2008]==1.5.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 58 |
+
scikit-learn==1.2.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 59 |
+
scipy==1.9.3 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 60 |
+
semantic-version==2.10.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 61 |
+
six==1.16.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 62 |
+
sniffio==1.3.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 63 |
+
starlette==0.26.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 64 |
+
tenacity==8.2.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 65 |
+
threadpoolctl==3.1.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 66 |
+
toolz==0.12.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 67 |
+
tqdm==4.65.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 68 |
+
typing-extensions==4.5.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 69 |
+
uc-micro-py==1.0.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 70 |
+
urllib3==1.26.15 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 71 |
+
uvicorn==0.21.1 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 72 |
+
websockets==11.0 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 73 |
+
yarl==1.8.2 ; python_full_version >= "3.8.9" and python_version < "3.12"
|
| 74 |
+
zipp==3.15.0 ; python_full_version >= "3.8.9" and python_version < "3.10"
|