{-# 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 #-}
module Amazonka.Forecast.Types.Metrics where
import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.ErrorMetric
import Amazonka.Forecast.Types.WeightedQuantileLoss
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Metrics = Metrics'
{
Metrics -> Maybe [ErrorMetric]
errorMetrics :: Prelude.Maybe [ErrorMetric],
Metrics -> Maybe Double
rmse :: Prelude.Maybe Prelude.Double,
Metrics -> Maybe [WeightedQuantileLoss]
weightedQuantileLosses :: Prelude.Maybe [WeightedQuantileLoss],
Metrics -> Maybe Double
averageWeightedQuantileLoss :: Prelude.Maybe Prelude.Double
}
deriving (Metrics -> Metrics -> Bool
(Metrics -> Metrics -> Bool)
-> (Metrics -> Metrics -> Bool) -> Eq Metrics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Metrics -> Metrics -> Bool
$c/= :: Metrics -> Metrics -> Bool
== :: Metrics -> Metrics -> Bool
$c== :: Metrics -> Metrics -> Bool
Prelude.Eq, ReadPrec [Metrics]
ReadPrec Metrics
Int -> ReadS Metrics
ReadS [Metrics]
(Int -> ReadS Metrics)
-> ReadS [Metrics]
-> ReadPrec Metrics
-> ReadPrec [Metrics]
-> Read Metrics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Metrics]
$creadListPrec :: ReadPrec [Metrics]
readPrec :: ReadPrec Metrics
$creadPrec :: ReadPrec Metrics
readList :: ReadS [Metrics]
$creadList :: ReadS [Metrics]
readsPrec :: Int -> ReadS Metrics
$creadsPrec :: Int -> ReadS Metrics
Prelude.Read, Int -> Metrics -> ShowS
[Metrics] -> ShowS
Metrics -> String
(Int -> Metrics -> ShowS)
-> (Metrics -> String) -> ([Metrics] -> ShowS) -> Show Metrics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Metrics] -> ShowS
$cshowList :: [Metrics] -> ShowS
show :: Metrics -> String
$cshow :: Metrics -> String
showsPrec :: Int -> Metrics -> ShowS
$cshowsPrec :: Int -> Metrics -> ShowS
Prelude.Show, (forall x. Metrics -> Rep Metrics x)
-> (forall x. Rep Metrics x -> Metrics) -> Generic Metrics
forall x. Rep Metrics x -> Metrics
forall x. Metrics -> Rep Metrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Metrics x -> Metrics
$cfrom :: forall x. Metrics -> Rep Metrics x
Prelude.Generic)
newMetrics ::
Metrics
newMetrics :: Metrics
newMetrics =
Metrics' :: Maybe [ErrorMetric]
-> Maybe Double
-> Maybe [WeightedQuantileLoss]
-> Maybe Double
-> Metrics
Metrics'
{ $sel:errorMetrics:Metrics' :: Maybe [ErrorMetric]
errorMetrics = Maybe [ErrorMetric]
forall a. Maybe a
Prelude.Nothing,
$sel:rmse:Metrics' :: Maybe Double
rmse = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:weightedQuantileLosses:Metrics' :: Maybe [WeightedQuantileLoss]
weightedQuantileLosses = Maybe [WeightedQuantileLoss]
forall a. Maybe a
Prelude.Nothing,
$sel:averageWeightedQuantileLoss:Metrics' :: Maybe Double
averageWeightedQuantileLoss = Maybe Double
forall a. Maybe a
Prelude.Nothing
}
metrics_errorMetrics :: Lens.Lens' Metrics (Prelude.Maybe [ErrorMetric])
metrics_errorMetrics :: (Maybe [ErrorMetric] -> f (Maybe [ErrorMetric]))
-> Metrics -> f Metrics
metrics_errorMetrics = (Metrics -> Maybe [ErrorMetric])
-> (Metrics -> Maybe [ErrorMetric] -> Metrics)
-> Lens Metrics Metrics (Maybe [ErrorMetric]) (Maybe [ErrorMetric])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metrics' {Maybe [ErrorMetric]
errorMetrics :: Maybe [ErrorMetric]
$sel:errorMetrics:Metrics' :: Metrics -> Maybe [ErrorMetric]
errorMetrics} -> Maybe [ErrorMetric]
errorMetrics) (\s :: Metrics
s@Metrics' {} Maybe [ErrorMetric]
a -> Metrics
s {$sel:errorMetrics:Metrics' :: Maybe [ErrorMetric]
errorMetrics = Maybe [ErrorMetric]
a} :: Metrics) ((Maybe [ErrorMetric] -> f (Maybe [ErrorMetric]))
-> Metrics -> f Metrics)
-> ((Maybe [ErrorMetric] -> f (Maybe [ErrorMetric]))
-> Maybe [ErrorMetric] -> f (Maybe [ErrorMetric]))
-> (Maybe [ErrorMetric] -> f (Maybe [ErrorMetric]))
-> Metrics
-> f Metrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ErrorMetric] [ErrorMetric] [ErrorMetric] [ErrorMetric]
-> Iso
(Maybe [ErrorMetric])
(Maybe [ErrorMetric])
(Maybe [ErrorMetric])
(Maybe [ErrorMetric])
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 [ErrorMetric] [ErrorMetric] [ErrorMetric] [ErrorMetric]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metrics_rmse :: Lens.Lens' Metrics (Prelude.Maybe Prelude.Double)
metrics_rmse :: (Maybe Double -> f (Maybe Double)) -> Metrics -> f Metrics
metrics_rmse = (Metrics -> Maybe Double)
-> (Metrics -> Maybe Double -> Metrics)
-> Lens Metrics Metrics (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metrics' {Maybe Double
rmse :: Maybe Double
$sel:rmse:Metrics' :: Metrics -> Maybe Double
rmse} -> Maybe Double
rmse) (\s :: Metrics
s@Metrics' {} Maybe Double
a -> Metrics
s {$sel:rmse:Metrics' :: Maybe Double
rmse = Maybe Double
a} :: Metrics)
metrics_weightedQuantileLosses :: Lens.Lens' Metrics (Prelude.Maybe [WeightedQuantileLoss])
metrics_weightedQuantileLosses :: (Maybe [WeightedQuantileLoss] -> f (Maybe [WeightedQuantileLoss]))
-> Metrics -> f Metrics
metrics_weightedQuantileLosses = (Metrics -> Maybe [WeightedQuantileLoss])
-> (Metrics -> Maybe [WeightedQuantileLoss] -> Metrics)
-> Lens
Metrics
Metrics
(Maybe [WeightedQuantileLoss])
(Maybe [WeightedQuantileLoss])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metrics' {Maybe [WeightedQuantileLoss]
weightedQuantileLosses :: Maybe [WeightedQuantileLoss]
$sel:weightedQuantileLosses:Metrics' :: Metrics -> Maybe [WeightedQuantileLoss]
weightedQuantileLosses} -> Maybe [WeightedQuantileLoss]
weightedQuantileLosses) (\s :: Metrics
s@Metrics' {} Maybe [WeightedQuantileLoss]
a -> Metrics
s {$sel:weightedQuantileLosses:Metrics' :: Maybe [WeightedQuantileLoss]
weightedQuantileLosses = Maybe [WeightedQuantileLoss]
a} :: Metrics) ((Maybe [WeightedQuantileLoss] -> f (Maybe [WeightedQuantileLoss]))
-> Metrics -> f Metrics)
-> ((Maybe [WeightedQuantileLoss]
-> f (Maybe [WeightedQuantileLoss]))
-> Maybe [WeightedQuantileLoss]
-> f (Maybe [WeightedQuantileLoss]))
-> (Maybe [WeightedQuantileLoss]
-> f (Maybe [WeightedQuantileLoss]))
-> Metrics
-> f Metrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[WeightedQuantileLoss]
[WeightedQuantileLoss]
[WeightedQuantileLoss]
[WeightedQuantileLoss]
-> Iso
(Maybe [WeightedQuantileLoss])
(Maybe [WeightedQuantileLoss])
(Maybe [WeightedQuantileLoss])
(Maybe [WeightedQuantileLoss])
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
[WeightedQuantileLoss]
[WeightedQuantileLoss]
[WeightedQuantileLoss]
[WeightedQuantileLoss]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metrics_averageWeightedQuantileLoss :: Lens.Lens' Metrics (Prelude.Maybe Prelude.Double)
metrics_averageWeightedQuantileLoss :: (Maybe Double -> f (Maybe Double)) -> Metrics -> f Metrics
metrics_averageWeightedQuantileLoss = (Metrics -> Maybe Double)
-> (Metrics -> Maybe Double -> Metrics)
-> Lens Metrics Metrics (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metrics' {Maybe Double
averageWeightedQuantileLoss :: Maybe Double
$sel:averageWeightedQuantileLoss:Metrics' :: Metrics -> Maybe Double
averageWeightedQuantileLoss} -> Maybe Double
averageWeightedQuantileLoss) (\s :: Metrics
s@Metrics' {} Maybe Double
a -> Metrics
s {$sel:averageWeightedQuantileLoss:Metrics' :: Maybe Double
averageWeightedQuantileLoss = Maybe Double
a} :: Metrics)
instance Core.FromJSON Metrics where
parseJSON :: Value -> Parser Metrics
parseJSON =
String -> (Object -> Parser Metrics) -> Value -> Parser Metrics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Metrics"
( \Object
x ->
Maybe [ErrorMetric]
-> Maybe Double
-> Maybe [WeightedQuantileLoss]
-> Maybe Double
-> Metrics
Metrics'
(Maybe [ErrorMetric]
-> Maybe Double
-> Maybe [WeightedQuantileLoss]
-> Maybe Double
-> Metrics)
-> Parser (Maybe [ErrorMetric])
-> Parser
(Maybe Double
-> Maybe [WeightedQuantileLoss] -> Maybe Double -> Metrics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ErrorMetric]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorMetrics" Parser (Maybe (Maybe [ErrorMetric]))
-> Maybe [ErrorMetric] -> Parser (Maybe [ErrorMetric])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ErrorMetric]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Double
-> Maybe [WeightedQuantileLoss] -> Maybe Double -> Metrics)
-> Parser (Maybe Double)
-> Parser (Maybe [WeightedQuantileLoss] -> Maybe Double -> Metrics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RMSE")
Parser (Maybe [WeightedQuantileLoss] -> Maybe Double -> Metrics)
-> Parser (Maybe [WeightedQuantileLoss])
-> Parser (Maybe Double -> Metrics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [WeightedQuantileLoss]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WeightedQuantileLosses"
Parser (Maybe (Maybe [WeightedQuantileLoss]))
-> Maybe [WeightedQuantileLoss]
-> Parser (Maybe [WeightedQuantileLoss])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [WeightedQuantileLoss]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Double -> Metrics)
-> Parser (Maybe Double) -> Parser Metrics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AverageWeightedQuantileLoss")
)
instance Prelude.Hashable Metrics
instance Prelude.NFData Metrics