pushing files to the repo from the example!
Browse files- README.md +3 -3
- config.json +2 -1
- init_repo_MLstructureMining.py +4 -1
- skops-8nefprdu.pkl +3 -0
README.md
CHANGED
@@ -4,7 +4,7 @@ tags:
|
|
4 |
- sklearn
|
5 |
- skops
|
6 |
- tabular-classification
|
7 |
-
model_file: skops-
|
8 |
widget:
|
9 |
structuredData:
|
10 |
area error:
|
@@ -188,7 +188,7 @@ The model is trained with below hyperparameters.
|
|
188 |
|
189 |
The model plot is below.
|
190 |
|
191 |
-
<style>#sk-
|
192 |
|
193 |
## Evaluation Results
|
194 |
|
@@ -207,7 +207,7 @@ Use the code below to get started with the model.
|
|
207 |
import joblib
|
208 |
import json
|
209 |
import pandas as pd
|
210 |
-
clf = joblib.load(skops-
|
211 |
with open("config.json") as f:
|
212 |
config = json.load(f)
|
213 |
clf.predict(pd.DataFrame.from_dict(config["sklearn"]["example_input"]))
|
|
|
4 |
- sklearn
|
5 |
- skops
|
6 |
- tabular-classification
|
7 |
+
model_file: skops-8nefprdu.pkl
|
8 |
widget:
|
9 |
structuredData:
|
10 |
area error:
|
|
|
188 |
|
189 |
The model plot is below.
|
190 |
|
191 |
+
<style>#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f {color: black;background-color: white;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f pre{padding: 0;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-toggleable {background-color: white;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-estimator:hover {background-color: #d4ebff;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-item {z-index: 1;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel-item {display: flex;flex-direction: column;position: relative;background-color: white;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-parallel-item:only-child::after {width: 0;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;position: relative;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-label label {font-family: monospace;font-weight: bold;background-color: white;display: inline-block;line-height: 1.2em;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-label-container {position: relative;z-index: 2;text-align: center;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f div.sk-text-repr-fallback {display: none;}</style><div id="sk-0c1d7c13-a4c8-4590-87aa-1f83604d531f" class="sk-top-container" style="overflow: auto;"><div class="sk-text-repr-fallback"><pre>HalvingGridSearchCV(estimator=HistGradientBoostingClassifier(), n_jobs=-1,param_grid={'max_depth': [2, 5, 10],'max_leaf_nodes': [5, 10, 15]},random_state=42)</pre><b>Please rerun this cell to show the HTML repr or trust the notebook.</b></div><div class="sk-container" hidden><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="fda069f1-3c89-4cdd-93a3-300250ad04ac" type="checkbox" ><label for="fda069f1-3c89-4cdd-93a3-300250ad04ac" class="sk-toggleable__label sk-toggleable__label-arrow">HalvingGridSearchCV</label><div class="sk-toggleable__content"><pre>HalvingGridSearchCV(estimator=HistGradientBoostingClassifier(), n_jobs=-1,param_grid={'max_depth': [2, 5, 10],'max_leaf_nodes': [5, 10, 15]},random_state=42)</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="f08bbe7b-c0ba-40eb-983c-ca33a0c7f783" type="checkbox" ><label for="f08bbe7b-c0ba-40eb-983c-ca33a0c7f783" class="sk-toggleable__label sk-toggleable__label-arrow">HistGradientBoostingClassifier</label><div class="sk-toggleable__content"><pre>HistGradientBoostingClassifier()</pre></div></div></div></div></div></div></div></div></div></div>
|
192 |
|
193 |
## Evaluation Results
|
194 |
|
|
|
207 |
import joblib
|
208 |
import json
|
209 |
import pandas as pd
|
210 |
+
clf = joblib.load(skops-8nefprdu.pkl)
|
211 |
with open("config.json") as f:
|
212 |
config = json.load(f)
|
213 |
clf.predict(pd.DataFrame.from_dict(config["sklearn"]["example_input"]))
|
config.json
CHANGED
@@ -33,6 +33,7 @@
|
|
33 |
"worst fractal dimension"
|
34 |
],
|
35 |
"environment": [
|
|
|
36 |
"xgboost=1.5.2"
|
37 |
],
|
38 |
"example_input": {
|
@@ -188,7 +189,7 @@
|
|
188 |
]
|
189 |
},
|
190 |
"model": {
|
191 |
-
"file": "skops-
|
192 |
},
|
193 |
"task": "tabular-classification"
|
194 |
}
|
|
|
33 |
"worst fractal dimension"
|
34 |
],
|
35 |
"environment": [
|
36 |
+
"scikit-learn=1.0.2",
|
37 |
"xgboost=1.5.2"
|
38 |
],
|
39 |
"example_input": {
|
|
|
189 |
]
|
190 |
},
|
191 |
"model": {
|
192 |
+
"file": "skops-8nefprdu.pkl"
|
193 |
},
|
194 |
"task": "tabular-classification"
|
195 |
}
|
init_repo_MLstructureMining.py
CHANGED
@@ -38,6 +38,7 @@ model = HalvingGridSearchCV(
|
|
38 |
).fit(X_train, y_train)
|
39 |
model.score(X_test, y_test)# The file name is not significant, here we choose to save it with a `pkl`
|
40 |
# extension.
|
|
|
41 |
_, pkl_name = mkstemp(prefix="skops-", suffix=".pkl")
|
42 |
with open(pkl_name, mode="bw") as f:
|
43 |
pickle.dump(model, file=f)
|
@@ -45,7 +46,7 @@ with open(pkl_name, mode="bw") as f:
|
|
45 |
local_repo = mkdtemp(prefix="skops-")
|
46 |
hub_utils.init(
|
47 |
model=pkl_name,
|
48 |
-
requirements=[f"xgboost={xgboost.__version__}"],
|
49 |
dst=local_repo,
|
50 |
task="tabular-classification",
|
51 |
data=X_test,
|
@@ -54,6 +55,8 @@ if "__file__" in locals(): # __file__ not defined during docs built
|
|
54 |
# Add this script itself to the files to be uploaded for reproducibility
|
55 |
hub_utils.add_files(__file__, dst=local_repo)
|
56 |
|
|
|
|
|
57 |
model_card = card.Card(model, metadata=card.metadata_from_config(Path(local_repo)))
|
58 |
model_card.save(Path(local_repo) / "README.md")
|
59 |
|
|
|
38 |
).fit(X_train, y_train)
|
39 |
model.score(X_test, y_test)# The file name is not significant, here we choose to save it with a `pkl`
|
40 |
# extension.
|
41 |
+
|
42 |
_, pkl_name = mkstemp(prefix="skops-", suffix=".pkl")
|
43 |
with open(pkl_name, mode="bw") as f:
|
44 |
pickle.dump(model, file=f)
|
|
|
46 |
local_repo = mkdtemp(prefix="skops-")
|
47 |
hub_utils.init(
|
48 |
model=pkl_name,
|
49 |
+
requirements=[f"scikit-learn={sklearn.__version__}", f"xgboost={xgboost.__version__}"],
|
50 |
dst=local_repo,
|
51 |
task="tabular-classification",
|
52 |
data=X_test,
|
|
|
55 |
# Add this script itself to the files to be uploaded for reproducibility
|
56 |
hub_utils.add_files(__file__, dst=local_repo)
|
57 |
|
58 |
+
print(os.listdir(local_repo))
|
59 |
+
|
60 |
model_card = card.Card(model, metadata=card.metadata_from_config(Path(local_repo)))
|
61 |
model_card.save(Path(local_repo) / "README.md")
|
62 |
|
skops-8nefprdu.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0db0cd8b1acd1f6deab5e7706d350fa7d917ce83a668ea74bf277b99a99dc398
|
3 |
+
size 242801
|