NTM

The Amazon SageMaker NTM algorithm.

class sagemaker.NTM(role=None, instance_count=None, instance_type=None, num_topics=None, encoder_layers=None, epochs=None, encoder_layers_activation=None, optimizer=None, tolerance=None, num_patience_epochs=None, batch_norm=None, rescale_gradient=None, clip_gradient=None, weight_decay=None, learning_rate=None, **kwargs)

Bases: AmazonAlgorithmEstimatorBase

An unsupervised learning algorithm used to organize a corpus of documents into topics.

The resulting topics contain word groupings based on their statistical distribution. Documents that contain frequent occurrences of words such as “bike”, “car”, “train”, “mileage”, and “speed” are likely to share a topic on “transportation” for example.

Neural Topic Model (NTM) is Estimator used for unsupervised learning.

This Estimator may be fit via calls to fit(). It requires Amazon Record protobuf serialized data to be stored in S3. There is an utility record_set() that can be used to upload data to S3 and creates 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 deploy(). As well as deploying an Endpoint, deploy returns a NTMPredictor object that can be used for inference calls using the trained model hosted in the SageMaker Endpoint.

NTM Estimators can be configured by setting hyperparameters. The available hyperparameters for NTM are documented below.

For further information on the AWS NTM algorithm, please consult AWS technical documentation: https://docs.aws.amazon.com/sagemaker/latest/dg/ntm.html

Parameters
  • 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_count (Optional[Union[int, PipelineVariable]]) – (int or PipelineVariable): Number of Amazon EC2 instances to use for training.

  • instance_type (str or PipelineVariable) – Type of EC2 instance to use for training, for example, ‘ml.c4.xlarge’.

  • num_topics (int) – Required. The number of topics for NTM to find within the data.

  • encoder_layers (list) – Optional. Represents number of layers in the encoder and the output size of each layer.

  • epochs (int) – Optional. Maximum number of passes over the training data.

  • encoder_layers_activation (str) – Optional. Activation function to use in the encoder layers.

  • optimizer (str) – Optional. Optimizer to use for training.

  • tolerance (float) – Optional. Maximum relative change in the loss function within the last num_patience_epochs number of epochs below which early stopping is triggered.

  • num_patience_epochs (int) – Optional. Number of successive epochs over which early stopping criterion is evaluated.

  • batch_norm (bool) – Optional. Whether to use batch normalization during training.

  • rescale_gradient (float) – Optional. Rescale factor for gradient.

  • clip_gradient (float) – Optional. Maximum magnitude for each gradient component.

  • weight_decay (float) – Optional. Weight decay coefficient. Adds L2 regularization.

  • learning_rate (float) – Optional. Learning rate for the optimizer.

  • **kwargs – base class keyword argument values.

Tip

You can find additional parameters for initializing this class at AmazonAlgorithmEstimatorBase and EstimatorBase.

repo_name: str = 'ntm'
repo_version: str = '1'
CONTAINER_CODE_CHANNEL_SOURCEDIR_PATH = '/opt/ml/input/data/code/sourcedir.tar.gz'
DEFAULT_MINI_BATCH_SIZE: Optional[int] = None
INSTANCE_TYPE = 'sagemaker_instance_type'
JOB_CLASS_NAME = 'training-job'
LAUNCH_MPI_ENV_NAME = 'sagemaker_mpi_enabled'
LAUNCH_MWMS_ENV_NAME = 'sagemaker_multi_worker_mirrored_strategy_enabled'
LAUNCH_PS_ENV_NAME = 'sagemaker_parameter_server_enabled'
LAUNCH_PT_XLA_ENV_NAME = 'sagemaker_pytorch_xla_multi_worker_enabled'
LAUNCH_SM_DDP_ENV_NAME = 'sagemaker_distributed_dataparallel_enabled'
MPI_CUSTOM_MPI_OPTIONS = 'sagemaker_mpi_custom_mpi_options'
MPI_NUM_PROCESSES_PER_HOST = 'sagemaker_mpi_num_of_processes_per_host'
SM_DDP_CUSTOM_MPI_OPTIONS = 'sagemaker_distributed_dataparallel_custom_mpi_options'
classmethod attach(training_job_name, sagemaker_session=None, model_channel_name='model')

Attach to an existing training job.

Create an Estimator bound to an existing training job, each subclass is responsible to implement _prepare_init_params_from_job_description() as this method delegates the actual conversion of a training job description to the arguments that the class constructor expects. After attaching, if the training job has a Complete status, it can be deploy() ed to create a SageMaker Endpoint and return a Predictor.

If the training job is in progress, attach will block until the training job completes, but logs of the training job will not display. To see the logs content, please call logs()

Examples

>>> my_estimator.fit(wait=False)
>>> training_job_name = my_estimator.latest_training_job.name
Later on:
>>> attached_estimator = Estimator.attach(training_job_name)
>>> attached_estimator.logs()
>>> attached_estimator.deploy()
Parameters
  • training_job_name (str) – The name of the training job to attach to.

  • sagemaker_session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, the estimator creates one using the default AWS configuration chain.

  • model_channel_name (str) – Name of the channel where pre-trained model data will be downloaded (default: ‘model’). If no channel with the same name exists in the training job, this option will be ignored.

Returns

Instance of the calling Estimator Class with the attached training job.

compile_model(target_instance_family, input_shape, output_path, framework=None, framework_version=None, compile_max_run=900, tags=None, target_platform_os=None, target_platform_arch=None, target_platform_accelerator=None, compiler_options=None, **kwargs)

Compile a Neo model using the input model.

Parameters
Returns

A SageMaker Model object. See Model() for full details.

Return type

sagemaker.model.Model

property data_location

Placeholder docstring

delete_endpoint(**kwargs)
deploy(initial_instance_count=None, instance_type=None, serializer=None, deserializer=None, accelerator_type=None, endpoint_name=None, use_compiled_model=False, wait=True, model_name=None, kms_key=None, data_capture_config=None, tags=None, serverless_inference_config=None, async_inference_config=None, volume_size=None, model_data_download_timeout=None, container_startup_health_check_timeout=None, inference_recommendation_id=None, explainer_config=None, **kwargs)

Deploy the trained model to an Amazon SageMaker endpoint.

And then return sagemaker.Predictor object.

More information: http://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-training.html

Parameters
  • initial_instance_count (int) – The initial number of instances to run in the Endpoint created from this Model. If not using serverless inference, then it need to be a number larger or equals to 1 (default: None)

  • instance_type (str) – The EC2 instance type to deploy this Model to. For example, ‘ml.p2.xlarge’, or ‘local’ for local mode. If not using serverless inference, then it is required to deploy a model. (default: None)

  • serializer (BaseSerializer) – A serializer object, used to encode data for an inference endpoint (default: None). If serializer is not None, then serializer will override the default serializer. The default serializer is set by the predictor_cls.

  • deserializer (BaseDeserializer) – A deserializer object, used to decode data from an inference endpoint (default: None). If deserializer is not None, then deserializer will override the default deserializer. The default deserializer is set by the predictor_cls.

  • accelerator_type (str) – Type of Elastic Inference accelerator to attach to an endpoint for model loading and inference, for example, ‘ml.eia1.medium’. If not specified, no Elastic Inference accelerator will be attached to the endpoint. For more information: https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html

  • endpoint_name (str) – Name to use for creating an Amazon SageMaker endpoint. If not specified, the name of the training job is used.

  • use_compiled_model (bool) – Flag to select whether to use compiled (optimized) model. Default: False.

  • wait (bool) – Whether the call should wait until the deployment of model completes (default: True).

  • model_name (str) – Name to use for creating an Amazon SageMaker model. If not specified, the estimator generates a default job name based on the training image name and current timestamp.

  • kms_key (str) – The ARN of the KMS key that is used to encrypt the data on the storage volume attached to the instance hosting the endpoint.

  • data_capture_config (sagemaker.model_monitor.DataCaptureConfig) – Specifies configuration related to Endpoint data capture for use with Amazon SageMaker Model Monitoring. Default: None.

  • async_inference_config (sagemaker.model_monitor.AsyncInferenceConfig) – Specifies configuration related to async inference. Use this configuration when trying to create async endpoint and make async inference. If empty config object passed through, will use default config to deploy async endpoint. Deploy a real-time endpoint if it’s None. (default: None)

  • serverless_inference_config (sagemaker.serverless.ServerlessInferenceConfig) – Specifies configuration related to serverless endpoint. Use this configuration when trying to create serverless endpoint and make serverless inference. If empty object passed through, will use pre-defined values in ServerlessInferenceConfig class to deploy serverless endpoint. Deploy an instance based endpoint if it’s None. (default: None)

  • tags (Optional[Tags]) – Optional. Tags to attach to this specific endpoint. Example: >>> tags = {‘tagname’, ‘tagvalue’} Or >>> tags = [{‘Key’: ‘tagname’, ‘Value’: ‘tagvalue’}] For more information about tags, see https://boto3.amazonaws.com/v1/documentation /api/latest/reference/services/sagemaker.html#SageMaker.Client.add_tags

  • volume_size (int) – The size, in GB, of the ML storage volume attached to individual inference instance associated with the production variant. Currenly only Amazon EBS gp2 storage volumes are supported.

  • model_data_download_timeout (int) – The timeout value, in seconds, to download and extract model data from Amazon S3 to the individual inference instance associated with this production variant.

  • container_startup_health_check_timeout (int) – The timeout value, in seconds, for your inference container to pass health check by SageMaker Hosting. For more information about health check see: https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-algo-ping-requests

  • inference_recommendation_id (str) – The recommendation id which specifies the recommendation you picked from inference recommendation job results and would like to deploy the model and endpoint with recommended parameters.

  • explainer_config (sagemaker.explainer.ExplainerConfig) – Specifies online explainability configuration for use with Amazon SageMaker Clarify. (default: None)

  • **kwargs – Passed to invocation of create_model(). Implementations may customize create_model() to accept **kwargs to customize model creation during deploy. For more, see the implementation docs.

Returns

A predictor that provides a predict() method,

which can be used to send requests to the Amazon SageMaker endpoint and obtain inferences.

Return type

sagemaker.predictor.Predictor

disable_profiling()

Update the current training job in progress to disable profiling.

Debugger stops collecting the system and framework metrics and turns off the Debugger built-in monitoring and profiling rules.

disable_remote_debug()

Disable remote debug for a training job.

enable_default_profiling()

Update training job to enable Debugger monitoring.

This method enables Debugger monitoring with the default profiler_config parameter to collect system metrics and the default built-in profiler_report rule. Framework metrics won’t be saved. To update training job to emit framework metrics, you can use update_profiler method and specify the framework metrics you want to enable.

This method is callable when the training job is in progress while Debugger monitoring is disabled.

enable_network_isolation()

Return True if this Estimator will need network isolation to run.

Returns

Whether this Estimator needs network isolation or not.

Return type

bool

enable_remote_debug()

Enable remote debug for a training job.

fit(records, mini_batch_size=None, wait=True, logs=True, job_name=None, experiment_config=None)

Fit this Estimator on serialized Record objects, stored in S3.

records should be an instance of RecordSet. This defines a collection of S3 data files to train this Estimator on.

Training data is expected to be encoded as dense or sparse vectors in the “values” feature on each Record. If the data is labeled, the label is expected to be encoded as a list of scalas in the “values” feature of the Record label.

More information on the Amazon Record format is available at: https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-training.html

See record_set() to construct a RecordSet object from ndarray arrays.

Parameters
  • records (RecordSet) – The records to train this Estimator on

  • mini_batch_size (int or None) – The size of each mini-batch to use when training. If None, a default value will be used.

  • wait (bool) – Whether the call should wait until the job completes (default: True).

  • logs (bool) – Whether to show the logs produced by the job. Only meaningful when wait is True (default: True).

  • job_name (str) – Training job name. If not specified, the estimator generates a default job name, based on the training image name and current timestamp.

  • experiment_config (dict[str, str]) – Experiment management configuration. Optionally, the dict can contain four keys: ‘ExperimentName’, ‘TrialName’, ‘TrialComponentDisplayName’ and ‘RunName’. The behavior of setting these keys is as follows: * If ExperimentName is supplied but TrialName is not a Trial will be automatically created and the job’s Trial Component associated with the Trial. * If TrialName is supplied and the Trial already exists the job’s Trial Component will be associated with the Trial. * If both ExperimentName and TrialName are not supplied the trial component will be unassociated. * TrialComponentDisplayName is used for display in Studio.

get_app_url(app_type, open_in_default_web_browser=True, create_presigned_domain_url=False, domain_id=None, user_profile_name=None, optional_create_presigned_url_kwargs=None)

Generate a URL to help access the specified app hosted in Amazon SageMaker Studio.

Parameters
  • app_type (str or SupportedInteractiveAppTypes) – Required. The app type available in SageMaker Studio to return a URL to.

  • open_in_default_web_browser (bool) – Optional. When True, the URL will attempt to be opened in the environment’s default web browser. Otherwise, the resulting URL will be returned by this function. Default: True

  • create_presigned_domain_url (bool) – Optional. Determines whether a presigned domain URL should be generated instead of an unsigned URL. This only applies when called from outside of a SageMaker Studio environment. If this is set to True inside of a SageMaker Studio environment, it will be ignored. Default: False

  • domain_id (str) – Optional. The AWS Studio domain that the resulting app will use. If code is executing in a Studio environment and this was not supplied, this will be automatically detected. If not supplied and running in a non-Studio environment, it is up to the derived class on how to handle that, but in general, a redirect to a landing page can be expected. Default: None

  • user_profile_name (str) – Optional. The AWS Studio user profile that the resulting app will use. If code is executing in a Studio environment and this was not supplied, this will be automatically detected. If not supplied and running in a non-Studio environment, it is up to the derived class on how to handle that, but in general, a redirect to a landing page can be expected. Default: None

  • optional_create_presigned_url_kwargs (dict) – Optional. This parameter should be passed when a user outside of Studio wants a presigned URL to the TensorBoard application and wants to modify the optional parameters of the create_presigned_domain_url call. Default: None

Returns

A URL for the requested app in SageMaker Studio.

Return type

str

get_remote_debug_config()

dict: Return the configuration of RemoteDebug

get_session_chaining_config()

dict: Return the configuration of SessionChaining

get_vpc_config(vpc_config_override='VPC_CONFIG_DEFAULT')

Returns VpcConfig dict either from this Estimator’s subnets and security groups.

Or else validate and return an optional override value.

Parameters

vpc_config_override

hyperparameters()

Placeholder docstring

latest_job_debugger_artifacts_path()

Gets the path to the DebuggerHookConfig output artifacts.

Returns

An S3 path to the output artifacts.

Return type

str

latest_job_profiler_artifacts_path()

Gets the path to the profiling output artifacts.

Returns

An S3 path to the output artifacts.

Return type

str

latest_job_tensorboard_artifacts_path()

Gets the path to the TensorBoardOutputConfig output artifacts.

Returns

An S3 path to the output artifacts.

Return type

str

logs()

Display the logs for Estimator’s training job.

If the output is a tty or a Jupyter cell, it will be color-coded based on which instance the log entry is from.

property model_data

The model location in S3. Only set if Estimator has been fit().

Type

Str or dict

prepare_workflow_for_training(records=None, mini_batch_size=None, job_name=None)

Calls _prepare_for_training. Used when setting up a workflow.

Parameters
  • records (RecordSet) – The records to train this Estimator on.

  • mini_batch_size (int or None) – The size of each mini-batch to use when training. If None, a default value will be used.

  • job_name (str) – Name of the training job to be created. If not specified, one is generated, using the base name given to the constructor if applicable.

record_set(train, labels=None, channel='train', encrypt=False, distribution='ShardedByS3Key')

Build a RecordSet from a numpy ndarray matrix and label vector.

For the 2D ndarray train, each row is converted to a Record object. The vector is stored in the “values” entry of the features property of each Record. If labels is not None, each corresponding label is assigned to the “values” entry of the labels property of each Record.

The collection of Record objects are protobuf serialized and uploaded to new S3 locations. A manifest file is generated containing the list of objects created and also stored in S3.

The number of S3 objects created is controlled by the instance_count property on this Estimator. One S3 object is created per training instance.

Parameters
  • train (numpy.ndarray) – A 2D numpy array of training data.

  • labels (numpy.ndarray) – A 1D numpy array of labels. Its length must be equal to the number of rows in train.

  • channel (str) – The SageMaker TrainingJob channel this RecordSet should be assigned to.

  • encrypt (bool) – Specifies whether the objects uploaded to S3 are encrypted on the server side using AES-256 (default: False).

  • distribution (str) – The SageMaker TrainingJob channel s3 data distribution type (default: ShardedByS3Key).

Returns

A RecordSet referencing the encoded, uploading training and label data.

Return type

RecordSet

register(content_types=None, response_types=None, inference_instances=None, transform_instances=None, image_uri=None, model_package_name=None, model_package_group_name=None, model_metrics=None, metadata_properties=None, marketplace_cert=False, approval_status=None, description=None, compile_model_family=None, model_name=None, drift_check_baselines=None, customer_metadata_properties=None, domain=None, sample_payload_url=None, task=None, framework=None, framework_version=None, nearest_model_name=None, data_input_configuration=None, skip_model_validation=None, source_uri=None, model_life_cycle=None, model_card=None, **kwargs)

Creates a model package for creating SageMaker models or listing on Marketplace.

Parameters
  • content_types (list) – The supported MIME types for the input data.

  • response_types (list) – The supported MIME types for the output data.

  • inference_instances (list) – A list of the instance types that are used to generate inferences in real-time (default: None).

  • transform_instances (list) – A list of the instance types on which a transformation job can be run or on which an endpoint can be deployed (default: None).

  • image_uri (str) – The container image uri for Model Package, if not specified, Estimator’s training container image will be used (default: None).

  • model_package_name (str) – Model Package name, exclusive to model_package_group_name, using model_package_name makes the Model Package un-versioned (default: None).

  • model_package_group_name (str) – Model Package Group name, exclusive to model_package_name, using model_package_group_name makes the Model Package versioned (default: None).

  • model_metrics (ModelMetrics) – ModelMetrics object (default: None).

  • metadata_properties (MetadataProperties) – MetadataProperties (default: None).

  • marketplace_cert (bool) – A boolean value indicating if the Model Package is certified for AWS Marketplace (default: False).

  • approval_status (str) – Model Approval Status, values can be “Approved”, “Rejected”, or “PendingManualApproval” (default: “PendingManualApproval”).

  • description (str) – Model Package description (default: None).

  • compile_model_family (str) – Instance family for compiled model, if specified, a compiled model will be used (default: None).

  • model_name (str) – User defined model name (default: None).

  • drift_check_baselines (DriftCheckBaselines) – DriftCheckBaselines object (default: None).

  • customer_metadata_properties (dict[str, str]) – A dictionary of key-value paired metadata properties (default: None).

  • domain (str) – Domain values can be “COMPUTER_VISION”, “NATURAL_LANGUAGE_PROCESSING”, “MACHINE_LEARNING” (default: None).

  • sample_payload_url (str) – The S3 path where the sample payload is stored (default: None).

  • task (str) – Task values which are supported by Inference Recommender are “FILL_MASK”, “IMAGE_CLASSIFICATION”, “OBJECT_DETECTION”, “TEXT_GENERATION”, “IMAGE_SEGMENTATION”, “CLASSIFICATION”, “REGRESSION”, “OTHER” (default: None).

  • framework (str) – Machine learning framework of the model package container image (default: None).

  • framework_version (str) – Framework version of the Model Package Container Image (default: None).

  • nearest_model_name (str) – Name of a pre-trained machine learning benchmarked by Amazon SageMaker Inference Recommender (default: None).

  • data_input_configuration (str) – Input object for the model (default: None).

  • skip_model_validation (str) – Indicates if you want to skip model validation. Values can be “All” or “None” (default: None).

  • source_uri (str) – The URI of the source for the model package (default: None).

  • model_card (ModeCard or ModelPackageModelCard) – document contains qualitative and quantitative information about a model (default: None).

  • model_life_cycle (ModelLifeCycle) – ModelLifeCycle object (default: None).

  • **kwargs – Passed to invocation of create_model(). Implementations may customize create_model() to accept **kwargs to customize model creation during deploy. For more, see the implementation docs.

Returns

A string of SageMaker Model Package ARN.

Return type

str

training_image_uri()

Placeholder docstring

property training_job_analytics

Return a TrainingJobAnalytics object for the current training job.

transformer(instance_count, instance_type, strategy=None, assemble_with=None, output_path=None, output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None, max_payload=None, tags=None, role=None, volume_kms_key=None, vpc_config_override='VPC_CONFIG_DEFAULT', enable_network_isolation=None, model_name=None)

Return a Transformer that uses a SageMaker Model based on the training job.

It reuses the SageMaker Session and base job name used by the Estimator.

Parameters
  • instance_count (int) – Number of EC2 instances to use.

  • instance_type (str) – Type of EC2 instance to use, for example, ‘ml.c4.xlarge’.

  • strategy (str) – The strategy used to decide how to batch records in a single request (default: None). Valid values: ‘MultiRecord’ and ‘SingleRecord’.

  • assemble_with (str) – How the output is assembled (default: None). Valid values: ‘Line’ or ‘None’.

  • output_path (str) – S3 location for saving the transform result. If not specified, results are stored to a default bucket.

  • output_kms_key (str) – Optional. KMS key ID for encrypting the transform output (default: None).

  • accept (str) – The accept header passed by the client to the inference endpoint. If it is supported by the endpoint, it will be the format of the batch transform output.

  • env (dict) – Environment variables to be set for use during the transform job (default: None).

  • max_concurrent_transforms (int) – The maximum number of HTTP requests to be made to each individual transform container at one time.

  • max_payload (int) – Maximum size of the payload in a single HTTP request to the container in MB.

  • tags (Optional[Tags]) – Tags for labeling a transform job. If none specified, then the tags used for the training job are used for the transform job.

  • role (str) – The ExecutionRoleArn IAM Role ARN for the Model, which is also used during transform jobs. If not specified, the role from the Estimator will be used.

  • volume_kms_key (str) – Optional. KMS key ID for encrypting the volume attached to the ML compute instance (default: None).

  • vpc_config_override (dict[str, list[str]]) –

    Optional override for the VpcConfig set on the model. Default: use subnets and security groups from this Estimator.

    • ’Subnets’ (list[str]): List of subnet ids.

    • ’SecurityGroupIds’ (list[str]): List of security group ids.

  • enable_network_isolation (bool) – Specifies whether container will run in network isolation mode. Network isolation mode restricts the container access to outside networks (such as the internet). The container does not make any inbound or outbound network calls. If True, a channel named “code” will be created for any user entry script for inference. Also known as Internet-free mode. If not specified, this setting is taken from the estimator’s current configuration.

  • model_name (str) – Name to use for creating an Amazon SageMaker model. If not specified, the estimator generates a default job name based on the training image name and current timestamp.

update_profiler(rules=None, system_monitor_interval_millis=None, s3_output_path=None, framework_profile_params=None, disable_framework_metrics=False)

Update training jobs to enable profiling.

This method updates the profiler_config parameter and initiates Debugger built-in rules for profiling.

Parameters
  • rules (list[ProfilerRule]) – A list of ProfilerRule objects to define rules for continuous analysis with SageMaker Debugger. Currently, you can only add new profiler rules during the training job. (default: None)

  • s3_output_path (str) – The location in S3 to store the output. If profiler is enabled once, s3_output_path cannot be changed. (default: None)

  • system_monitor_interval_millis (int) – How often profiling system metrics are collected; Unit: Milliseconds (default: None)

  • framework_profile_params (FrameworkProfile) – A parameter object for framework metrics profiling. Configure it using the FrameworkProfile class. To use the default framework profile parameters, pass FrameworkProfile(). For more information about the default values, see FrameworkProfile. (default: None)

  • disable_framework_metrics (bool) – Specify whether to disable all the framework metrics. This won’t update system metrics and the Debugger built-in rules for monitoring. To stop both monitoring and profiling, use the desable_profiling method. (default: False)

Attention

Updating the profiling configuration for TensorFlow dataloader profiling is currently not available. If you started a TensorFlow training job only with monitoring and want to enable profiling while the training job is running, the dataloader profiling cannot be updated.

feature_dim: hp
mini_batch_size: hp
uploaded_code: Optional[UploadedCode]
create_model(vpc_config_override='VPC_CONFIG_DEFAULT', **kwargs)

Return a NTMModel.

It references the latest s3 model data produced by this Estimator.

Parameters
  • vpc_config_override (dict[str, list[str]]) – Optional override for VpcConfig set on the model. Default: use subnets and security groups from this Estimator. * ‘Subnets’ (list[str]): List of subnet ids. * ‘SecurityGroupIds’ (list[str]): List of security group ids.

  • **kwargs – Additional kwargs passed to the NTMModel constructor.

class sagemaker.NTMModel(model_data, role=None, sagemaker_session=None, **kwargs)

Bases: Model

Reference NTM s3 model data.

Calling deploy() creates an Endpoint and return a Predictor that transforms vectors to a lower-dimensional representation.

Initialization for NTMModel class.

Parameters
  • model_data (str or PipelineVariable) – The S3 location of a SageMaker model data .tar.gz file.

  • 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 it needs to access an AWS resource.

  • sagemaker_session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, the estimator creates one using the default AWS configuration chain.

  • **kwargs – Keyword arguments passed to the FrameworkModel initializer.

class sagemaker.NTMPredictor(endpoint_name, sagemaker_session=None, serializer=<sagemaker.amazon.common.RecordSerializer object>, deserializer=<sagemaker.amazon.common.RecordDeserializer object>, component_name=None)

Bases: Predictor

Transforms input vectors to lower-dimesional representations.

The implementation of predict() in this Predictor requires a numpy ndarray as input. The array should contain the same number of columns as the feature-dimension of the data used to fit the model this Predictor performs inference on.

predict() returns a list of Record objects (assuming the default recordio-protobuf deserializer is used), one for each row in the input ndarray. The lower dimension vector result is stored in the projection key of the Record.label field.

Initialization for NTMPredictor class.

Parameters
  • endpoint_name (str) – Name of the Amazon SageMaker endpoint to which requests are sent.

  • sagemaker_session (sagemaker.session.Session) – A SageMaker Session object, used for SageMaker interactions (default: None). If not specified, one is created using the default AWS configuration chain.

  • serializer (sagemaker.serializers.BaseSerializer) – Optional. Default serializes input data to x-recordio-protobuf format.

  • deserializer (sagemaker.deserializers.BaseDeserializer) – Optional. Default parses responses from x-recordio-protobuf format.

  • component_name (str) – Optional. Name of the Amazon SageMaker inference component corresponding to the predictor.