sasctl.services.model_management#
- class sasctl._services.model_management.ModelManagement[source]#
Bases:
Service
The Model Management API provides basic resources for monitoring performance, comparing models, and running workflow processes.
- classmethod create_custom_kpi(model, project, timeLabel, kpiName, kpiValue, timeSK=None)[source]#
Post a user supplied custom KPI to a SAS Model Manager project’s MM_STD_KPI table. A custom KPI consists of the time label, KPI name, KPI value, and optionally the timeSK. Additionally, the model and project associated with the custom KPI are required.
Multiple custom KPIs can be uploaded at once by passing lists in for the four arguments mentioned above.
- Parameters:
model (str or dict) – The name or id of the model, or a dictionary representation of the model.
project (str or dict) – The name or id of the project, or a dictionary representation of the project.
timeLabel (str or list) – Label associated with the dataset used within the performance definition.
timeSK (int or list) – Default is None. Indicator for the MM_STD_KPI table to denote performance task order.
- classmethod create_performance_definition(table_prefix, project=None, models=None, library_name='Public', name=None, description=None, monitor_champion=False, monitor_challenger=False, max_bins=None, scoring_required=False, all_data=False, save_output=True, output_library=None, autoload_output=False, cas_server=None, trace=False)[source]#
Create the performance task definition in the model project to monitor model performance. In order to execute the performance task definition, run the execute_performance_definition function with the output from this function.
Note that the performance task definition cannot be created if the project is not a valid form of model, or if targetVariable or targetLevel are not defined.
- Parameters:
table_prefix (str) – The name used for the prefix of the performance data.
project (str, optional) – Name or ID of the project. If no project is specified, it is inferred from the models argument. Defaults to None.
models (str, list, or dict, optional) – The name or id of the model(s), or a dictionary representation of the model(s). For multiple models, input a list of model names, or a list of dictionaries. If no models are specified, all models in the project specified will be used. Defaults to None.
library_name (str) – The library containing the input data, default is ‘Public’.
name (str, optional) – The name of the performance task, default is None.
description (str, optional) – The description of the performance task, default is None.
monitor_champion (bool, optional) – Indicates to monitor the project champion model, default is None.
monitor_challenger (bool, optional) – Indicates to monitor challenger models, default is None.
max_bins (int, optional) – The maximum bins number. Must be >= 2. Defaults to 10.
scoring_required (bool, optional) – Whether model scoring must be performed on the input data before performance results can be computed. Should be False if target values are included in the table_prefix tables. Defaults to False.
all_data (bool, optional) – Whether to run the performance job against all matching data tables in library_name or just the new tables. Defaults to False.
save_output (bool, optional) – Whether to save the computed results to a table in output_library. Defaults to True.
output_library (str, optional) – Name of a CASLIB where computed results should be saved. Defaults to ‘ModelPerformanceData’.
autoload_output (bool, optional) – Whether computed results should automatically be re-loaded after a CAS server restart, defaults to False.
cas_server (str, optional) – The CAS Server for the monitoring task, default is ‘cas-shared-default’.
trace (bool, optional) – Whether to enable trace messages in the SAS job log when executing the performance definition, defaults to False.
- Returns:
RestObj – The performance task definition schema
- classmethod delete_performance_definition(item)#
Delete a performance task instance.
- Parameters:
item
- Returns:
None
- classmethod execute_model_workflow_definition(project_name, workflow_name, prompts=None)[source]#
Runs specific Workflow Processes Definitions.
- Parameters:
- Returns:
RestObj – The executing workflow
.. versionchanged:: 1.8.2 – Renamed the input parameter to prompts.
Warning
This method is experimental and may be modified or removed without warning.
- classmethod execute_performance_definition(definition)[source]#
Launches a job to run a performance definition.
- classmethod get_performance_definition(item, refresh=False)#
Return a performance task instance.
- Parameters:
- Returns:
RestObj or None – A dictionary containing the performance task attributes or None.
Notes
If item is a complete representation of the performance task it will be returned unless refresh is set. This prevents unnecessary REST calls when data is already available on the client.
- classmethod list_model_workflow_definition()[source]#
List all enabled Workflow Processes to execute on Model Project.
- Returns:
list of RestObj – The list of workflows
Warning
This method is experimental and may be modified or removed without warning.
- classmethod list_model_workflow_executed(projectName)[source]#
List prompt Workflow Processes Definitions.
- Parameters:
projectName (str) – Name of the Project list executed workflow
- Returns:
RestObj – List of workflows associated to project
Warning
This method is experimental and may be modified or removed without warning.
- classmethod list_model_workflow_prompt(workflowName)[source]#
List prompt Workflow Processes Definitions.
- Parameters:
workflowName (str) – Name or ID of an enabled workflow to retrieve inputs
- Returns:
list – The list of prompts for specific workflow
Warning
This method is experimental and may be modified or removed without warning.
- classmethod list_performance_definitions(filter=None, start=None, limit=None, **kwargs)#
List all performance tasks available in the environment.
- Parameters:
- Returns:
list – A list of dictionaries containing the performance tasks.
Notes
See the filtering reference for details on the filter parameter.
- classmethod publish_model(model, destination, name=None, force=False, reload_model_table=False)[source]#
- Parameters:
model (str or dict) – The name or id of the model, or a dictionary representation of the model.
destination (str) – Name of destination to publish the model to.
name (str, optional) – Provide a custom name for the published model. Defaults to None.
force (bool, optional) – Whether to overwrite the model if it already exists in the publishing destination. Defaults to False.
reload_model_table (bool, optional) – Whether the model table in CAS should be reloaded. Defaults to False.