CachedModel
Model Examples
Examples of using the Model Class are in the Examples section at the bottom of this page. AWS Model setup and deployment are quite complicated to do manually but the SageWorks Model Class makes it a breeze!
CachedModel: Caches the method results for SageWorks Models
CachedModel
Bases: CachedArtifactMixin
, ModelCore
CachedModel: Caches the method results for SageWorks Models
Note: Cached method values may lag underlying Model changes.
Common Usage
Source code in src/sageworks/cached/cached_model.py
__init__(uuid)
details(**kwargs)
Retrieve the CachedModel Details.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of details about the CachedModel |
get_endpoint_inference_path()
Retrieve the Endpoint Inference Path.
Returns:
Name | Type | Description |
---|---|---|
str |
Union[str, None]
|
The Endpoint Inference Path |
get_inference_predictions(capture_uuid='auto_inference')
Retrieve the captured prediction results for this model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
capture_uuid
|
str
|
Specific capture_uuid (default: training_holdout) |
'auto_inference'
|
Returns:
Type | Description |
---|---|
Union[DataFrame, None]
|
pd.DataFrame: DataFrame of the Captured Predictions (might be None) |
Source code in src/sageworks/cached/cached_model.py
health_check(**kwargs)
Retrieve the CachedModel Health Check.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of health check details for the CachedModel |
Source code in src/sageworks/cached/cached_model.py
list_inference_runs()
Retrieve the captured prediction results for this model
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: List of Inference Runs |
sageworks_meta()
Retrieve the Enumerated Model Type (REGRESSOR, CLASSIFER, etc).
Returns:
Name | Type | Description |
---|---|---|
str |
Union[str, None]
|
The Enumerated Model Type |
summary(**kwargs)
Retrieve the CachedModel Details.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of details about the CachedModel |
Examples
All of the SageWorks Examples are in the Sageworks Repository under the examples/
directory. For a full code listing of any example please visit our SageWorks Examples
Pull Inference Run
from sageworks.cached.cached_model import CachedModel
# Grab a Model
model = CachedModel("abalone-regression")
# List the inference runs
model.list_inference_runs()
['auto_inference', 'model_training']
# Grab specific inference results
model.get_inference_predictions("auto_inference")
class_number_of_rings prediction id
0 16 10.516158 7
1 9 9.031365 8
.. ... ... ...
831 8 7.693689 4158
832 9 7.542521 4167