{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MachineLearning.Types.PerformanceMetrics where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(PerformanceMetrics -> PerformanceMetrics -> Bool)
-> (PerformanceMetrics -> PerformanceMetrics -> Bool)
-> Eq PerformanceMetrics
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]
(Int -> ReadS PerformanceMetrics)
-> ReadS [PerformanceMetrics]
-> ReadPrec PerformanceMetrics
-> ReadPrec [PerformanceMetrics]
-> Read 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
(Int -> PerformanceMetrics -> ShowS)
-> (PerformanceMetrics -> String)
-> ([PerformanceMetrics] -> ShowS)
-> Show PerformanceMetrics
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. PerformanceMetrics -> Rep PerformanceMetrics x)
-> (forall x. Rep PerformanceMetrics x -> PerformanceMetrics)
-> Generic PerformanceMetrics
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' :: Maybe (HashMap Text Text) -> PerformanceMetrics
PerformanceMetrics' {$sel:properties:PerformanceMetrics' :: Maybe (HashMap Text Text)
properties = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing}

-- | Undocumented member.
performanceMetrics_properties :: Lens.Lens' PerformanceMetrics (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
performanceMetrics_properties :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PerformanceMetrics -> f PerformanceMetrics
performanceMetrics_properties = (PerformanceMetrics -> Maybe (HashMap Text Text))
-> (PerformanceMetrics
    -> Maybe (HashMap Text Text) -> PerformanceMetrics)
-> Lens
     PerformanceMetrics
     PerformanceMetrics
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> PerformanceMetrics -> f PerformanceMetrics)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PerformanceMetrics
-> f PerformanceMetrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PerformanceMetrics where
  parseJSON :: Value -> Parser PerformanceMetrics
parseJSON =
    String
-> (Object -> Parser PerformanceMetrics)
-> Value
-> Parser PerformanceMetrics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PerformanceMetrics"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> PerformanceMetrics
PerformanceMetrics'
            (Maybe (HashMap Text Text) -> PerformanceMetrics)
-> Parser (Maybe (HashMap Text Text)) -> Parser PerformanceMetrics
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Properties" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable PerformanceMetrics

instance Prelude.NFData PerformanceMetrics