class_docstr: An unsupervised learning algorithm attempting to describe data as distinct categories.
  
  LDA is most commonly used to discover a
  user-specified number of topics shared by documents within a text corpus. Here each
  observation is a document, the features are the presence (or occurrence count) of each
  word, and the categories are the topics.
class_docstr_tok: ["An","unsupervised","learning","algorithm","attempting","to","describe","data","as","distinct","categories",".","LDA","is","most","commonly","used","to","discover","a","user-specified","number","of","topics","shared","by","documents","within","a","text","corpus",".","Here","each","observation","is","a","document",",","the","features","are","the","presence","(","or","occurrence","count",")","of","each","word",",","and","the","categories","are","the","topics","."]
docstr: Latent Dirichlet Allocation (LDA) is :class:`Estimator` used for unsupervised learning.
  
  Amazon SageMaker Latent Dirichlet Allocation is an unsupervised
  learning algorithm that attempts to describe a set of observations as a
  mixture of distinct categories. LDA is most commonly used to discover a
  user-specified number of topics shared by documents within a text
  corpus. Here each observation is a document, the features are the
  presence (or occurrence count) of each word, and the categories are the
  topics.
  
  This Estimator may be fit via calls to
  :meth:`~sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase.fit`.
  It requires Amazon :class:`~sagemaker.amazon.record_pb2.Record` protobuf
  serialized data to be stored in S3. There is an utility
  :meth:`~sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase.record_set`
  that can be used to upload data to S3 and creates
  :class:`~sagemaker.amazon.amazon_estimator.RecordSet` to be passed to
  the `fit` call.
  
  To learn more about the Amazon protobuf Record class and how to
  prepare bulk data in this format, please consult AWS technical
  documentation:
  https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-training.html
  
  After this Estimator is fit, model data is stored in S3. The model
  may be deployed to an Amazon SageMaker Endpoint by invoking
  :meth:`~sagemaker.amazon.estimator.EstimatorBase.deploy`. As well as
  deploying an Endpoint, deploy returns a
  :class:`~sagemaker.amazon.lda.LDAPredictor` object that can be used for
  inference calls using the trained model hosted in the SageMaker
  Endpoint.
  
  LDA Estimators can be configured by setting hyperparameters. The
  available hyperparameters for LDA are documented below.
  
  For further information on the AWS LDA algorithm, please consult AWS
  technical documentation:
  https://docs.aws.amazon.com/sagemaker/latest/dg/lda.html
  
  Args:
      role (str): An AWS IAM role (either name or full ARN). The Amazon
          SageMaker training jobs and APIs that create Amazon SageMaker
          endpoints use this role to access training data and model
          artifacts. After the endpoint is created, the inference code
          might use the IAM role, if accessing AWS resource.
      instance_type (str or PipelineVariable): Type of EC2 instance to use for training,
          for example, 'ml.c4.xlarge'.
      num_topics (int): The number of topics for LDA to find within the
          data.
      alpha0 (float): Optional. Initial guess for the concentration
          parameter
      max_restarts (int): Optional. The number of restarts to perform
          during the Alternating Least Squares (ALS) spectral
          decomposition phase of the algorithm.
      max_iterations (int): Optional. The maximum number of iterations to
          perform during the ALS phase of the algorithm.
      tol (float): Optional. Target error tolerance for the ALS phase of
          the algorithm.
      **kwargs: base class keyword argument values.
  
  .. tip::
  
      You can find additional parameters for initializing this class at
      :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and
      :class:`~sagemaker.estimator.EstimatorBase`.
docstr_tok: ["Latent","Dirichlet","Allocation","(","LDA",")","is",":","class",":","`","Estimator","`","used","for","unsupervised","learning",".","Amazon","SageMaker","Latent","Dirichlet","Allocation","is","an","unsupervised","learning","algorithm","that","attempts","to","describe","a","set","of","observations","as","a","mixture","of","distinct","categories",".","LDA","is","most","commonly","used","to","discover","a","user-specified","number","of","topics","shared","by","documents","within","a","text","corpus",".","Here","each","observation","is","a","document",",","the","features","are","the","presence","(","or","occurrence","count",")","of","each","word",",","and","the","categories","are","the","topics",".","This","Estimator","may","be","fit","via","calls","to",":","meth",":","`","~sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase.fit","`",".","It","requires","Amazon",":","class",":","`","~sagemaker.amazon.record_pb2.Record","`","protobuf","serialized","data","to","be","stored","in","S3",".","There","is","an","utility",":","meth",":","`","~sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase.record_set","`","that","can","be","used","to","upload","data","to","S3","and","creates",":","class",":","`","~sagemaker.amazon.amazon_estimator.RecordSet","`","to","be","passed","to","the","`","fit","`","call",".","To","learn","more","about","the","Amazon","protobuf","Record","class","and","how","to","prepare","bulk","data","in","this","format",",","please","consult","AWS","technical","documentation",":","https",":","\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/cdf-training.html","After","this","Estimator","is","fit",",","model","data","is","stored","in","S3",".","The","model","may","be","deployed","to","an","Amazon","SageMaker","Endpoint","by","invoking",":","meth",":","`","~sagemaker.amazon.estimator.EstimatorBase.deploy","`",".","As","well","as","deploying","an","Endpoint",",","deploy","returns","a",":","class",":","`","~sagemaker.amazon.lda.LDAPredictor","`","object","that","can","be","used","for","inference","calls","using","the","trained","model","hosted","in","the","SageMaker","Endpoint",".","LDA","Estimators","can","be","configured","by","setting","hyperparameters",".","The","available","hyperparameters","for","LDA","are","documented","below",".","For","further","information","on","the","AWS","LDA","algorithm",",","please","consult","AWS","technical","documentation",":","https",":","\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/lda.html","Args",":","role","(","str",")",":","An","AWS","IAM","role","(","either","name","or","full","ARN",")",".","The","Amazon","SageMaker","training","jobs","and","APIs","that","create","Amazon","SageMaker","endpoints","use","this","role","to","access","training","data","and","model","artifacts",".","After","the","endpoint","is","created",",","the","inference","code","might","use","the","IAM","role",",","if","accessing","AWS","resource",".","instance_type","(","str","or","PipelineVariable",")",":","Type","of","EC2","instance","to","use","for","training",",","for","example",",","'ml.c4.xlarge","'",".","num_topics","(","int",")",":","The","number","of","topics","for","LDA","to","find","within","the","data",".","alpha0","(","float",")",":","Optional",".","Initial","guess","for","the","concentration","parameter","max_restarts","(","int",")",":","Optional",".","The","number","of","restarts","to","perform","during","the","Alternating","Least","Squares","(","ALS",")","spectral","decomposition","phase","of","the","algorithm",".","max_iterations","(","int",")",":","Optional",".","The","maximum","number","of","iterations","to","perform","during","the","ALS","phase","of","the","algorithm",".","tol","(","float",")",":","Optional",".","Target","error","tolerance","for","the","ALS","phase","of","the","algorithm",".","*","*","kwargs",":","base","class","keyword","argument","values",".","..","tip",":",":","You","can","find","additional","parameters","for","initializing","this","class","at",":","class",":","`","~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase","`","and",":","class",":","`","~sagemaker.estimator.EstimatorBase","`","."]
code: def __init__(
      self,
      role: Optional[Union[str, PipelineVariable]] = None,
      instance_type: Optional[Union[str, PipelineVariable]] = None,
      num_topics: Optional[int] = None,
      alpha0: Optional[float] = None,
      max_restarts: Optional[int] = None,
      max_iterations: Optional[int] = None,
      tol: Optional[float] = None,
      **kwargs,
  ):
      """Latent Dirichlet Allocation (LDA) is :class:`Estimator` used for unsupervised learning.
  
      Amazon SageMaker Latent Dirichlet Allocation is an unsupervised
      learning algorithm that attempts to describe a set of observations as a
      mixture of distinct categories. LDA is most commonly used to discover a
      user-specified number of topics shared by documents within a text
      corpus. Here each observation is a document, the features are the
      presence (or occurrence count) of each word, and the categories are the
      topics.
  
      This Estimator may be fit via calls to
      :meth:`~sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase.fit`.
      It requires Amazon :class:`~sagemaker.amazon.record_pb2.Record` protobuf
      serialized data to be stored in S3. There is an utility
      :meth:`~sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase.record_set`
      that can be used to upload data to S3 and creates
      :class:`~sagemaker.amazon.amazon_estimator.RecordSet` to be passed to
      the `fit` call.
  
      To learn more about the Amazon protobuf Record class and how to
      prepare bulk data in this format, please consult AWS technical
      documentation:
      https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-training.html
  
      After this Estimator is fit, model data is stored in S3. The model
      may be deployed to an Amazon SageMaker Endpoint by invoking
      :meth:`~sagemaker.amazon.estimator.EstimatorBase.deploy`. As well as
      deploying an Endpoint, deploy returns a
      :class:`~sagemaker.amazon.lda.LDAPredictor` object that can be used for
      inference calls using the trained model hosted in the SageMaker
      Endpoint.
  
      LDA Estimators can be configured by setting hyperparameters. The
      available hyperparameters for LDA are documented below.
  
      For further information on the AWS LDA algorithm, please consult AWS
      technical documentation:
      https://docs.aws.amazon.com/sagemaker/latest/dg/lda.html
  
      Args:
          role (str): An AWS IAM role (either name or full ARN). The Amazon
              SageMaker training jobs and APIs that create Amazon SageMaker
              endpoints use this role to access training data and model
              artifacts. After the endpoint is created, the inference code
              might use the IAM role, if accessing AWS resource.
          instance_type (str or PipelineVariable): Type of EC2 instance to use for training,
              for example, 'ml.c4.xlarge'.
          num_topics (int): The number of topics for LDA to find within the
              data.
          alpha0 (float): Optional. Initial guess for the concentration
              parameter
          max_restarts (int): Optional. The number of restarts to perform
              during the Alternating Least Squares (ALS) spectral
              decomposition phase of the algorithm.
          max_iterations (int): Optional. The maximum number of iterations to
              perform during the ALS phase of the algorithm.
          tol (float): Optional. Target error tolerance for the ALS phase of
              the algorithm.
          **kwargs: base class keyword argument values.
  
      .. tip::
  
          You can find additional parameters for initializing this class at
          :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and
          :class:`~sagemaker.estimator.EstimatorBase`.
      """
      # this algorithm only supports single instance training
      instance_count = kwargs.pop("instance_count", 1)
      if is_pipeline_variable(instance_count) or instance_count != 1:
          logger.warning(
              "LDA only supports single instance training. Defaulting to 1 %s.",
              instance_type,
          )
  
      super(LDA, self).__init__(role, 1, instance_type, **kwargs)
      self.num_topics = num_topics
      self.alpha0 = alpha0
      self.max_restarts = max_restarts
      self.max_iterations = max_iterations
      self.tol = tol
  
imports: from __future__ import absolute_import
  import logging
  from typing import Union, Optional
  from sagemaker import image_uris
  from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase
  from sagemaker.amazon.common import RecordSerializer, RecordDeserializer
  from sagemaker.amazon.hyperparameter import Hyperparameter
  from sagemaker.amazon.validation import gt
  from sagemaker.predictor import Predictor
  from sagemaker.model import Model
  from sagemaker.session import Session
  from sagemaker.utils import pop_out_unused_kwarg
  from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.workflow import is_pipeline_variable
label_desc: Use image node_id 1 to create a new LDA object from inherited base classes: AmazonAlgorithmEstimatorBase with example: obj = LDA(role, instance_type, num_topics, alpha0, max_restarts, max_iterations, tol)