liveBook · Manning

Decision_function

As explained in Outlier Detection in Python

decision_function is an estimator method that returns a numeric decision or anomaly score for each supplied record.

decision_function() returns a numeric score for every supplied test record after an anomaly detector has been fitted. Unlike predict(), which returns binary labels, it preserves score differences that can help rank records by anomalousness. section 6.1

Use the score alongside related PyOD outputs:

  • Compare decision_function() scores with predict() labels when a binary decision is also needed. section 6.1
  • Use decision_scores_ for numeric scores on the training data; decision_function() applies to supplied test data. section 6.1
  • Do not interpret predict_proba() as true probability merely because it rescales decision scores to values between zero and one. section 6.1

How Outlier Detection in Python covers it

How deep it goes
Distinguishes test scoring from labels and training scores, but does not derive detector-specific scoring internals.
Examples
Uses PyOD KNN scores on synthetic clustered data, contrasting outliers, edge points, and inliers.
What it assumes
Requires fitted detector data with categorical features encoded, missing values filled, and usually numeric features scaled.
What you can do after
Apply it through a fitted PyOD detector to obtain numeric scores for test records.
How it connects
Connects anomaly detection with predict(), predict_proba(), decision_scores_, KNN, KDE, and feature scaling.

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.