haneulpark commited on
Commit
1aea332
·
verified ·
1 Parent(s): d4bf022

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -4
README.md CHANGED
@@ -126,11 +126,12 @@ then load, featurize, split, fit, and evaluate the catboost model
126
  representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
127
 
128
  model = load_model_from_dict({
129
- "name": "cat_boost_classifier",
130
  "config": {
131
- "x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
132
- "y_features": ['Solubility']}})
133
-
 
134
  model.train(split_featurised_dataset["train"])
135
  preds = model.predict(split_featurised_dataset["test"])
136
 
@@ -140,6 +141,58 @@ then load, featurize, split, fit, and evaluate the catboost model
140
  references=split_featurised_dataset["test"]['Solubility'],
141
  predictions=preds["cat_boost_classifier::Solubility"])
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  ## AttentiveSkin
144
  To Predict Skin Corrosion/Irritation Potentials of Chemicals via Explainable Machine Learning Methods
145
  Download: https://github.com/BeeBeeWong/AttentiveSkin/releases/tag/v1.0
 
126
  representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
127
 
128
  model = load_model_from_dict({
129
+ "name": "random_forest_regressor",
130
  "config": {
131
+ "x_features": ['smiles::morgan', 'smiles::maccs_rdkit'],
132
+ "y_features": ['log_solubility'],
133
+ })
134
+
135
  model.train(split_featurised_dataset["train"])
136
  preds = model.predict(split_featurised_dataset["test"])
137
 
 
141
  references=split_featurised_dataset["test"]['Solubility'],
142
  predictions=preds["cat_boost_classifier::Solubility"])
143
 
144
+
145
+
146
+ import json
147
+
148
+ from molflux.modelzoo import load_from_dict as load_model_from_dict
149
+ from molflux.metrics import load_suite
150
+
151
+ from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay
152
+
153
+ import matplotlib.pyplot as plt
154
+
155
+ model = load_model_from_dict(
156
+ {
157
+ "name": "random_forest_classifier",
158
+ "config": {
159
+ "x_features": ['smiles::morgan', 'smiles::maccs_rdkit'],
160
+ "y_features": ['log_solubility_cls'],
161
+ }
162
+ }
163
+ )
164
+
165
+ model.train(split_featurised_dataset["train"])
166
+
167
+ preds = model.predict(split_featurised_dataset["test"])
168
+
169
+ regression_suite = load_suite("classification")
170
+
171
+ scores = regression_suite.compute(
172
+ references=split_featurised_dataset["test"]["log_solubility_cls"],
173
+ predictions=preds["random_forest_classifier::log_solubility_cls"],
174
+ )
175
+
176
+ print(json.dumps({k: round(v, 2) for k, v in scores.items()}, indent=4))
177
+
178
+ cm = confusion_matrix(
179
+ split_featurised_dataset["test"]["log_solubility_cls"],
180
+ preds["random_forest_classifier::log_solubility_cls"],
181
+ labels=[0, 1]
182
+ )
183
+ disp = ConfusionMatrixDisplay(confusion_matrix=cm, display_labels=[0, 1])
184
+ disp.plot()
185
+ plt.show()
186
+ {
187
+ "accuracy": 0.83,
188
+ "balanced_accuracy": 0.83,
189
+ "precision": 0.83,
190
+ "recall": 0.85,
191
+ "f1_score": 0.84,
192
+ "matthews_corrcoef": 0.66
193
+ }
194
+
195
+
196
  ## AttentiveSkin
197
  To Predict Skin Corrosion/Irritation Potentials of Chemicals via Explainable Machine Learning Methods
198
  Download: https://github.com/BeeBeeWong/AttentiveSkin/releases/tag/v1.0