Payoff matrix

class datarobot.models.PayoffMatrix

Represents a Payoff Matrix, a costs/benefit scenario used for creating a profit curve.

Variables:
  • project_id (str) – id of the project with which the payoff matrix is associated.

  • id (str) – id of the payoff matrix.

  • name (str) – User-supplied label for the payoff matrix.

  • true_positive_value (float) – Cost or benefit of a true positive classification

  • true_negative_value (float) – Cost or benefit of a true negative classification

  • false_positive_value (float) – Cost or benefit of a false positive classification

  • false_negative_value (float) – Cost or benefit of a false negative classification

Examples

import datarobot as dr

# create a payoff matrix
payoff_matrix = dr.PayoffMatrix.create(
    project_id,
    name,
    true_positive_value=100,
    true_negative_value=10,
    false_positive_value=0,
    false_negative_value=-10,
)

# list available payoff matrices
payoff_matrices = dr.PayoffMatrix.list(project_id)
payoff_matrix = payoff_matrices[0]
classmethod create(project_id, name, true_positive_value=1, true_negative_value=1, false_positive_value=-1, false_negative_value=-1)

Create a payoff matrix associated with a specific project.

Parameters:

project_id (str) – id of the project with which the payoff matrix will be associated

Returns:

payoff_matrix – The newly created payoff matrix

Return type:

PayoffMatrix

classmethod list(project_id)

Fetch all the payoff matrices for a project.

Parameters:

project_id (str) – id of the project

Returns:

A list of PayoffMatrix objects

Return type:

List of PayoffMatrix

Raises:
classmethod get(project_id, id)

Retrieve a specified payoff matrix.

Parameters:
  • project_id (str) – id of the project the model belongs to

  • id (str) – id of the payoff matrix

Return type:

PayoffMatrix

Returns:

Raises:
classmethod update(project_id, id, name, true_positive_value, true_negative_value, false_positive_value, false_negative_value)

Update (replace) a payoff matrix. Note that all data fields are required.

Parameters:
  • project_id (str) – id of the project to which the payoff matrix belongs

  • id (str) – id of the payoff matrix

  • name (str) – User-supplied label for the payoff matrix

  • true_positive_value (float) – True positive payoff value to use for the profit curve

  • true_negative_value (float) – True negative payoff value to use for the profit curve

  • false_positive_value (float) – False positive payoff value to use for the profit curve

  • false_negative_value (float) – False negative payoff value to use for the profit curve

Returns:

PayoffMatrix with updated values

Return type:

payoff_matrix

Raises:
classmethod delete(project_id, id)

Delete a specified payoff matrix.

Parameters:
  • project_id (str) – id of the project the model belongs to

  • id (str) – id of the payoff matrix

Returns:

response – Empty response (204)

Return type:

requests.Response

Raises:
classmethod from_data(data)

Instantiate an object of this class using a dict.

Parameters:

data (dict) – Correctly snake_cased keys and their values.

Return type:

TypeVar(T, bound= APIObject)

classmethod from_server_data(data, keep_attrs=None)

Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing

Parameters:
  • data (dict) – The directly translated dict of JSON from the server. No casing fixes have taken place

  • keep_attrs (iterable) – List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None

Return type:

TypeVar(T, bound= APIObject)