Update README.md
Browse files
README.md
CHANGED
@@ -98,32 +98,30 @@ The trained model is valid for 14:2:1 phases only, which are stoichiometric comp
|
|
98 |
|
99 |
**Model pipeline**
|
100 |
|
101 |
-
The voting regressor to predict the Tc combines four base models.
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
-
<style>#sk-31f1492d-398b-4eed-9409-15e41d2ae601 {color: black;background-color: white;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 pre{padding: 0;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-toggleable {background-color: white;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.2em 0.3em;box-sizing: border-box;text-align: center;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 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-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;margin: 0.25em 0.25em;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-estimator:hover {background-color: #d4ebff;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-item {z-index: 1;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-parallel-item {display: flex;flex-direction: column;position: relative;background-color: white;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-parallel-item:only-child::after {width: 0;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0.2em;box-sizing: border-box;padding-bottom: 0.1em;background-color: white;position: relative;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-label label {font-family: monospace;font-weight: bold;background-color: white;display: inline-block;line-height: 1.2em;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-label-container {position: relative;z-index: 2;text-align: center;}#sk-31f1492d-398b-4eed-9409-15e41d2ae601 div.sk-container {display: inline-block;position: relative;}</style><div id="sk-31f1492d-398b-4eed-9409-15e41d2ae601" class"sk-top-container"><div class="sk-container"><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="ef7a2220-1243-414d-9815-7f672754c9cf" type="checkbox" ><label class="sk-toggleable__label" for="ef7a2220-1243-414d-9815-7f672754c9cf">VotingRegressor</label><div class="sk-toggleable__content"><pre>VotingRegressor(estimators=[('ET', ExtraTreesRegressor()),
|
104 |
-
('XGB',
|
105 |
-
XGBRegressor(alpha=0.5, base_score=0.5,
|
106 |
-
booster='gbtree', colsample_bylevel=1,
|
107 |
-
colsample_bynode=1,
|
108 |
-
colsample_bytree=0.4,
|
109 |
-
enable_categorical=False, gamma=0,
|
110 |
-
gpu_id=-1, importance_type=None,
|
111 |
-
interaction_constraints='',
|
112 |
-
learning_rate=0.2, max_delta_step=0,
|
113 |
-
max_depth=2, min_child_weight=1,
|
114 |
-
missing=nan,
|
115 |
-
mo...
|
116 |
-
n_estimators=1000, n_jobs=8,
|
117 |
-
num_parallel_tree=1, predictor='auto',
|
118 |
-
random_state=0, reg_alpha=0.5,
|
119 |
-
reg_lambda=1, scale_pos_weight=1,
|
120 |
-
subsample=1, tree_method='exact',
|
121 |
-
validate_parameters=1,
|
122 |
-
verbosity=None)),
|
123 |
-
('RF', RandomForestRegressor(max_depth=100)),
|
124 |
-
('AB',
|
125 |
-
AdaBoostRegressor(base_estimator=RandomForestRegressor(max_depth=50,
|
126 |
-
n_estimators=50),
|
127 |
-
learning_rate=0.001))])
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
|
|
|
98 |
|
99 |
**Model pipeline**
|
100 |
|
101 |
+
The voting regressor to predict the Tc combines the following four base models and equal weight is assigned to each base models.
|
102 |
+
|
103 |
+
1. Extra tree regressor (ET)
|
104 |
+
2. Extreme gradient boosting (XGB)
|
105 |
+
3. Random forest regressor (RF)
|
106 |
+
4. Adaptive boosted RF regressor (AB)
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
# How to use the trained model for inference
|
110 |
+
|
111 |
+
```python
|
112 |
+
import json
|
113 |
+
from joblib
|
114 |
+
import pandas as pd
|
115 |
+
|
116 |
+
Tc_predictor = load('Magnet_Tc_predictor.joblib') # trained model
|
117 |
+
config = json.load(open('config.json')) # config file
|
118 |
+
features = config['features'] # feature extraction
|
119 |
+
|
120 |
+
#data = pd.read_excel("data.xlsx") # read test file with new compositions
|
121 |
+
data = data[features]
|
122 |
+
#data.columns = ["feat_" + str(col) for col in data.columns]
|
123 |
+
|
124 |
+
Predicted_value = Tc_predictor.predict(data) # predict Tc values
|
125 |
+
print("Predicted Tc value is: {0:.2f}'.format(predictions)")
|
126 |
|
127 |
+
```
|