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.

Methods

create_custom_kpi(model, project, timeLabel, ...)

Post a user supplied custom KPI to a SAS Model Manager project's MM_STD_KPI table.

create_performance_definition(table_prefix)

Create the performance task definition in the model project to monitor model performance.

delete(*args, **kwargs)

Send a DELETE request.

delete_performance_definition(item)

Delete a performance task instance.

execute_model_workflow_definition(...[, prompts])

Runs specific Workflow Processes Definitions.

execute_performance_definition(definition)

Launches a job to run a performance definition.

get(*args, **kwargs)

Send a GET request.

get_link(obj, rel)

Get link information from a resource.

get_performance_definition(item[, refresh])

Return a performance task instance.

head(*args, **kwargs)

Send a HEAD request.

info()

Version and build information for the service.

is_available()

Check if the service is currently available.

list_model_workflow_definition()

List all enabled Workflow Processes to execute on Model Project.

list_model_workflow_executed(projectName)

List prompt Workflow Processes Definitions.

list_model_workflow_prompt(workflowName)

List prompt Workflow Processes Definitions.

list_performance_definitions([filter, ...])

List all performance tasks available in the environment.

post(*args, **kwargs)

Send a POST request.

publish_model(model, destination[, name, ...])

Parameters:

put(*args, **kwargs)

Send a PUT request.

request(verb, path[, session, format_])

Send an HTTP request with a session.

request_link(obj, rel, **kwargs)

Request a link from a resource.

update_performance_definition(item)

Update a performance task instance.

is_uuid

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:
modelstr or dict

The name or id of the model, or a dictionary representation of the model.

projectstr or dict
The name or id of the project, or a dictionary representation of
the project.
timeLabelstr or list

Label associated with the dataset used within the performance definition.

kpiNamestr or list

Name of the custom KPI.

kpiValueint or float or list

Value of the custom KPI.

timeSKint or list, by default 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_prefixstr

The name used for the prefix of the performance data.

projectstr, optional

Name or ID of the project. If no project is specified, it is inferred from the models argument. Defaults to None.

modelsstr, 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_namestr

The library containing the input data, default is ‘Public’.

namestr, optional

The name of the performance task, default is None.

descriptionstr, optional

The description of the performance task, default is None.

monitor_championbool, optional

Indicates to monitor the project champion model, default is None.

monitor_challengerbool, optional

Indicates to monitor challenger models, default is None.

max_binsint, optional

The maximum bins number. Must be >= 2. Defaults to 10.

scoring_requiredbool, 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_databool, optional

Whether to run the performance job against all matching data tables in library_name or just the new tables. Defaults to False.

save_outputbool, optional

Whether to save the computed results to a table in output_library. Defaults to True.

output_librarystr, optional

Name of a CASLIB where computed results should be saved. Defaults to ‘ModelPerformanceData’.

autoload_outputbool, optional

Whether computed results should automatically be re-loaded after a CAS server restart, defaults to False.

cas_serverstr, optional

The CAS Server for the monitoring task, default is ‘cas-shared-default’.

tracebool, 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:
project_namestr

Name of the Project that will execute workflow

workflow_namestr

Name or ID of an enabled workflow to execute

promptsdict, optional

Input values to provide for the initial workflow prompts. Should be specified as name:value pairs.

Returns:
RestObj

The executing workflow

Changed in version 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.

Parameters:
definitionstr or dict

The id or dictionary representation of a performance definition.

Returns:
RestObj

The executing job

classmethod get_performance_definition(item, refresh=False)#

Return a performance task instance.

Parameters:
itemstr or dict

Name, ID, or dictionary representation of the performance task.

refreshbool, optional

Obtain an updated copy of the performance task.

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:
projectNamestr

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:
workflowNamestr

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:
filterstr, optional
startint, optional

Zero-based index of the first item to return. Defaults to 0.

limitint, optional

The maximum number of items to return. Defaults to 20.

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:
modelstr or dict

The name or id of the model, or a dictionary representation of the model.

destinationstr

Name of destination to publish the model to.

namestr, optional

Provide a custom name for the published model. Defaults to None.

forcebool, optional

Whether to overwrite the model if it already exists in the publishing destination. Defaults to False.

reload_model_tablebool, optional

Whether the model table in CAS should be reloaded. Defaults to False.

Returns:
classmethod update_performance_definition(item)#

Update a performance task instance.

Parameters:
itemdict
Returns:
None