{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a document classifier.
--
-- /See:/ 'newClassifierMetadata' smart constructor.
data ClassifierMetadata = ClassifierMetadata'
  { -- | Describes the result metrics for the test data associated with an
    -- documentation classifier.
    ClassifierMetadata -> Maybe ClassifierEvaluationMetrics
evaluationMetrics :: Prelude.Maybe ClassifierEvaluationMetrics,
    -- | The number of labels in the input data.
    ClassifierMetadata -> Maybe Int
numberOfLabels :: 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,
    -- | 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
  }
  deriving (ClassifierMetadata -> ClassifierMetadata -> Bool
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
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. 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:
--
-- 'evaluationMetrics', 'classifierMetadata_evaluationMetrics' - Describes the result metrics for the test data associated with an
-- documentation classifier.
--
-- 'numberOfLabels', 'classifierMetadata_numberOfLabels' - The number of labels in the input data.
--
-- '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.
--
-- '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.
newClassifierMetadata ::
  ClassifierMetadata
newClassifierMetadata :: ClassifierMetadata
newClassifierMetadata =
  ClassifierMetadata'
    { $sel:evaluationMetrics:ClassifierMetadata' :: Maybe ClassifierEvaluationMetrics
evaluationMetrics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfLabels:ClassifierMetadata' :: Maybe Int
numberOfLabels = forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfTestDocuments:ClassifierMetadata' :: Maybe Int
numberOfTestDocuments = forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfTrainedDocuments:ClassifierMetadata' :: Maybe Int
numberOfTrainedDocuments = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the result metrics for the test data associated with an
-- documentation classifier.
classifierMetadata_evaluationMetrics :: Lens.Lens' ClassifierMetadata (Prelude.Maybe ClassifierEvaluationMetrics)
classifierMetadata_evaluationMetrics :: Lens' ClassifierMetadata (Maybe ClassifierEvaluationMetrics)
classifierMetadata_evaluationMetrics = 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 labels in the input data.
classifierMetadata_numberOfLabels :: Lens.Lens' ClassifierMetadata (Prelude.Maybe Prelude.Int)
classifierMetadata_numberOfLabels :: Lens' ClassifierMetadata (Maybe Int)
classifierMetadata_numberOfLabels = 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)

-- | 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 :: Lens' ClassifierMetadata (Maybe Int)
classifierMetadata_numberOfTestDocuments = 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)

-- | 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 :: Lens' ClassifierMetadata (Maybe Int)
classifierMetadata_numberOfTrainedDocuments = 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)

instance Data.FromJSON ClassifierMetadata where
  parseJSON :: Value -> Parser ClassifierMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClassifierMetadata"
      ( \Object
x ->
          Maybe ClassifierEvaluationMetrics
-> Maybe Int -> Maybe Int -> Maybe Int -> ClassifierMetadata
ClassifierMetadata'
            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
"EvaluationMetrics")
            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
"NumberOfLabels")
            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
"NumberOfTestDocuments")
            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
"NumberOfTrainedDocuments")
      )

instance Prelude.Hashable ClassifierMetadata where
  hashWithSalt :: Int -> ClassifierMetadata -> Int
hashWithSalt Int
_salt ClassifierMetadata' {Maybe Int
Maybe ClassifierEvaluationMetrics
numberOfTrainedDocuments :: Maybe Int
numberOfTestDocuments :: Maybe Int
numberOfLabels :: Maybe Int
evaluationMetrics :: Maybe ClassifierEvaluationMetrics
$sel:numberOfTrainedDocuments:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
$sel:numberOfTestDocuments:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
$sel:numberOfLabels:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
$sel:evaluationMetrics:ClassifierMetadata' :: ClassifierMetadata -> Maybe ClassifierEvaluationMetrics
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ClassifierEvaluationMetrics
evaluationMetrics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
numberOfLabels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
numberOfTestDocuments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
numberOfTrainedDocuments

instance Prelude.NFData ClassifierMetadata where
  rnf :: ClassifierMetadata -> ()
rnf ClassifierMetadata' {Maybe Int
Maybe ClassifierEvaluationMetrics
numberOfTrainedDocuments :: Maybe Int
numberOfTestDocuments :: Maybe Int
numberOfLabels :: Maybe Int
evaluationMetrics :: Maybe ClassifierEvaluationMetrics
$sel:numberOfTrainedDocuments:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
$sel:numberOfTestDocuments:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
$sel:numberOfLabels:ClassifierMetadata' :: ClassifierMetadata -> Maybe Int
$sel:evaluationMetrics:ClassifierMetadata' :: ClassifierMetadata -> Maybe ClassifierEvaluationMetrics
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ClassifierEvaluationMetrics
evaluationMetrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
numberOfLabels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
numberOfTestDocuments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
numberOfTrainedDocuments