sensitivity_low_alert ================================================= .. py:module:: evalml.objectives.sensitivity_low_alert .. autoapi-nested-parse:: Sensitivity at Low Alert Rates objective. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.objectives.sensitivity_low_alert.SensitivityLowAlert Attributes Summary ~~~~~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.objectives.sensitivity_low_alert.logger Contents ~~~~~~~~~~~~~~~~~~~ .. py:data:: logger .. py:class:: SensitivityLowAlert(alert_rate=0.01) Sensitivity at Low Alert Rates. :param alert_rate: percentage of top scores to classify as high risk. :type alert_rate: float **Attributes** .. list-table:: :widths: 15 85 :header-rows: 0 * - **expected_range** - [0, 1] * - **greater_is_better** - True * - **is_bounded_like_percentage** - True * - **name** - Sensitivity at Low Alert Rates * - **perfect_score** - 1.0 * - **problem_types** - [ProblemTypes.BINARY, ProblemTypes.TIME_SERIES_BINARY] * - **score_needs_proba** - False **Methods** .. autoapisummary:: :nosignatures: evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.calculate_percent_difference evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.can_optimize_threshold evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.decision_function evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.is_defined_for_problem_type evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.objective_function evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.optimize_threshold evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.positive_only evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.score evalml.objectives.sensitivity_low_alert.SensitivityLowAlert.validate_inputs .. py:method:: calculate_percent_difference(cls, score, baseline_score) :classmethod: Calculate the percent difference between scores. :param score: A score. Output of the score method of this objective. :type score: float :param baseline_score: A score. Output of the score method of this objective. In practice, this is the score achieved on this objective with a baseline estimator. :type baseline_score: float :returns: The percent difference between the scores. Note that for objectives that can be interpreted as percentages, this will be the difference between the reference score and score. For all other objectives, the difference will be normalized by the reference score. :rtype: float .. py:method:: can_optimize_threshold(cls) :property: Returns a boolean determining if we can optimize the binary classification objective threshold. This will be false for any objective that works directly with predicted probabilities, like log loss and AUC. Otherwise, it will be true. :returns: Whether or not an objective can be optimized. :rtype: bool .. py:method:: decision_function(self, ypred_proba, **kwargs) Determine if an observation is high risk given an alert rate. :param ypred_proba: Predicted probabilities. :type ypred_proba: pd.Series :param \*\*kwargs: Additional abritrary parameters. :returns: Whether or not an observation is high risk given an alert rate. :rtype: pd.Series .. py:method:: is_defined_for_problem_type(cls, problem_type) :classmethod: Returns whether or not an objective is defined for a problem type. .. py:method:: objective_function(self, y_true, y_predicted, **kwargs) Calculate sensitivity across all predictions, using the top alert_rate percent of observations as the predicted positive class. :param y_true: True labels. :type y_true: pd.Series :param y_predicted: Predicted labels based on alert_rate. :type y_predicted: pd.Series :param \*\*kwargs: Additional abritrary parameters. :returns: sensitivity using the observations with the top scores as the predicted positive class. :rtype: float .. py:method:: optimize_threshold(self, ypred_proba, y_true, X=None) Learn a binary classification threshold which optimizes the current objective. :param ypred_proba: The classifier's predicted probabilities :type ypred_proba: pd.Series :param y_true: The ground truth for the predictions. :type y_true: pd.Series :param X: Any extra columns that are needed from training data. :type X: pd.DataFrame, optional :returns: Optimal threshold for this objective. :raises RuntimeError: If objective cannot be optimized. .. py:method:: positive_only(cls) If True, this objective is only valid for positive data. Defaults to False. .. py:method:: score(self, y_true, y_predicted, y_train=None, X=None, sample_weight=None) Returns a numerical score indicating performance based on the differences between the predicted and actual values. :param y_predicted: Predicted values of length [n_samples] :type y_predicted: pd.Series :param y_true: Actual class labels of length [n_samples] :type y_true: pd.Series :param y_train: Observed training values of length [n_samples] :type y_train: pd.Series :param X: Extra data of shape [n_samples, n_features] necessary to calculate score :type X: pd.DataFrame or np.ndarray :param sample_weight: Sample weights used in computing objective value result :type sample_weight: pd.DataFrame or np.ndarray :returns: score .. py:method:: validate_inputs(self, y_true, y_predicted) Validate inputs for scoring.