LinearLearner¶
The Amazon SageMaker LinearLearner algorithm.
-
class
sagemaker.
LinearLearner
(role, instance_count=None, instance_type=None, predictor_type=None, binary_classifier_model_selection_criteria=None, target_recall=None, target_precision=None, positive_example_weight_mult=None, epochs=None, use_bias=None, num_models=None, num_calibration_samples=None, init_method=None, init_scale=None, init_sigma=None, init_bias=None, optimizer=None, loss=None, wd=None, l1=None, momentum=None, learning_rate=None, beta_1=None, beta_2=None, bias_lr_mult=None, bias_wd_mult=None, use_lr_scheduler=None, lr_scheduler_step=None, lr_scheduler_factor=None, lr_scheduler_minimum_lr=None, normalize_data=None, normalize_label=None, unbias_data=None, unbias_label=None, num_point_for_scaler=None, margin=None, quantile=None, loss_insensitivity=None, huber_delta=None, early_stopping_patience=None, early_stopping_tolerance=None, num_classes=None, accuracy_top_k=None, f_beta=None, balance_multiclass_weights=None, **kwargs)¶ Bases:
sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase
A supervised learning algorithms used for solving classification or regression problems.
For input, you give the model labeled examples (x, y). x is a high-dimensional vector and y is a numeric label. For binary classification problems, the label must be either 0 or 1. For multiclass classification problems, the labels must be from 0 to num_classes - 1. For regression problems, y is a real number. The algorithm learns a linear function, or, for classification problems, a linear threshold function, and maps a vector x to an approximation of the label y.
An
Estimator
for binary classification and regression.Amazon SageMaker Linear Learner provides a solution for both classification and regression problems, allowing for exploring different training objectives simultaneously and choosing the best solution from a validation set. It allows the user to explore a large number of models and choose the best, which optimizes either continuous objectives such as mean square error, cross entropy loss, absolute error, etc., or discrete objectives suited for classification such as F1 measure, precision@recall, accuracy. The implementation provides a significant speedup over naive hyperparameter optimization techniques and an added convenience, when compared with solutions providing a solution only to continuous objectives.
This Estimator may be fit via calls to
fit_ndarray()
orfit()
. The former allows a LinearLearner model to be fit on a 2-dimensional numpy array. The latter requires AmazonRecord
protobuf serialized data to be stored in S3.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 aLinearLearnerPredictor
object that can be used to make class or regression predictions, using the trained model.LinearLearner Estimators can be configured by setting hyperparameters. The available hyperparameters for LinearLearner are documented below. For further information on the AWS LinearLearner algorithm, please consult AWS technical documentation: https://docs.aws.amazon.com/sagemaker/latest/dg/linear-learner.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 (int) – Number of Amazon EC2 instances to use for training.
instance_type (str) – Type of EC2 instance to use for training, for example, ‘ml.c4.xlarge’.
predictor_type (str) – The type of predictor to learn. Either “binary_classifier” or “multiclass_classifier” or “regressor”.
binary_classifier_model_selection_criteria (str) – One of ‘accuracy’, ‘f1’, ‘f_beta’, ‘precision_at_target_recall’, ‘recall_at_target_precision’, ‘cross_entropy_loss’, ‘loss_function’
target_recall (float) – Target recall. Only applicable if binary_classifier_model_selection_criteria is precision_at_target_recall.
target_precision (float) – Target precision. Only applicable if binary_classifier_model_selection_criteria is recall_at_target_precision.
positive_example_weight_mult (float) – The importance weight of positive examples is multiplied by this constant. Useful for skewed datasets. Only applies for classification tasks.
epochs (int) – The maximum number of passes to make over the training data.
use_bias (bool) – Whether to include a bias field
num_models (int) – Number of models to train in parallel. If not set, the number of parallel models to train will be decided by the algorithm itself. One model will be trained according to the given training parameter (regularization, optimizer, loss) and the rest by close by parameters.
num_calibration_samples (int) – Number of observations to use from validation dataset for doing model calibration (finding the best threshold).
init_method (str) – Function to use to set the initial model weights. One of “uniform” or “normal”
init_scale (float) – For “uniform” init, the range of values.
init_sigma (float) – For “normal” init, the standard-deviation.
init_bias (float) – Initial weight for bias term
optimizer (str) – One of ‘sgd’, ‘adam’, ‘rmsprop’ or ‘auto’
loss (str) – One of ‘logistic’, ‘squared_loss’, ‘absolute_loss’, ‘hinge_loss’, ‘eps_insensitive_squared_loss’, ‘eps_insensitive_absolute_loss’, ‘quantile_loss’, ‘huber_loss’ or
or 'auto'. ('softmax_loss') –
wd (float) – L2 regularization parameter i.e. the weight decay parameter. Use 0 for no L2 regularization.
l1 (float) – L1 regularization parameter. Use 0 for no L1 regularization.
momentum (float) – Momentum parameter of sgd optimizer.
learning_rate (float) – The SGD learning rate
beta_1 (float) – Exponential decay rate for first moment estimates. Only applies for adam optimizer.
beta_2 (float) – Exponential decay rate for second moment estimates. Only applies for adam optimizer.
bias_lr_mult (float) – Allows different learning rate for the bias term. The actual learning rate for the bias is learning rate times bias_lr_mult.
bias_wd_mult (float) – Allows different regularization for the bias term. The actual L2 regularization weight for the bias is wd times bias_wd_mult. By default there is no regularization on the bias term.
use_lr_scheduler (bool) – If true, we use a scheduler for the learning rate.
lr_scheduler_step (int) – The number of steps between decreases of the learning rate. Only applies to learning rate scheduler.
lr_scheduler_factor (float) – Every lr_scheduler_step the learning rate will decrease by this quantity. Only applies for learning rate scheduler.
lr_scheduler_minimum_lr (float) – The learning rate will never decrease to a value lower than this. Only applies for learning rate scheduler.
normalize_data (bool) – Normalizes the features before training to have standard deviation of 1.0.
normalize_label (bool) – Normalizes the regression label to have a standard deviation of 1.0. If set for classification, it will be ignored.
unbias_data (bool) – If true, features are modified to have mean 0.0.
unbias_label (bool) – If true, labels are modified to have mean 0.0.
num_point_for_scaler (int) – The number of data points to use for calculating the normalizing and unbiasing terms.
margin (float) – the margin for hinge_loss.
quantile (float) – Quantile for quantile loss. For quantile q, the model will attempt to produce predictions such that true_label < prediction with probability q.
loss_insensitivity (float) – Parameter for epsilon insensitive loss type. During training and metric evaluation, any error smaller than this is considered to be zero.
huber_delta (float) – Parameter for Huber loss. During training and metric evaluation, compute L2 loss for errors smaller than delta and L1 loss for errors larger than delta.
early_stopping_patience (int) – the number of epochs to wait before ending training
no improvement is made. The improvement is training loss if validation data is (if) –
provided, or else it is the validation loss or the binary classification model (not) –
criteria like accuracy, f1-score etc. To disable early stopping, (selection) –
early_stopping_patience to a value larger than epochs. (set) –
early_stopping_tolerance (float) – Relative tolerance to measure an improvement in loss. If the ratio of the improvement in loss divided by the previous best loss is smaller than this value, early stopping will
the improvement to be zero. (consider) –
num_classes (int) – The number of classes for the response variable. Required when predictor_type is multiclass_classifier and ignored otherwise. The classes are assumed to be labeled 0, …, num_classes - 1.
accuracy_top_k (int) – The value of k when computing the Top K Accuracy metric for multiclass classification. An example is scored as correct if the model assigns one of the top k scores to the true
label. –
f_beta (float) – The value of beta to use when calculating F score metrics for binary or multiclass classification. Also used if binary_classifier_model_selection_criteria is f_beta.
balance_multiclass_weights (bool) – Whether to use class weights which give each class equal importance in the loss function. Only used when predictor_type is multiclass_classifier.
**kwargs – base class keyword argument values.
Tip
You can find additional parameters for initializing this class at
AmazonAlgorithmEstimatorBase
andEstimatorBase
.-
repo_name
= 'linear-learner'¶
-
repo_version
= 1¶
-
DEFAULT_MINI_BATCH_SIZE
= 1000¶
-
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 bedeploy()
ed to create a SageMaker Endpoint and return aPredictor
.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
target_instance_family (str) – Identifies the device that you want to run your model after compilation, for example: ml_c5. For allowed strings see https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
input_shape (dict) – Specifies the name and shape of the expected inputs for your trained model in json dictionary form, for example: {‘data’:[1,3,1024,1024]}, or {‘var1’: [1,1,28,28], ‘var2’:[1,1,28,28]}
output_path (str) – Specifies where to store the compiled model
framework (str) – The framework that is used to train the original model. Allowed values: ‘mxnet’, ‘tensorflow’, ‘keras’, ‘pytorch’, ‘onnx’, ‘xgboost’
framework_version (str) – The version of the framework
compile_max_run (int) – Timeout in seconds for compilation (default: 15 * 60). After this amount of time Amazon SageMaker Neo terminates the compilation job regardless of its current status.
tags (list[dict]) – List of tags for labeling a compilation job. For more, see https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
target_platform_os (str) – Target Platform OS, for example: ‘LINUX’. For allowed strings see https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html. It can be used instead of target_instance_family.
target_platform_arch (str) – Target Platform Architecture, for example: ‘X86_64’. For allowed strings see https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html. It can be used instead of target_instance_family.
target_platform_accelerator (str, optional) – Target Platform Accelerator, for example: ‘NVIDIA’. For allowed strings see https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html. It can be used instead of target_instance_family.
compiler_options (dict, optional) – Additional parameters for compiler. Compiler Options are TargetPlatform / target_instance_family specific. See https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html for details.
**kwargs – Passed to invocation of
create_model()
. Implementations may customizecreate_model()
to accept**kwargs
to customize model creation during deploy. For more, see the implementation docs.
- Returns
A SageMaker
Model
object. SeeModel()
for full details.- Return type
-
property
data_location
¶ Placeholder docstring
-
delete_endpoint
(**kwargs)¶
-
deploy
(initial_instance_count, instance_type, 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, **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) – Minimum number of EC2 instances to deploy to an endpoint for prediction.
instance_type (str) – Type of EC2 instance to deploy to an endpoint for prediction, for example, ‘ml.c4.xlarge’.
serializer (
BaseSerializer
) – A serializer object, used to encode data for an inference endpoint (default: None). Ifserializer
is not None, thenserializer
will override the default serializer. The default serializer is set by thepredictor_cls
.deserializer (
BaseDeserializer
) – A deserializer object, used to decode data from an inference endpoint (default: None). Ifdeserializer
is not None, thendeserializer
will override the default deserializer. The default deserializer is set by thepredictor_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.
tags (List[dict[str, str]]) – Optional. The list of tags to attach to this specific endpoint. Example: >>> 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
**kwargs – Passed to invocation of
create_model()
. Implementations may customizecreate_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.
- A predictor that provides a
- Return type
-
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.
-
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-inprofiler_report
rule. Framework metrics won’t be saved. To update training job to emit framework metrics, you can useupdate_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
-
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 ofRecordSet
. This defines a collection of S3 data files to train thisEstimator
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 aRecordSet
object fromndarray
arrays.- Parameters
records (
RecordSet
) – The records to train thisEstimator
onmini_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 three keys: ‘ExperimentName’, ‘TrialName’, and ‘TrialComponentDisplayName’. 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_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
-
latest_job_profiler_artifacts_path
()¶ Gets the path to the profiling output artifacts.
- Returns
An S3 path to the output artifacts.
- Return type
-
latest_job_tensorboard_artifacts_path
()¶ Gets the path to the TensorBoardOutputConfig output artifacts.
- Returns
An S3 path to the output artifacts.
- Return type
-
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.
-
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 thisEstimator
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)¶ Build a
RecordSet
from a numpyndarray
matrix and label vector.For the 2D
ndarray
train
, each row is converted to aRecord
object. The vector is stored in the “values” entry of thefeatures
property of each Record. Iflabels
is not None, each corresponding label is assigned to the “values” entry of thelabels
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
).
- Returns
A RecordSet referencing the encoded, uploading training and label data.
- Return type
RecordSet
-
register
(content_types, response_types, inference_instances, transform_instances, 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, **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.
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.
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).
**kwargs – Passed to invocation of
create_model()
. Implementations may customizecreate_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
-
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 (list[dict]) – List of 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 theModel
, 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 ofProfilerRule
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 theFrameworkProfile
class. To use the default framework profile parameters, passFrameworkProfile()
. For more information about the default values, seeFrameworkProfile
. (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.
-
normalize_data
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
normalize_label
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
unbias_data
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
unbias_label
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
num_point_for_scaler
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
margin
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
quantile
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
loss_insensitivity
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
huber_delta
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
early_stopping_patience
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
early_stopping_tolerance
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
num_classes
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
accuracy_top_k
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
f_beta
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
balance_multiclass_weights
¶ An algorithm hyperparameter with optional validation.
Implemented as a python descriptor object.
-
create_model
(vpc_config_override='VPC_CONFIG_DEFAULT', **kwargs)¶ Return a
LinearLearnerModel
.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 LinearLearnerModel constructor.
-
class
sagemaker.
LinearLearnerModel
(model_data, role, sagemaker_session=None, **kwargs)¶ Bases:
sagemaker.model.Model
Reference LinearLearner s3 model data.
Calling
deploy()
creates an Endpoint and returns aLinearLearnerPredictor
Initialization for LinearLearnerModel.
- Parameters
model_data (str) – 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.
LinearLearnerPredictor
(endpoint_name, sagemaker_session=None, serializer=<sagemaker.amazon.common.RecordSerializer object>, deserializer=<sagemaker.amazon.common.RecordDeserializer object>)¶ Bases:
sagemaker.predictor.Predictor
Performs binary-classification or regression prediction from input vectors.
The implementation of
predict()
in this Predictor requires a numpyndarray
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 ofRecord
objects (assuming the default recordio-protobufdeserializer
is used), one for each row in the inputndarray
. The prediction is stored in the"predicted_label"
key of theRecord.label
field.Initialization for LinearLearnerPredictor.
- 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.