abacusai.python_function

Classes

PythonFunction

Customer created python function

Module Contents

class abacusai.python_function.PythonFunction(client, notebookId=None, name=None, createdAt=None, functionVariableMappings=None, outputVariableMappings=None, functionName=None, pythonFunctionId=None, functionType=None, packageRequirements=None, codeSource={})

Bases: abacusai.return_class.AbstractApiClass

Customer created python function

Parameters:
  • client (ApiClient) – An authenticated API Client instance

  • notebookId (str) – The unique identifier of the notebook used to spin up the notebook upon creation.

  • name (str) – The name to identify the algorithm, only uppercase letters, numbers, and underscores allowed (i.e. it must be a valid Python identifier)

  • createdAt (str) – The ISO-8601 string representing when the Python function was created.

  • functionVariableMappings (dict) – A description of the function variables.

  • outputVariableMappings (dict) – A description of the variables returned by the function

  • functionName (str) – The name of the Python function to be used.

  • pythonFunctionId (str) – The unique identifier of the Python function.

  • functionType (str) – The type of the Python function.

  • packageRequirements (list) – The pip package dependencies required to run the code

  • codeSource (CodeSource) – Information about the source code of the Python function.

notebook_id
name
created_at
function_variable_mappings
output_variable_mappings
function_name
python_function_id
function_type
package_requirements
code_source
deprecated_keys
__repr__()
to_dict()

Get a dict representation of the parameters in this class

Returns:

The dict value representation of the class parameters

Return type:

dict

add_graph_to_dashboard(graph_dashboard_id, function_variable_mappings=None, name=None)

Add a python plot function to a dashboard

Parameters:
  • graph_dashboard_id (str) – Unique string identifier for the graph dashboard to update.

  • function_variable_mappings (List) – List of arguments to be supplied to the function as parameters, in the format [{‘name’: ‘function_argument’, ‘variable_type’: ‘FEATURE_GROUP’, ‘value’: ‘name_of_feature_group’}].

  • name (str) – Name of the added python plot

Returns:

An object describing the graph dashboard.

Return type:

GraphDashboard

validate_locally(kwargs=None)

Validates a Python function by running it with the given input values in an local environment. Taking Input Feature Group as either name(string) or Pandas DataFrame in kwargs.

Parameters:

kwargs (dict) – A dictionary mapping function arguments to values to pass to the function. Feature group names will automatically be converted into pandas dataframes.

Returns:

The result of executing the python function

Return type:

any

Raises:
  • TypeError – If an Input Feature Group argument has an invalid type or argument is missing.

  • Exception – If an error occurs while validating the Python function.