{-# 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.MachineLearning.Types.Prediction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types.DetailsAttributes
import qualified Amazonka.Prelude as Prelude
data Prediction = Prediction'
{
Prediction -> Maybe Double
predictedValue :: Prelude.Maybe Prelude.Double,
Prediction -> Maybe Text
predictedLabel :: Prelude.Maybe Prelude.Text,
Prediction -> Maybe (HashMap Text Double)
predictedScores :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double),
Prediction -> Maybe (HashMap DetailsAttributes Text)
details :: Prelude.Maybe (Prelude.HashMap DetailsAttributes Prelude.Text)
}
deriving (Prediction -> Prediction -> Bool
(Prediction -> Prediction -> Bool)
-> (Prediction -> Prediction -> Bool) -> Eq Prediction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Prediction -> Prediction -> Bool
$c/= :: Prediction -> Prediction -> Bool
== :: Prediction -> Prediction -> Bool
$c== :: Prediction -> Prediction -> Bool
Prelude.Eq, ReadPrec [Prediction]
ReadPrec Prediction
Int -> ReadS Prediction
ReadS [Prediction]
(Int -> ReadS Prediction)
-> ReadS [Prediction]
-> ReadPrec Prediction
-> ReadPrec [Prediction]
-> Read Prediction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Prediction]
$creadListPrec :: ReadPrec [Prediction]
readPrec :: ReadPrec Prediction
$creadPrec :: ReadPrec Prediction
readList :: ReadS [Prediction]
$creadList :: ReadS [Prediction]
readsPrec :: Int -> ReadS Prediction
$creadsPrec :: Int -> ReadS Prediction
Prelude.Read, Int -> Prediction -> ShowS
[Prediction] -> ShowS
Prediction -> String
(Int -> Prediction -> ShowS)
-> (Prediction -> String)
-> ([Prediction] -> ShowS)
-> Show Prediction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Prediction] -> ShowS
$cshowList :: [Prediction] -> ShowS
show :: Prediction -> String
$cshow :: Prediction -> String
showsPrec :: Int -> Prediction -> ShowS
$cshowsPrec :: Int -> Prediction -> ShowS
Prelude.Show, (forall x. Prediction -> Rep Prediction x)
-> (forall x. Rep Prediction x -> Prediction) -> Generic Prediction
forall x. Rep Prediction x -> Prediction
forall x. Prediction -> Rep Prediction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Prediction x -> Prediction
$cfrom :: forall x. Prediction -> Rep Prediction x
Prelude.Generic)
newPrediction ::
Prediction
newPrediction :: Prediction
newPrediction =
Prediction' :: Maybe Double
-> Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text)
-> Prediction
Prediction'
{ $sel:predictedValue:Prediction' :: Maybe Double
predictedValue = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:predictedLabel:Prediction' :: Maybe Text
predictedLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:predictedScores:Prediction' :: Maybe (HashMap Text Double)
predictedScores = Maybe (HashMap Text Double)
forall a. Maybe a
Prelude.Nothing,
$sel:details:Prediction' :: Maybe (HashMap DetailsAttributes Text)
details = Maybe (HashMap DetailsAttributes Text)
forall a. Maybe a
Prelude.Nothing
}
prediction_predictedValue :: Lens.Lens' Prediction (Prelude.Maybe Prelude.Double)
prediction_predictedValue :: (Maybe Double -> f (Maybe Double)) -> Prediction -> f Prediction
prediction_predictedValue = (Prediction -> Maybe Double)
-> (Prediction -> Maybe Double -> Prediction)
-> Lens Prediction Prediction (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Prediction' {Maybe Double
predictedValue :: Maybe Double
$sel:predictedValue:Prediction' :: Prediction -> Maybe Double
predictedValue} -> Maybe Double
predictedValue) (\s :: Prediction
s@Prediction' {} Maybe Double
a -> Prediction
s {$sel:predictedValue:Prediction' :: Maybe Double
predictedValue = Maybe Double
a} :: Prediction)
prediction_predictedLabel :: Lens.Lens' Prediction (Prelude.Maybe Prelude.Text)
prediction_predictedLabel :: (Maybe Text -> f (Maybe Text)) -> Prediction -> f Prediction
prediction_predictedLabel = (Prediction -> Maybe Text)
-> (Prediction -> Maybe Text -> Prediction)
-> Lens Prediction Prediction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Prediction' {Maybe Text
predictedLabel :: Maybe Text
$sel:predictedLabel:Prediction' :: Prediction -> Maybe Text
predictedLabel} -> Maybe Text
predictedLabel) (\s :: Prediction
s@Prediction' {} Maybe Text
a -> Prediction
s {$sel:predictedLabel:Prediction' :: Maybe Text
predictedLabel = Maybe Text
a} :: Prediction)
prediction_predictedScores :: Lens.Lens' Prediction (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double))
prediction_predictedScores :: (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> Prediction -> f Prediction
prediction_predictedScores = (Prediction -> Maybe (HashMap Text Double))
-> (Prediction -> Maybe (HashMap Text Double) -> Prediction)
-> Lens
Prediction
Prediction
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Prediction' {Maybe (HashMap Text Double)
predictedScores :: Maybe (HashMap Text Double)
$sel:predictedScores:Prediction' :: Prediction -> Maybe (HashMap Text Double)
predictedScores} -> Maybe (HashMap Text Double)
predictedScores) (\s :: Prediction
s@Prediction' {} Maybe (HashMap Text Double)
a -> Prediction
s {$sel:predictedScores:Prediction' :: Maybe (HashMap Text Double)
predictedScores = Maybe (HashMap Text Double)
a} :: Prediction) ((Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> Prediction -> f Prediction)
-> ((Maybe (HashMap Text Double)
-> f (Maybe (HashMap Text Double)))
-> Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> Prediction
-> f Prediction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
-> Iso
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
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 Double)
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
prediction_details :: Lens.Lens' Prediction (Prelude.Maybe (Prelude.HashMap DetailsAttributes Prelude.Text))
prediction_details :: (Maybe (HashMap DetailsAttributes Text)
-> f (Maybe (HashMap DetailsAttributes Text)))
-> Prediction -> f Prediction
prediction_details = (Prediction -> Maybe (HashMap DetailsAttributes Text))
-> (Prediction
-> Maybe (HashMap DetailsAttributes Text) -> Prediction)
-> Lens
Prediction
Prediction
(Maybe (HashMap DetailsAttributes Text))
(Maybe (HashMap DetailsAttributes Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Prediction' {Maybe (HashMap DetailsAttributes Text)
details :: Maybe (HashMap DetailsAttributes Text)
$sel:details:Prediction' :: Prediction -> Maybe (HashMap DetailsAttributes Text)
details} -> Maybe (HashMap DetailsAttributes Text)
details) (\s :: Prediction
s@Prediction' {} Maybe (HashMap DetailsAttributes Text)
a -> Prediction
s {$sel:details:Prediction' :: Maybe (HashMap DetailsAttributes Text)
details = Maybe (HashMap DetailsAttributes Text)
a} :: Prediction) ((Maybe (HashMap DetailsAttributes Text)
-> f (Maybe (HashMap DetailsAttributes Text)))
-> Prediction -> f Prediction)
-> ((Maybe (HashMap DetailsAttributes Text)
-> f (Maybe (HashMap DetailsAttributes Text)))
-> Maybe (HashMap DetailsAttributes Text)
-> f (Maybe (HashMap DetailsAttributes Text)))
-> (Maybe (HashMap DetailsAttributes Text)
-> f (Maybe (HashMap DetailsAttributes Text)))
-> Prediction
-> f Prediction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap DetailsAttributes Text)
(HashMap DetailsAttributes Text)
(HashMap DetailsAttributes Text)
(HashMap DetailsAttributes Text)
-> Iso
(Maybe (HashMap DetailsAttributes Text))
(Maybe (HashMap DetailsAttributes Text))
(Maybe (HashMap DetailsAttributes Text))
(Maybe (HashMap DetailsAttributes 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 DetailsAttributes Text)
(HashMap DetailsAttributes Text)
(HashMap DetailsAttributes Text)
(HashMap DetailsAttributes Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Prediction where
parseJSON :: Value -> Parser Prediction
parseJSON =
String
-> (Object -> Parser Prediction) -> Value -> Parser Prediction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Prediction"
( \Object
x ->
Maybe Double
-> Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text)
-> Prediction
Prediction'
(Maybe Double
-> Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text)
-> Prediction)
-> Parser (Maybe Double)
-> Parser
(Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text)
-> Prediction)
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
"predictedValue")
Parser
(Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text)
-> Prediction)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text) -> Prediction)
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
"predictedLabel")
Parser
(Maybe (HashMap Text Double)
-> Maybe (HashMap DetailsAttributes Text) -> Prediction)
-> Parser (Maybe (HashMap Text Double))
-> Parser (Maybe (HashMap DetailsAttributes Text) -> Prediction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Double)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"predictedScores"
Parser (Maybe (Maybe (HashMap Text Double)))
-> Maybe (HashMap Text Double)
-> Parser (Maybe (HashMap Text Double))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Double)
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe (HashMap DetailsAttributes Text) -> Prediction)
-> Parser (Maybe (HashMap DetailsAttributes Text))
-> Parser Prediction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (Maybe (HashMap DetailsAttributes Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"details" Parser (Maybe (Maybe (HashMap DetailsAttributes Text)))
-> Maybe (HashMap DetailsAttributes Text)
-> Parser (Maybe (HashMap DetailsAttributes Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap DetailsAttributes Text)
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Prediction
instance Prelude.NFData Prediction