| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Metrics
Description
Evaluation metrics for fitted models. The everyday entry point is
evaluate, which applies a model's prediction expression and a truth column to
a frame and folds a metric — no manual interpret/extract plumbing. Metrics are
plain functions (type Metric = Vector -> Vector -> Double), so you pass mse
or accuracy directly. Classification metrics handle multiclass via Average;
classificationReport / regressionReport bundle the common numbers with a
scikit-learn-style Show.
Synopsis
- type Metric = Vector Double -> Vector Double -> Double
- evaluate :: Metric -> Expr Double -> Expr Double -> DataFrame -> Double
- predictColumn :: Text -> Expr Double -> DataFrame -> DataFrame
- columnOf :: DataFrame -> Expr Double -> Vector Double
- mse :: Metric
- rmse :: Metric
- mae :: Metric
- r2 :: Metric
- accuracy :: Metric
- logLoss :: Metric
- data Average
- precision :: Average -> Vector Double -> Vector Double -> Double
- recall :: Average -> Vector Double -> Vector Double -> Double
- f1 :: Average -> Vector Double -> Vector Double -> Double
- rocAuc :: Vector Double -> Vector Double -> Double
- classCounts :: Vector Double -> Vector Double -> [(Double, (Int, Int, Int, Int))]
- precOf :: (Int, Int, Int, Int) -> Double
- recOf :: (Int, Int, Int, Int) -> Double
- f1Of :: (Int, Int, Int, Int) -> Double
Metric type + evaluation
type Metric = Vector Double -> Vector Double -> Double Source #
A metric maps predictions and ground truth to a scalar score.
evaluate :: Metric -> Expr Double -> Expr Double -> DataFrame -> Double Source #
Evaluate a model's prediction expression against a truth column on a frame.
evaluate rmse (linearExpr model) (F.col @Double "target") df evaluate accuracy (logisticDecisionExpr model) (F.col @Double "label") df
predictColumn :: Text -> Expr Double -> DataFrame -> DataFrame Source #
Add a model's prediction expression to a frame as a named column.
columnOf :: DataFrame -> Expr Double -> Vector Double Source #
Interpret an expression to a Double vector over a frame.
Regression metrics
Classification metrics
Averaging strategy for multiclass precisionrecallF1.
precision :: Average -> Vector Double -> Vector Double -> Double Source #
Precision with the given averaging.
recall :: Average -> Vector Double -> Vector Double -> Double Source #
Recall with the given averaging.
rocAuc :: Vector Double -> Vector Double -> Double Source #
Binary ROC-AUC (Mann–Whitney). scores are predicted probabilities, truth
is 0/1.