pushing files to the repo from the example!
Browse files- README.md +33 -36
- init_repo_MLstructureMining.py +9 -1
README.md
CHANGED
@@ -146,41 +146,38 @@ The model is trained with below hyperparameters.
|
|
146 |
<details>
|
147 |
<summary> Click to expand </summary>
|
148 |
|
149 |
-
| Hyperparameter
|
150 |
-
|
151 |
-
|
|
152 |
-
|
|
153 |
-
|
|
154 |
-
|
|
155 |
-
|
|
156 |
-
|
|
157 |
-
|
|
158 |
-
|
|
159 |
-
|
|
160 |
-
|
|
161 |
-
|
|
162 |
-
|
|
163 |
-
|
|
164 |
-
|
|
165 |
-
|
|
166 |
-
|
|
167 |
-
|
|
168 |
-
|
|
169 |
-
|
|
170 |
-
|
|
171 |
-
|
|
172 |
-
|
|
173 |
-
|
|
174 |
-
|
|
175 |
-
|
|
176 |
-
|
|
177 |
-
|
|
178 |
-
|
|
179 |
-
|
|
180 |
-
|
|
181 |
-
| return_train_score | True |
|
182 |
-
| scoring | |
|
183 |
-
| verbose | 0 |
|
184 |
|
185 |
</details>
|
186 |
|
@@ -188,7 +185,7 @@ The model is trained with below hyperparameters.
|
|
188 |
|
189 |
The model plot is below.
|
190 |
|
191 |
-
<style>#sk-
|
192 |
|
193 |
## Evaluation Results
|
194 |
|
|
|
146 |
<details>
|
147 |
<summary> Click to expand </summary>
|
148 |
|
149 |
+
| Hyperparameter | Value |
|
150 |
+
|-------------------------|-----------------|
|
151 |
+
| objective | binary:logistic |
|
152 |
+
| use_label_encoder | True |
|
153 |
+
| base_score | 0.5 |
|
154 |
+
| booster | gbtree |
|
155 |
+
| colsample_bylevel | 1 |
|
156 |
+
| colsample_bynode | 1 |
|
157 |
+
| colsample_bytree | 1 |
|
158 |
+
| enable_categorical | False |
|
159 |
+
| gamma | 0 |
|
160 |
+
| gpu_id | -1 |
|
161 |
+
| importance_type | |
|
162 |
+
| interaction_constraints | |
|
163 |
+
| learning_rate | 0.300000012 |
|
164 |
+
| max_delta_step | 0 |
|
165 |
+
| max_depth | 6 |
|
166 |
+
| min_child_weight | 1 |
|
167 |
+
| missing | nan |
|
168 |
+
| monotone_constraints | () |
|
169 |
+
| n_estimators | 100 |
|
170 |
+
| n_jobs | 8 |
|
171 |
+
| num_parallel_tree | 1 |
|
172 |
+
| predictor | auto |
|
173 |
+
| random_state | 0 |
|
174 |
+
| reg_alpha | 0 |
|
175 |
+
| reg_lambda | 1 |
|
176 |
+
| scale_pos_weight | |
|
177 |
+
| subsample | 1 |
|
178 |
+
| tree_method | auto |
|
179 |
+
| validate_parameters | 1 |
|
180 |
+
| verbosity | |
|
|
|
|
|
|
|
181 |
|
182 |
</details>
|
183 |
|
|
|
185 |
|
186 |
The model plot is below.
|
187 |
|
188 |
+
<style>#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 {color: black;background-color: white;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 pre{padding: 0;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-toggleable {background-color: white;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 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-800ead0c-95d2-4adb-adfc-71adae7c28c0 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-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-estimator:hover {background-color: #d4ebff;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-item {z-index: 1;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel-item {display: flex;flex-direction: column;position: relative;background-color: white;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-parallel-item:only-child::after {width: 0;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 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-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-label label {font-family: monospace;font-weight: bold;background-color: white;display: inline-block;line-height: 1.2em;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-label-container {position: relative;z-index: 2;text-align: center;}#sk-800ead0c-95d2-4adb-adfc-71adae7c28c0 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-800ead0c-95d2-4adb-adfc-71adae7c28c0 div.sk-text-repr-fallback {display: none;}</style><div id="sk-800ead0c-95d2-4adb-adfc-71adae7c28c0" class="sk-top-container" style="overflow: auto;"><div class="sk-text-repr-fallback"><pre>XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,colsample_bynode=1, colsample_bytree=1, enable_categorical=False,gamma=0, gpu_id=-1, importance_type=None,interaction_constraints='', learning_rate=0.300000012,max_delta_step=0, max_depth=6, min_child_weight=1, missing=nan,monotone_constraints='()', n_estimators=100, n_jobs=8,num_parallel_tree=1, predictor='auto', random_state=0,reg_alpha=0, reg_lambda=1, scale_pos_weight=None, subsample=1,tree_method='auto', validate_parameters=1, verbosity=None)</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"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="b4173fad-9393-4606-92e6-246559a01a45" type="checkbox" checked><label for="b4173fad-9393-4606-92e6-246559a01a45" class="sk-toggleable__label sk-toggleable__label-arrow">XGBClassifier</label><div class="sk-toggleable__content"><pre>XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,colsample_bynode=1, colsample_bytree=1, enable_categorical=False,gamma=0, gpu_id=-1, importance_type=None,interaction_constraints='', learning_rate=0.300000012,max_delta_step=0, max_depth=6, min_child_weight=1, missing=nan,monotone_constraints='()', n_estimators=100, n_jobs=8,num_parallel_tree=1, predictor='auto', random_state=0,reg_alpha=0, reg_lambda=1, scale_pos_weight=None, subsample=1,tree_method='auto', validate_parameters=1, verbosity=None)</pre></div></div></div></div></div>
|
189 |
|
190 |
## Evaluation Results
|
191 |
|
init_repo_MLstructureMining.py
CHANGED
@@ -7,6 +7,8 @@ from uuid import uuid4
|
|
7 |
|
8 |
import numpy as np
|
9 |
import xgboost
|
|
|
|
|
10 |
import sklearn
|
11 |
from huggingface_hub import HfApi
|
12 |
from sklearn.datasets import load_breast_cancer
|
@@ -43,7 +45,13 @@ _, pkl_name = mkstemp(prefix="skops-", suffix=".pkl")
|
|
43 |
with open(pkl_name, mode="bw") as f:
|
44 |
pickle.dump(model, file=f)
|
45 |
|
|
|
|
|
|
|
|
|
46 |
|
|
|
|
|
47 |
|
48 |
local_repo = mkdtemp(prefix="skops-")
|
49 |
hub_utils.init(
|
@@ -59,7 +67,7 @@ if "__file__" in locals(): # __file__ not defined during docs built
|
|
59 |
hub_utils.add_files(__file__, dst=local_repo)
|
60 |
|
61 |
print(os.listdir(local_repo))
|
62 |
-
|
63 |
model_card = card.Card(model, metadata=card.metadata_from_config(Path(local_repo)))
|
64 |
model_card.save(Path(local_repo) / "README.md")
|
65 |
|
|
|
7 |
|
8 |
import numpy as np
|
9 |
import xgboost
|
10 |
+
from xgboost import XGBClassifier
|
11 |
+
|
12 |
import sklearn
|
13 |
from huggingface_hub import HfApi
|
14 |
from sklearn.datasets import load_breast_cancer
|
|
|
45 |
with open(pkl_name, mode="bw") as f:
|
46 |
pickle.dump(model, file=f)
|
47 |
|
48 |
+
booster = xgboost.Booster({'nthread': 8})
|
49 |
+
booster.load_model("xgb_model_bayse_optimization_00000.bin")
|
50 |
+
|
51 |
+
model = XGBClassifier()
|
52 |
|
53 |
+
# Set the booster
|
54 |
+
model._Booster = booster
|
55 |
|
56 |
local_repo = mkdtemp(prefix="skops-")
|
57 |
hub_utils.init(
|
|
|
67 |
hub_utils.add_files(__file__, dst=local_repo)
|
68 |
|
69 |
print(os.listdir(local_repo))
|
70 |
+
print(type(model))
|
71 |
model_card = card.Card(model, metadata=card.metadata_from_config(Path(local_repo)))
|
72 |
model_card.save(Path(local_repo) / "README.md")
|
73 |
|