PayoffMatrix
- class datarobot.models.PayoffMatrix(project_id, id, name=None, true_positive_value=None, true_negative_value=None, false_positive_value=None, false_negative_value=None)
Represents a Payoff Matrix, a costs/benefit scenario used for creating a profit curve.
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]
- Attributes:
- project_idstr
id of the project with which the payoff matrix is associated.
- idstr
id of the payoff matrix.
- namestr
User-supplied label for the payoff matrix.
- true_positive_valuefloat
Cost or benefit of a true positive classification
- true_negative_valuefloat
Cost or benefit of a true negative classification
- false_positive_valuefloat
Cost or benefit of a false positive classification
- false_negative_valuefloat
Cost or benefit of a false negative classification
- 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_idstr
id of the project with which the payoff matrix will be associated
- Returns:
- payoff_matrix
PayoffMatrix
The newly created payoff matrix
- payoff_matrix
- Return type:
- classmethod list(project_id)
Fetch all the payoff matrices for a project.
- Parameters:
- project_idstr
id of the project
- Returns
- ——-
- List of PayoffMatrix
A list of
PayoffMatrix
objects- Raises
- ——
- datarobot.errors.ClientError
if the server responded with 4xx status
- datarobot.errors.ServerError
if the server responded with 5xx status
- Return type:
List
[PayoffMatrix
]
- classmethod get(project_id, id)
Retrieve a specified payoff matrix.
- Parameters:
- project_idstr
id of the project the model belongs to
- idstr
id of the payoff matrix
- Returns:
PayoffMatrix
object representing specified- payoff matrix
- Raises:
- datarobot.errors.ClientError
if the server responded with 4xx status
- datarobot.errors.ServerError
if the server responded with 5xx status
- Return type:
- 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_idstr
id of the project to which the payoff matrix belongs
- idstr
id of the payoff matrix
- namestr
User-supplied label for the payoff matrix
- true_positive_valuefloat
True positive payoff value to use for the profit curve
- true_negative_valuefloat
True negative payoff value to use for the profit curve
- false_positive_valuefloat
False positive payoff value to use for the profit curve
- false_negative_valuefloat
False negative payoff value to use for the profit curve
- Returns:
- payoff_matrix
PayoffMatrix with updated values
- Raises:
- datarobot.errors.ClientError
if the server responded with 4xx status
- datarobot.errors.ServerError
if the server responded with 5xx status
- Return type:
- classmethod delete(project_id, id)
Delete a specified payoff matrix.
- Parameters:
- project_idstr
id of the project the model belongs to
- idstr
id of the payoff matrix
- Returns:
- responserequests.Response
Empty response (204)
- Raises:
- datarobot.errors.ClientError
if the server responded with 4xx status
- datarobot.errors.ServerError
if the server responded with 5xx status
- Return type:
Response
- classmethod from_data(data)
Instantiate an object of this class using a dict.
- Parameters:
- datadict
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:
- datadict
The directly translated dict of JSON from the server. No casing fixes have taken place
- keep_attrsiterable
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)