{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.LookoutVision.Types.ModelPerformance
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LookoutVision.Types.ModelPerformance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information about the evaluation performance of a trained model.
--
-- /See:/ 'newModelPerformance' smart constructor.
data ModelPerformance = ModelPerformance'
  { -- | The overall F1 score metric for the trained model.
    ModelPerformance -> Maybe Double
f1Score :: Prelude.Maybe Prelude.Double,
    -- | The overall precision metric value for the trained model.
    ModelPerformance -> Maybe Double
precision :: Prelude.Maybe Prelude.Double,
    -- | The overall recall metric value for the trained model.
    ModelPerformance -> Maybe Double
recall :: Prelude.Maybe Prelude.Double
  }
  deriving (ModelPerformance -> ModelPerformance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelPerformance -> ModelPerformance -> Bool
$c/= :: ModelPerformance -> ModelPerformance -> Bool
== :: ModelPerformance -> ModelPerformance -> Bool
$c== :: ModelPerformance -> ModelPerformance -> Bool
Prelude.Eq, ReadPrec [ModelPerformance]
ReadPrec ModelPerformance
Int -> ReadS ModelPerformance
ReadS [ModelPerformance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelPerformance]
$creadListPrec :: ReadPrec [ModelPerformance]
readPrec :: ReadPrec ModelPerformance
$creadPrec :: ReadPrec ModelPerformance
readList :: ReadS [ModelPerformance]
$creadList :: ReadS [ModelPerformance]
readsPrec :: Int -> ReadS ModelPerformance
$creadsPrec :: Int -> ReadS ModelPerformance
Prelude.Read, Int -> ModelPerformance -> ShowS
[ModelPerformance] -> ShowS
ModelPerformance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelPerformance] -> ShowS
$cshowList :: [ModelPerformance] -> ShowS
show :: ModelPerformance -> String
$cshow :: ModelPerformance -> String
showsPrec :: Int -> ModelPerformance -> ShowS
$cshowsPrec :: Int -> ModelPerformance -> ShowS
Prelude.Show, forall x. Rep ModelPerformance x -> ModelPerformance
forall x. ModelPerformance -> Rep ModelPerformance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelPerformance x -> ModelPerformance
$cfrom :: forall x. ModelPerformance -> Rep ModelPerformance x
Prelude.Generic)

-- |
-- Create a value of 'ModelPerformance' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'f1Score', 'modelPerformance_f1Score' - The overall F1 score metric for the trained model.
--
-- 'precision', 'modelPerformance_precision' - The overall precision metric value for the trained model.
--
-- 'recall', 'modelPerformance_recall' - The overall recall metric value for the trained model.
newModelPerformance ::
  ModelPerformance
newModelPerformance :: ModelPerformance
newModelPerformance =
  ModelPerformance'
    { $sel:f1Score:ModelPerformance' :: Maybe Double
f1Score = forall a. Maybe a
Prelude.Nothing,
      $sel:precision:ModelPerformance' :: Maybe Double
precision = forall a. Maybe a
Prelude.Nothing,
      $sel:recall:ModelPerformance' :: Maybe Double
recall = forall a. Maybe a
Prelude.Nothing
    }

-- | The overall F1 score metric for the trained model.
modelPerformance_f1Score :: Lens.Lens' ModelPerformance (Prelude.Maybe Prelude.Double)
modelPerformance_f1Score :: Lens' ModelPerformance (Maybe Double)
modelPerformance_f1Score = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPerformance' {Maybe Double
f1Score :: Maybe Double
$sel:f1Score:ModelPerformance' :: ModelPerformance -> Maybe Double
f1Score} -> Maybe Double
f1Score) (\s :: ModelPerformance
s@ModelPerformance' {} Maybe Double
a -> ModelPerformance
s {$sel:f1Score:ModelPerformance' :: Maybe Double
f1Score = Maybe Double
a} :: ModelPerformance)

-- | The overall precision metric value for the trained model.
modelPerformance_precision :: Lens.Lens' ModelPerformance (Prelude.Maybe Prelude.Double)
modelPerformance_precision :: Lens' ModelPerformance (Maybe Double)
modelPerformance_precision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPerformance' {Maybe Double
precision :: Maybe Double
$sel:precision:ModelPerformance' :: ModelPerformance -> Maybe Double
precision} -> Maybe Double
precision) (\s :: ModelPerformance
s@ModelPerformance' {} Maybe Double
a -> ModelPerformance
s {$sel:precision:ModelPerformance' :: Maybe Double
precision = Maybe Double
a} :: ModelPerformance)

-- | The overall recall metric value for the trained model.
modelPerformance_recall :: Lens.Lens' ModelPerformance (Prelude.Maybe Prelude.Double)
modelPerformance_recall :: Lens' ModelPerformance (Maybe Double)
modelPerformance_recall = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPerformance' {Maybe Double
recall :: Maybe Double
$sel:recall:ModelPerformance' :: ModelPerformance -> Maybe Double
recall} -> Maybe Double
recall) (\s :: ModelPerformance
s@ModelPerformance' {} Maybe Double
a -> ModelPerformance
s {$sel:recall:ModelPerformance' :: Maybe Double
recall = Maybe Double
a} :: ModelPerformance)

instance Data.FromJSON ModelPerformance where
  parseJSON :: Value -> Parser ModelPerformance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelPerformance"
      ( \Object
x ->
          Maybe Double -> Maybe Double -> Maybe Double -> ModelPerformance
ModelPerformance'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"F1Score")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Precision")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Recall")
      )

instance Prelude.Hashable ModelPerformance where
  hashWithSalt :: Int -> ModelPerformance -> Int
hashWithSalt Int
_salt ModelPerformance' {Maybe Double
recall :: Maybe Double
precision :: Maybe Double
f1Score :: Maybe Double
$sel:recall:ModelPerformance' :: ModelPerformance -> Maybe Double
$sel:precision:ModelPerformance' :: ModelPerformance -> Maybe Double
$sel:f1Score:ModelPerformance' :: ModelPerformance -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
f1Score
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
precision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
recall

instance Prelude.NFData ModelPerformance where
  rnf :: ModelPerformance -> ()
rnf ModelPerformance' {Maybe Double
recall :: Maybe Double
precision :: Maybe Double
f1Score :: Maybe Double
$sel:recall:ModelPerformance' :: ModelPerformance -> Maybe Double
$sel:precision:ModelPerformance' :: ModelPerformance -> Maybe Double
$sel:f1Score:ModelPerformance' :: ModelPerformance -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
f1Score
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
precision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
recall