{-# 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.MachineLearning.Types.PerformanceMetrics
-- 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.MachineLearning.Types.PerformanceMetrics 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

-- | Measurements of how well the @MLModel@ performed on known observations.
-- One of the following metrics is returned, based on the type of the
-- @MLModel@:
--
-- -   BinaryAUC: The binary @MLModel@ uses the Area Under the Curve (AUC)
--     technique to measure performance.
--
-- -   RegressionRMSE: The regression @MLModel@ uses the Root Mean Square
--     Error (RMSE) technique to measure performance. RMSE measures the
--     difference between predicted and actual values for a single
--     variable.
--
-- -   MulticlassAvgFScore: The multiclass @MLModel@ uses the F1 score
--     technique to measure performance.
--
-- For more information about performance metrics, please see the
-- <https://docs.aws.amazon.com/machine-learning/latest/dg Amazon Machine Learning Developer Guide>.
--
-- /See:/ 'newPerformanceMetrics' smart constructor.
data PerformanceMetrics = PerformanceMetrics'
  { PerformanceMetrics -> Maybe (HashMap Text Text)
properties :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (PerformanceMetrics -> PerformanceMetrics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PerformanceMetrics -> PerformanceMetrics -> Bool
$c/= :: PerformanceMetrics -> PerformanceMetrics -> Bool
== :: PerformanceMetrics -> PerformanceMetrics -> Bool
$c== :: PerformanceMetrics -> PerformanceMetrics -> Bool
Prelude.Eq, ReadPrec [PerformanceMetrics]
ReadPrec PerformanceMetrics
Int -> ReadS PerformanceMetrics
ReadS [PerformanceMetrics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PerformanceMetrics]
$creadListPrec :: ReadPrec [PerformanceMetrics]
readPrec :: ReadPrec PerformanceMetrics
$creadPrec :: ReadPrec PerformanceMetrics
readList :: ReadS [PerformanceMetrics]
$creadList :: ReadS [PerformanceMetrics]
readsPrec :: Int -> ReadS PerformanceMetrics
$creadsPrec :: Int -> ReadS PerformanceMetrics
Prelude.Read, Int -> PerformanceMetrics -> ShowS
[PerformanceMetrics] -> ShowS
PerformanceMetrics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PerformanceMetrics] -> ShowS
$cshowList :: [PerformanceMetrics] -> ShowS
show :: PerformanceMetrics -> String
$cshow :: PerformanceMetrics -> String
showsPrec :: Int -> PerformanceMetrics -> ShowS
$cshowsPrec :: Int -> PerformanceMetrics -> ShowS
Prelude.Show, forall x. Rep PerformanceMetrics x -> PerformanceMetrics
forall x. PerformanceMetrics -> Rep PerformanceMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PerformanceMetrics x -> PerformanceMetrics
$cfrom :: forall x. PerformanceMetrics -> Rep PerformanceMetrics x
Prelude.Generic)

-- |
-- Create a value of 'PerformanceMetrics' 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:
--
-- 'properties', 'performanceMetrics_properties' - Undocumented member.
newPerformanceMetrics ::
  PerformanceMetrics
newPerformanceMetrics :: PerformanceMetrics
newPerformanceMetrics =
  PerformanceMetrics' {$sel:properties:PerformanceMetrics' :: Maybe (HashMap Text Text)
properties = forall a. Maybe a
Prelude.Nothing}

-- | Undocumented member.
performanceMetrics_properties :: Lens.Lens' PerformanceMetrics (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
performanceMetrics_properties :: Lens' PerformanceMetrics (Maybe (HashMap Text Text))
performanceMetrics_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PerformanceMetrics' {Maybe (HashMap Text Text)
properties :: Maybe (HashMap Text Text)
$sel:properties:PerformanceMetrics' :: PerformanceMetrics -> Maybe (HashMap Text Text)
properties} -> Maybe (HashMap Text Text)
properties) (\s :: PerformanceMetrics
s@PerformanceMetrics' {} Maybe (HashMap Text Text)
a -> PerformanceMetrics
s {$sel:properties:PerformanceMetrics' :: Maybe (HashMap Text Text)
properties = Maybe (HashMap Text Text)
a} :: PerformanceMetrics) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON PerformanceMetrics where
  parseJSON :: Value -> Parser PerformanceMetrics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PerformanceMetrics"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> PerformanceMetrics
PerformanceMetrics'
            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
"Properties" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable PerformanceMetrics where
  hashWithSalt :: Int -> PerformanceMetrics -> Int
hashWithSalt Int
_salt PerformanceMetrics' {Maybe (HashMap Text Text)
properties :: Maybe (HashMap Text Text)
$sel:properties:PerformanceMetrics' :: PerformanceMetrics -> Maybe (HashMap Text Text)
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
properties

instance Prelude.NFData PerformanceMetrics where
  rnf :: PerformanceMetrics -> ()
rnf PerformanceMetrics' {Maybe (HashMap Text Text)
properties :: Maybe (HashMap Text Text)
$sel:properties:PerformanceMetrics' :: PerformanceMetrics -> Maybe (HashMap Text Text)
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
properties