Model Utilities
Examples
Examples of using the Model Utilities are listed at the bottom of this page Examples.
Model Utilities for Workbench models
evaluate_uq_model(df, target_col='solubility', model_name='Model')
Evaluate uncertainty quantification model performance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
DataFrame with predictions and uncertainty columns |
required |
target_col
|
str
|
Name of true target column |
'solubility'
|
model_name
|
str
|
Name for display |
'Model'
|
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
Dictionary of computed metrics |
Source code in src/workbench/utils/model_utils.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
instance_architecture(instance_name)
Get the architecture for the given instance name
load_category_mappings_from_s3(model_artifact_uri)
Download and extract category mappings from a model artifact in S3.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_artifact_uri
|
str
|
S3 URI of the model artifact. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Optional[dict]
|
The loaded category mappings or None if not found. |
Source code in src/workbench/utils/model_utils.py
model_instance_info()
Get the instance information for the Model
Source code in src/workbench/utils/model_utils.py
proximity_model(model, prox_model_name, track_columns=None)
Create a proximity model based on the given model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Model
|
The model to create the proximity model from |
required |
prox_model_name
|
str
|
The name of the proximity model to create |
required |
track_columns
|
list
|
List of columns to track in the proximity model |
None
|
Returns: Model: The proximity model
Source code in src/workbench/utils/model_utils.py
supported_instance_types(arch='x86_64')
Get the supported instance types for the Model/Model
Source code in src/workbench/utils/model_utils.py
uq_model(model, uq_model_name, train_all_data=False)
Create a Uncertainty Quantification (UQ) model based on the given model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Model
|
The model to create the UQ model from |
required |
uq_model_name
|
str
|
The name of the UQ model to create |
required |
train_all_data
|
bool
|
Whether to train the UQ model on all data (default: False) |
False
|
Returns:
Name | Type | Description |
---|---|---|
Model |
Model
|
The UQ model |
Source code in src/workbench/utils/model_utils.py
Examples
Feature Importance
"""Example for using some Model Utilities"""
from workbench.utils.model_utils import feature_importance
model = Model("aqsol_classification")
feature_importance(model)
Output
[('mollogp', 469.0),
('minabsestateindex', 277.0),
('peoe_vsa8', 237.0),
('qed', 237.0),
('fpdensitymorgan1', 230.0),
('fpdensitymorgan3', 221.0),
('estate_vsa4', 220.0),
('bcut2d_logphi', 218.0),
('vsa_estate5', 218.0),
('vsa_estate4', 209.0),
Additional Resources
- Workbench API Classes: API Classes
- Consulting Available: SuperCowPowers LLC