{-# 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.ErrorMetric where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ErrorMetric = ErrorMetric'
{
ErrorMetric -> Maybe Double
mase :: Prelude.Maybe Prelude.Double,
ErrorMetric -> Maybe Double
wape :: Prelude.Maybe Prelude.Double,
ErrorMetric -> Maybe Double
mape :: Prelude.Maybe Prelude.Double,
ErrorMetric -> Maybe Double
rmse :: Prelude.Maybe Prelude.Double,
ErrorMetric -> Maybe Text
forecastType :: Prelude.Maybe Prelude.Text
}
deriving (ErrorMetric -> ErrorMetric -> Bool
(ErrorMetric -> ErrorMetric -> Bool)
-> (ErrorMetric -> ErrorMetric -> Bool) -> Eq ErrorMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ErrorMetric -> ErrorMetric -> Bool
$c/= :: ErrorMetric -> ErrorMetric -> Bool
== :: ErrorMetric -> ErrorMetric -> Bool
$c== :: ErrorMetric -> ErrorMetric -> Bool
Prelude.Eq, ReadPrec [ErrorMetric]
ReadPrec ErrorMetric
Int -> ReadS ErrorMetric
ReadS [ErrorMetric]
(Int -> ReadS ErrorMetric)
-> ReadS [ErrorMetric]
-> ReadPrec ErrorMetric
-> ReadPrec [ErrorMetric]
-> Read ErrorMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ErrorMetric]
$creadListPrec :: ReadPrec [ErrorMetric]
readPrec :: ReadPrec ErrorMetric
$creadPrec :: ReadPrec ErrorMetric
readList :: ReadS [ErrorMetric]
$creadList :: ReadS [ErrorMetric]
readsPrec :: Int -> ReadS ErrorMetric
$creadsPrec :: Int -> ReadS ErrorMetric
Prelude.Read, Int -> ErrorMetric -> ShowS
[ErrorMetric] -> ShowS
ErrorMetric -> String
(Int -> ErrorMetric -> ShowS)
-> (ErrorMetric -> String)
-> ([ErrorMetric] -> ShowS)
-> Show ErrorMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ErrorMetric] -> ShowS
$cshowList :: [ErrorMetric] -> ShowS
show :: ErrorMetric -> String
$cshow :: ErrorMetric -> String
showsPrec :: Int -> ErrorMetric -> ShowS
$cshowsPrec :: Int -> ErrorMetric -> ShowS
Prelude.Show, (forall x. ErrorMetric -> Rep ErrorMetric x)
-> (forall x. Rep ErrorMetric x -> ErrorMetric)
-> Generic ErrorMetric
forall x. Rep ErrorMetric x -> ErrorMetric
forall x. ErrorMetric -> Rep ErrorMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ErrorMetric x -> ErrorMetric
$cfrom :: forall x. ErrorMetric -> Rep ErrorMetric x
Prelude.Generic)
newErrorMetric ::
ErrorMetric
newErrorMetric :: ErrorMetric
newErrorMetric =
ErrorMetric' :: Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> ErrorMetric
ErrorMetric'
{ $sel:mase:ErrorMetric' :: Maybe Double
mase = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:wape:ErrorMetric' :: Maybe Double
wape = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:mape:ErrorMetric' :: Maybe Double
mape = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:rmse:ErrorMetric' :: Maybe Double
rmse = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:forecastType:ErrorMetric' :: Maybe Text
forecastType = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
errorMetric_mase :: Lens.Lens' ErrorMetric (Prelude.Maybe Prelude.Double)
errorMetric_mase :: (Maybe Double -> f (Maybe Double)) -> ErrorMetric -> f ErrorMetric
errorMetric_mase = (ErrorMetric -> Maybe Double)
-> (ErrorMetric -> Maybe Double -> ErrorMetric)
-> Lens ErrorMetric ErrorMetric (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorMetric' {Maybe Double
mase :: Maybe Double
$sel:mase:ErrorMetric' :: ErrorMetric -> Maybe Double
mase} -> Maybe Double
mase) (\s :: ErrorMetric
s@ErrorMetric' {} Maybe Double
a -> ErrorMetric
s {$sel:mase:ErrorMetric' :: Maybe Double
mase = Maybe Double
a} :: ErrorMetric)
errorMetric_wape :: Lens.Lens' ErrorMetric (Prelude.Maybe Prelude.Double)
errorMetric_wape :: (Maybe Double -> f (Maybe Double)) -> ErrorMetric -> f ErrorMetric
errorMetric_wape = (ErrorMetric -> Maybe Double)
-> (ErrorMetric -> Maybe Double -> ErrorMetric)
-> Lens ErrorMetric ErrorMetric (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorMetric' {Maybe Double
wape :: Maybe Double
$sel:wape:ErrorMetric' :: ErrorMetric -> Maybe Double
wape} -> Maybe Double
wape) (\s :: ErrorMetric
s@ErrorMetric' {} Maybe Double
a -> ErrorMetric
s {$sel:wape:ErrorMetric' :: Maybe Double
wape = Maybe Double
a} :: ErrorMetric)
errorMetric_mape :: Lens.Lens' ErrorMetric (Prelude.Maybe Prelude.Double)
errorMetric_mape :: (Maybe Double -> f (Maybe Double)) -> ErrorMetric -> f ErrorMetric
errorMetric_mape = (ErrorMetric -> Maybe Double)
-> (ErrorMetric -> Maybe Double -> ErrorMetric)
-> Lens ErrorMetric ErrorMetric (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorMetric' {Maybe Double
mape :: Maybe Double
$sel:mape:ErrorMetric' :: ErrorMetric -> Maybe Double
mape} -> Maybe Double
mape) (\s :: ErrorMetric
s@ErrorMetric' {} Maybe Double
a -> ErrorMetric
s {$sel:mape:ErrorMetric' :: Maybe Double
mape = Maybe Double
a} :: ErrorMetric)
errorMetric_rmse :: Lens.Lens' ErrorMetric (Prelude.Maybe Prelude.Double)
errorMetric_rmse :: (Maybe Double -> f (Maybe Double)) -> ErrorMetric -> f ErrorMetric
errorMetric_rmse = (ErrorMetric -> Maybe Double)
-> (ErrorMetric -> Maybe Double -> ErrorMetric)
-> Lens ErrorMetric ErrorMetric (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorMetric' {Maybe Double
rmse :: Maybe Double
$sel:rmse:ErrorMetric' :: ErrorMetric -> Maybe Double
rmse} -> Maybe Double
rmse) (\s :: ErrorMetric
s@ErrorMetric' {} Maybe Double
a -> ErrorMetric
s {$sel:rmse:ErrorMetric' :: Maybe Double
rmse = Maybe Double
a} :: ErrorMetric)
errorMetric_forecastType :: Lens.Lens' ErrorMetric (Prelude.Maybe Prelude.Text)
errorMetric_forecastType :: (Maybe Text -> f (Maybe Text)) -> ErrorMetric -> f ErrorMetric
errorMetric_forecastType = (ErrorMetric -> Maybe Text)
-> (ErrorMetric -> Maybe Text -> ErrorMetric)
-> Lens ErrorMetric ErrorMetric (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorMetric' {Maybe Text
forecastType :: Maybe Text
$sel:forecastType:ErrorMetric' :: ErrorMetric -> Maybe Text
forecastType} -> Maybe Text
forecastType) (\s :: ErrorMetric
s@ErrorMetric' {} Maybe Text
a -> ErrorMetric
s {$sel:forecastType:ErrorMetric' :: Maybe Text
forecastType = Maybe Text
a} :: ErrorMetric)
instance Core.FromJSON ErrorMetric where
parseJSON :: Value -> Parser ErrorMetric
parseJSON =
String
-> (Object -> Parser ErrorMetric) -> Value -> Parser ErrorMetric
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ErrorMetric"
( \Object
x ->
Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> ErrorMetric
ErrorMetric'
(Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> ErrorMetric)
-> Parser (Maybe Double)
-> Parser
(Maybe Double
-> Maybe Double -> Maybe Double -> Maybe Text -> ErrorMetric)
forall (f :: * -> *) a b. Functor 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
"MASE")
Parser
(Maybe Double
-> Maybe Double -> Maybe Double -> Maybe Text -> ErrorMetric)
-> Parser (Maybe Double)
-> Parser
(Maybe Double -> Maybe Double -> Maybe Text -> ErrorMetric)
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
"WAPE")
Parser (Maybe Double -> Maybe Double -> Maybe Text -> ErrorMetric)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> Maybe Text -> ErrorMetric)
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
"MAPE")
Parser (Maybe Double -> Maybe Text -> ErrorMetric)
-> Parser (Maybe Double) -> Parser (Maybe Text -> ErrorMetric)
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 Text -> ErrorMetric)
-> Parser (Maybe Text) -> Parser ErrorMetric
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ForecastType")
)
instance Prelude.Hashable ErrorMetric
instance Prelude.NFData ErrorMetric