{-# 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.Comprehend.Types.ClassifierMetadata
-- 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.Comprehend.Types.ClassifierMetadata where

import Amazonka.Comprehend.Types.ClassifierEvaluationMetrics
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a document classifier.
--
-- /See:/ 'newClassifierMetadata' smart constructor.
data ClassifierMetadata = ClassifierMetadata'
  { -- | The number of labels in the input data.
    ClassifierMetadata -> Maybe Int
numberOfLabels :: Prelude.Maybe Prelude.Int,
    -- | Describes the result metrics for the test data associated with an
    -- documentation classifier.
    ClassifierMetadata -> Maybe ClassifierEvaluationMetrics
evaluationMetrics :: Prelude.Maybe ClassifierEvaluationMetrics,
    -- | The number of documents in the input data that were used to train the
    -- classifier. Typically this is 80 to 90 percent of the input documents.
    ClassifierMetadata -> Maybe Int
numberOfTrainedDocuments :: Prelude.Maybe Prelude.Int,
    -- | The number of documents in the input data that were used to test the
    -- classifier. Typically this is 10 to 20 percent of the input documents,
    -- up to 10,000 documents.
    ClassifierMetadata -> Maybe Int
numberOfTestDocuments :: Prelude.Maybe Prelude.Int
  }
  deriving (ClassifierMetadata -> ClassifierMetadata -> Bool
(ClassifierMetadata -> ClassifierMetadata -> Bool)
-> (ClassifierMetadata -> ClassifierMetadata -> Bool)
-> Eq ClassifierMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClassifierMetadata -> ClassifierMetadata -> Bool
$c/= :: ClassifierMetadata -> ClassifierMetadata -> Bool
== :: ClassifierMetadata -> ClassifierMetadata -> Bool
$c== :: ClassifierMetadata -> ClassifierMetadata -> Bool
Prelude.Eq, Int -> ClassifierMetadata -> ShowS
[ClassifierMetadata] -> ShowS
ClassifierMetadata -> String
(Int -> ClassifierMetadata -> ShowS)
-> (ClassifierMetadata -> String)
-> ([ClassifierMetadata] -> ShowS)
-> Show ClassifierMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClassifierMetadata] -> ShowS
$cshowList :: [ClassifierMetadata] -> ShowS
show :: ClassifierMetadata -> String
$cshow :: ClassifierMetadata -> String
showsPrec :: Int -> ClassifierMetadata -> ShowS
$cshowsPrec :: Int -> ClassifierMetadata -> ShowS
Prelude.Show, (forall x. ClassifierMetadata -> Rep ClassifierMetadata x)
-> (forall x. Rep ClassifierMetadata x -> ClassifierMetadata)
-> Generic ClassifierMetadata
forall x. Rep ClassifierMetadata x -> ClassifierMetadata
forall x. ClassifierMetadata -> Rep ClassifierMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClassifierMetadata x -> ClassifierMetadata
$cfrom :: forall x. ClassifierMetadata -> Rep ClassifierMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ClassifierMetadata' 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:
--
-- 'numberOfLabels', 'classifierMetadata_numberOfLabels' - The number of labels in the input data.
--
-- 'evaluationMetrics', 'classifierMetadata_evaluationMetrics' - Describes the result metrics for the test data associated with an
-- documentation classifier.
--
-- 'numberOfTrainedDocuments', 'classifierMetadata_numberOfTrainedDocuments' - The number of documents in the input data that were used to train the
-- classifier. Typically this is 80 to 90 percent of the input documents.
--
-- 'numberOfTestDocuments', 'classifierMetadata_numberOfTestDocuments' - The number of documents in the input data that were used to test the
-- classifier. Typically this is 10 to 20 percent of the input documents,
-- up to 10,000 documents.
newClassifierMetadata ::
  ClassifierMetadata
newClassifierMetadata :: ClassifierMetadata
newClassifierMetadata =
  ClassifierMetadata' :: Maybe Int
-> Maybe ClassifierEvaluationMetrics
-> Maybe Int
-> Maybe Int
-> ClassifierMetadata
ClassifierMetadata'
    { $sel:numberOfLabels:ClassifierMetadata' :: Maybe Int
numberOfLabels =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationMetrics:ClassifierMetadata' :: Maybe ClassifierEvaluationMetrics
evaluationMetrics = Maybe ClassifierEvaluationMetrics
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfTrainedDocuments:ClassifierMetadata' :: Maybe Int
numberOfTrainedDocuments = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfTestDocuments:ClassifierMetadata' :: Maybe Int
numberOfTestDocuments = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of labels in the input data.
classifierMetadata_numberOfLabels :: Lens.Lens' ClassifierMetadata (Prelude.Maybe Prelude.Int)
classifierMetadata_numberOfLabels :: (Maybe Int -> f (Maybe Int))
-> ClassifierMetadata -> f ClassifierMetadata
classifierMetadata_numberOfLabels = (ClassifierMetadata -> Maybe Int)
-> (ClassifierMetadata -> Maybe Int -> ClassifierMetadata)
-> Lens
     ClassifierMetadata ClassifierMetadata (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassifierMetadata' {Maybe Int
numberOfLabels :: Maybe Int
$sel:numberOfLabels:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
numberOfLabels} -> Maybe Int
numberOfLabels) (\s :: ClassifierMetadata
s@ClassifierMetadata' {} Maybe Int
a -> ClassifierMetadata
s {$sel:numberOfLabels:ClassifierMetadata' :: Maybe Int
numberOfLabels = Maybe Int
a} :: ClassifierMetadata)

-- | Describes the result metrics for the test data associated with an
-- documentation classifier.
classifierMetadata_evaluationMetrics :: Lens.Lens' ClassifierMetadata (Prelude.Maybe ClassifierEvaluationMetrics)
classifierMetadata_evaluationMetrics :: (Maybe ClassifierEvaluationMetrics
 -> f (Maybe ClassifierEvaluationMetrics))
-> ClassifierMetadata -> f ClassifierMetadata
classifierMetadata_evaluationMetrics = (ClassifierMetadata -> Maybe ClassifierEvaluationMetrics)
-> (ClassifierMetadata
    -> Maybe ClassifierEvaluationMetrics -> ClassifierMetadata)
-> Lens
     ClassifierMetadata
     ClassifierMetadata
     (Maybe ClassifierEvaluationMetrics)
     (Maybe ClassifierEvaluationMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassifierMetadata' {Maybe ClassifierEvaluationMetrics
evaluationMetrics :: Maybe ClassifierEvaluationMetrics
$sel:evaluationMetrics:ClassifierMetadata' :: ClassifierMetadata -> Maybe ClassifierEvaluationMetrics
evaluationMetrics} -> Maybe ClassifierEvaluationMetrics
evaluationMetrics) (\s :: ClassifierMetadata
s@ClassifierMetadata' {} Maybe ClassifierEvaluationMetrics
a -> ClassifierMetadata
s {$sel:evaluationMetrics:ClassifierMetadata' :: Maybe ClassifierEvaluationMetrics
evaluationMetrics = Maybe ClassifierEvaluationMetrics
a} :: ClassifierMetadata)

-- | The number of documents in the input data that were used to train the
-- classifier. Typically this is 80 to 90 percent of the input documents.
classifierMetadata_numberOfTrainedDocuments :: Lens.Lens' ClassifierMetadata (Prelude.Maybe Prelude.Int)
classifierMetadata_numberOfTrainedDocuments :: (Maybe Int -> f (Maybe Int))
-> ClassifierMetadata -> f ClassifierMetadata
classifierMetadata_numberOfTrainedDocuments = (ClassifierMetadata -> Maybe Int)
-> (ClassifierMetadata -> Maybe Int -> ClassifierMetadata)
-> Lens
     ClassifierMetadata ClassifierMetadata (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassifierMetadata' {Maybe Int
numberOfTrainedDocuments :: Maybe Int
$sel:numberOfTrainedDocuments:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
numberOfTrainedDocuments} -> Maybe Int
numberOfTrainedDocuments) (\s :: ClassifierMetadata
s@ClassifierMetadata' {} Maybe Int
a -> ClassifierMetadata
s {$sel:numberOfTrainedDocuments:ClassifierMetadata' :: Maybe Int
numberOfTrainedDocuments = Maybe Int
a} :: ClassifierMetadata)

-- | The number of documents in the input data that were used to test the
-- classifier. Typically this is 10 to 20 percent of the input documents,
-- up to 10,000 documents.
classifierMetadata_numberOfTestDocuments :: Lens.Lens' ClassifierMetadata (Prelude.Maybe Prelude.Int)
classifierMetadata_numberOfTestDocuments :: (Maybe Int -> f (Maybe Int))
-> ClassifierMetadata -> f ClassifierMetadata
classifierMetadata_numberOfTestDocuments = (ClassifierMetadata -> Maybe Int)
-> (ClassifierMetadata -> Maybe Int -> ClassifierMetadata)
-> Lens
     ClassifierMetadata ClassifierMetadata (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassifierMetadata' {Maybe Int
numberOfTestDocuments :: Maybe Int
$sel:numberOfTestDocuments:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
numberOfTestDocuments} -> Maybe Int
numberOfTestDocuments) (\s :: ClassifierMetadata
s@ClassifierMetadata' {} Maybe Int
a -> ClassifierMetadata
s {$sel:numberOfTestDocuments:ClassifierMetadata' :: Maybe Int
numberOfTestDocuments = Maybe Int
a} :: ClassifierMetadata)

instance Core.FromJSON ClassifierMetadata where
  parseJSON :: Value -> Parser ClassifierMetadata
parseJSON =
    String
-> (Object -> Parser ClassifierMetadata)
-> Value
-> Parser ClassifierMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClassifierMetadata"
      ( \Object
x ->
          Maybe Int
-> Maybe ClassifierEvaluationMetrics
-> Maybe Int
-> Maybe Int
-> ClassifierMetadata
ClassifierMetadata'
            (Maybe Int
 -> Maybe ClassifierEvaluationMetrics
 -> Maybe Int
 -> Maybe Int
 -> ClassifierMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe ClassifierEvaluationMetrics
      -> Maybe Int -> Maybe Int -> ClassifierMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfLabels")
            Parser
  (Maybe ClassifierEvaluationMetrics
   -> Maybe Int -> Maybe Int -> ClassifierMetadata)
-> Parser (Maybe ClassifierEvaluationMetrics)
-> Parser (Maybe Int -> Maybe Int -> ClassifierMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ClassifierEvaluationMetrics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EvaluationMetrics")
            Parser (Maybe Int -> Maybe Int -> ClassifierMetadata)
-> Parser (Maybe Int) -> Parser (Maybe Int -> ClassifierMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfTrainedDocuments")
            Parser (Maybe Int -> ClassifierMetadata)
-> Parser (Maybe Int) -> Parser ClassifierMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfTestDocuments")
      )

instance Prelude.Hashable ClassifierMetadata

instance Prelude.NFData ClassifierMetadata