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 classificationtrue_negative_value (
float
) – Cost or benefit of a true negative classificationfalse_positive_value (
float
) – Cost or benefit of a false positive classificationfalse_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:
- 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
ofPayoffMatrix
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod get(project_id, id)
Retrieve a specified payoff matrix.
- Parameters:
project_id (
str
) – id of the project the model belongs toid (
str
) – id of the payoff matrix
- Return type:
- Returns:
PayoffMatrix
object representing specifiedpayoff matrix
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- 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 belongsid (
str
) – id of the payoff matrixname (
str
) – User-supplied label for the payoff matrixtrue_positive_value (
float
) – True positive payoff value to use for the profit curvetrue_negative_value (
float
) – True negative payoff value to use for the profit curvefalse_positive_value (
float
) – False positive payoff value to use for the profit curvefalse_negative_value (
float
) – False negative payoff value to use for the profit curve
- Returns:
PayoffMatrix with updated values
- Return type:
payoff_matrix
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod delete(project_id, id)
Delete a specified payoff matrix.
- Parameters:
project_id (
str
) – id of the project the model belongs toid (
str
) – id of the payoff matrix
- Returns:
response – Empty response (204)
- Return type:
requests.Response
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- 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 placekeep_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)