{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MachineLearning.Types.DetailsAttributes
import qualified Amazonka.Prelude as Prelude
data Prediction = Prediction'
{ Prediction -> Maybe (HashMap DetailsAttributes Text)
details :: Prelude.Maybe (Prelude.HashMap DetailsAttributes Prelude.Text),
Prediction -> Maybe Text
predictedLabel :: Prelude.Maybe Prelude.Text,
Prediction -> Maybe (HashMap Text Double)
predictedScores :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double),
Prediction -> Maybe Double
predictedValue :: Prelude.Maybe Prelude.Double
}
deriving (Prediction -> Prediction -> Bool
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]
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
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. 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'
{ $sel:details:Prediction' :: Maybe (HashMap DetailsAttributes Text)
details = forall a. Maybe a
Prelude.Nothing,
$sel:predictedLabel:Prediction' :: Maybe Text
predictedLabel = forall a. Maybe a
Prelude.Nothing,
$sel:predictedScores:Prediction' :: Maybe (HashMap Text Double)
predictedScores = forall a. Maybe a
Prelude.Nothing,
$sel:predictedValue:Prediction' :: Maybe Double
predictedValue = forall a. Maybe a
Prelude.Nothing
}
prediction_details :: Lens.Lens' Prediction (Prelude.Maybe (Prelude.HashMap DetailsAttributes Prelude.Text))
prediction_details :: Lens' Prediction (Maybe (HashMap DetailsAttributes Text))
prediction_details = 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) 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
prediction_predictedLabel :: Lens.Lens' Prediction (Prelude.Maybe Prelude.Text)
prediction_predictedLabel :: Lens' Prediction (Maybe Text)
prediction_predictedLabel = 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 :: Lens' Prediction (Maybe (HashMap Text Double))
prediction_predictedScores = 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) 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
prediction_predictedValue :: Lens.Lens' Prediction (Prelude.Maybe Prelude.Double)
prediction_predictedValue :: Lens' Prediction (Maybe Double)
prediction_predictedValue = 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)
instance Data.FromJSON Prediction where
parseJSON :: Value -> Parser Prediction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Prediction"
( \Object
x ->
Maybe (HashMap DetailsAttributes Text)
-> Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Prediction
Prediction'
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
"details" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"predictedLabel")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"predictedScores"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"predictedValue")
)
instance Prelude.Hashable Prediction where
hashWithSalt :: Int -> Prediction -> Int
hashWithSalt Int
_salt Prediction' {Maybe Double
Maybe Text
Maybe (HashMap Text Double)
Maybe (HashMap DetailsAttributes Text)
predictedValue :: Maybe Double
predictedScores :: Maybe (HashMap Text Double)
predictedLabel :: Maybe Text
details :: Maybe (HashMap DetailsAttributes Text)
$sel:predictedValue:Prediction' :: Prediction -> Maybe Double
$sel:predictedScores:Prediction' :: Prediction -> Maybe (HashMap Text Double)
$sel:predictedLabel:Prediction' :: Prediction -> Maybe Text
$sel:details:Prediction' :: Prediction -> Maybe (HashMap DetailsAttributes Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap DetailsAttributes Text)
details
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
predictedLabel
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Double)
predictedScores
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
predictedValue
instance Prelude.NFData Prediction where
rnf :: Prediction -> ()
rnf Prediction' {Maybe Double
Maybe Text
Maybe (HashMap Text Double)
Maybe (HashMap DetailsAttributes Text)
predictedValue :: Maybe Double
predictedScores :: Maybe (HashMap Text Double)
predictedLabel :: Maybe Text
details :: Maybe (HashMap DetailsAttributes Text)
$sel:predictedValue:Prediction' :: Prediction -> Maybe Double
$sel:predictedScores:Prediction' :: Prediction -> Maybe (HashMap Text Double)
$sel:predictedLabel:Prediction' :: Prediction -> Maybe Text
$sel:details:Prediction' :: Prediction -> Maybe (HashMap DetailsAttributes Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap DetailsAttributes Text)
details
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
predictedLabel
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Double)
predictedScores
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
predictedValue