The AWS SDK for JavaScript v2 has reached end-of-support.
We recommend that you migrate to AWS SDK for JavaScript v3. For additional details and information on how to migrate, please refer to the announcement.

Class: AWS.ForecastService

Inherits:
AWS.Service show all
Identifier:
forecastservice
API Version:
2018-06-26
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

Provides APIs for creating and managing Amazon Forecast resources.

Sending a Request Using ForecastService

var forecastservice = new AWS.ForecastService();
forecastservice.createAutoPredictor(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the ForecastService object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var forecastservice = new AWS.ForecastService({apiVersion: '2018-06-26'});

You can also set the API version globally in AWS.config.apiVersions using the forecastservice service identifier:

AWS.config.apiVersions = {
  forecastservice: '2018-06-26',
  // other service API versions
};

var forecastservice = new AWS.ForecastService();

Version:

  • 2018-06-26

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.ForecastService(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a ForecastService object

var forecastservice = new AWS.ForecastService({apiVersion: '2018-06-26'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.ForecastService.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.ForecastService.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.ForecastService.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

  • useFipsEndpoint (Boolean)

    Enables FIPS compatible endpoints. Defaults to false.

  • useDualstackEndpoint (Boolean)

    Enables IPv6 dualstack endpoint. Defaults to false.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

createAutoPredictor(params = {}, callback) ⇒ AWS.Request

Creates an Amazon Forecast predictor.

Amazon Forecast creates predictors with AutoPredictor, which involves applying the optimal combination of algorithms to each time series in your datasets. You can use CreateAutoPredictor to create new predictors or upgrade/retrain existing predictors.

Creating new predictors

The following parameters are required when creating a new predictor:

  • PredictorName - A unique name for the predictor.

  • DatasetGroupArn - The ARN of the dataset group used to train the predictor.

  • ForecastFrequency - The granularity of your forecasts (hourly, daily, weekly, etc).

  • ForecastHorizon - The number of time-steps that the model predicts. The forecast horizon is also called the prediction length.

When creating a new predictor, do not specify a value for ReferencePredictorArn.

Upgrading and retraining predictors

The following parameters are required when retraining or upgrading a predictor:

  • PredictorName - A unique name for the predictor.

  • ReferencePredictorArn - The ARN of the predictor to retrain or upgrade.

When upgrading or retraining a predictor, only specify values for the ReferencePredictorArn and PredictorName.

Service Reference:

Examples:

Calling the createAutoPredictor operation

var params = {
  PredictorName: 'STRING_VALUE', /* required */
  DataConfig: {
    DatasetGroupArn: 'STRING_VALUE', /* required */
    AdditionalDatasets: [
      {
        Name: 'STRING_VALUE', /* required */
        Configuration: {
          '<Name>': [
            'STRING_VALUE',
            /* more items */
          ],
          /* '<Name>': ... */
        }
      },
      /* more items */
    ],
    AttributeConfigs: [
      {
        AttributeName: 'STRING_VALUE', /* required */
        Transformations: { /* required */
          '<Name>': 'STRING_VALUE',
          /* '<Name>': ... */
        }
      },
      /* more items */
    ]
  },
  EncryptionConfig: {
    KMSKeyArn: 'STRING_VALUE', /* required */
    RoleArn: 'STRING_VALUE' /* required */
  },
  ExplainPredictor: true || false,
  ForecastDimensions: [
    'STRING_VALUE',
    /* more items */
  ],
  ForecastFrequency: 'STRING_VALUE',
  ForecastHorizon: 'NUMBER_VALUE',
  ForecastTypes: [
    'STRING_VALUE',
    /* more items */
  ],
  MonitorConfig: {
    MonitorName: 'STRING_VALUE' /* required */
  },
  OptimizationMetric: WAPE | RMSE | AverageWeightedQuantileLoss | MASE | MAPE,
  ReferencePredictorArn: 'STRING_VALUE',
  Tags: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE' /* required */
    },
    /* more items */
  ],
  TimeAlignmentBoundary: {
    DayOfMonth: 'NUMBER_VALUE',
    DayOfWeek: MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY,
    Hour: 'NUMBER_VALUE',
    Month: JANUARY | FEBRUARY | MARCH | APRIL | MAY | JUNE | JULY | AUGUST | SEPTEMBER | OCTOBER | NOVEMBER | DECEMBER
  }
};
forecastservice.createAutoPredictor(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PredictorName — (String)

      A unique name for the predictor

    • ForecastHorizon — (Integer)

      The number of time-steps that the model predicts. The forecast horizon is also called the prediction length.

      The maximum forecast horizon is the lesser of 500 time-steps or 1/4 of the TARGET_TIME_SERIES dataset length. If you are retraining an existing AutoPredictor, then the maximum forecast horizon is the lesser of 500 time-steps or 1/3 of the TARGET_TIME_SERIES dataset length.

      If you are upgrading to an AutoPredictor or retraining an existing AutoPredictor, you cannot update the forecast horizon parameter. You can meet this requirement by providing longer time-series in the dataset.

    • ForecastTypes — (Array<String>)

      The forecast types used to train a predictor. You can specify up to five forecast types. Forecast types can be quantiles from 0.01 to 0.99, by increments of 0.01 or higher. You can also specify the mean forecast with mean.

    • ForecastDimensions — (Array<String>)

      An array of dimension (field) names that specify how to group the generated forecast.

      For example, if you are generating forecasts for item sales across all your stores, and your dataset contains a store_id field, you would specify store_id as a dimension to group sales forecasts for each store.

    • ForecastFrequency — (String)

      The frequency of predictions in a forecast.

      Valid intervals are an integer followed by Y (Year), M (Month), W (Week), D (Day), H (Hour), and min (Minute). For example, "1D" indicates every day and "15min" indicates every 15 minutes. You cannot specify a value that would overlap with the next larger frequency. That means, for example, you cannot specify a frequency of 60 minutes, because that is equivalent to 1 hour. The valid values for each frequency are the following:

      • Minute - 1-59

      • Hour - 1-23

      • Day - 1-6

      • Week - 1-4

      • Month - 1-11

      • Year - 1

      Thus, if you want every other week forecasts, specify "2W". Or, if you want quarterly forecasts, you specify "3M".

      The frequency must be greater than or equal to the TARGET_TIME_SERIES dataset frequency.

      When a RELATED_TIME_SERIES dataset is provided, the frequency must be equal to the RELATED_TIME_SERIES dataset frequency.

    • DataConfig — (map)

      The data configuration for your dataset group and any additional datasets.

      • DatasetGroupArnrequired — (String)

        The ARN of the dataset group used to train the predictor.

      • AttributeConfigs — (Array<map>)

        Aggregation and filling options for attributes in your dataset group.

        • AttributeNamerequired — (String)

          The name of the attribute as specified in the schema. Amazon Forecast supports the target field of the target time series and the related time series datasets. For example, for the RETAIL domain, the target is demand.

        • Transformationsrequired — (map<String>)

          The method parameters (key-value pairs), which are a map of override parameters. Specify these parameters to override the default values. Related Time Series attributes do not accept aggregation parameters.

          The following list shows the parameters and their valid values for the "filling" featurization method for a Target Time Series dataset. Default values are bolded.

          • aggregation: sum, avg, first, min, max

          • frontfill: none

          • middlefill: zero, nan (not a number), value, median, mean, min, max

          • backfill: zero, nan, value, median, mean, min, max

          The following list shows the parameters and their valid values for a Related Time Series featurization method (there are no defaults):

          • middlefill: zero, value, median, mean, min, max

          • backfill: zero, value, median, mean, min, max

          • futurefill: zero, value, median, mean, min, max

          To set a filling method to a specific value, set the fill parameter to value and define the value in a corresponding _value parameter. For example, to set backfilling to a value of 2, include the following: "backfill": "value" and "backfill_value":"2".

      • AdditionalDatasets — (Array<map>)

        Additional built-in datasets like Holidays and the Weather Index.

        • Namerequired — (String)

          The name of the additional dataset. Valid names: "holiday" and "weather".

        • Configuration — (map<Array<String>>)

          Weather Index

          To enable the Weather Index, do not specify a value for Configuration.

          Holidays

          Holidays

          To enable Holidays, set CountryCode to one of the following two-letter country codes:

          • "AL" - ALBANIA

          • "AR" - ARGENTINA

          • "AT" - AUSTRIA

          • "AU" - AUSTRALIA

          • "BA" - BOSNIA HERZEGOVINA

          • "BE" - BELGIUM

          • "BG" - BULGARIA

          • "BO" - BOLIVIA

          • "BR" - BRAZIL

          • "BY" - BELARUS

          • "CA" - CANADA

          • "CL" - CHILE

          • "CO" - COLOMBIA

          • "CR" - COSTA RICA

          • "HR" - CROATIA

          • "CZ" - CZECH REPUBLIC

          • "DK" - DENMARK

          • "EC" - ECUADOR

          • "EE" - ESTONIA

          • "ET" - ETHIOPIA

          • "FI" - FINLAND

          • "FR" - FRANCE

          • "DE" - GERMANY

          • "GR" - GREECE

          • "HU" - HUNGARY

          • "IS" - ICELAND

          • "IN" - INDIA

          • "IE" - IRELAND

          • "IT" - ITALY

          • "JP" - JAPAN

          • "KZ" - KAZAKHSTAN

          • "KR" - KOREA

          • "LV" - LATVIA

          • "LI" - LIECHTENSTEIN

          • "LT" - LITHUANIA

          • "LU" - LUXEMBOURG

          • "MK" - MACEDONIA

          • "MT" - MALTA

          • "MX" - MEXICO

          • "MD" - MOLDOVA

          • "ME" - MONTENEGRO

          • "NL" - NETHERLANDS

          • "NZ" - NEW ZEALAND

          • "NI" - NICARAGUA

          • "NG" - NIGERIA

          • "NO" - NORWAY

          • "PA" - PANAMA

          • "PY" - PARAGUAY

          • "PE" - PERU

          • "PL" - POLAND

          • "PT" - PORTUGAL

          • "RO" - ROMANIA

          • "RU" - RUSSIA

          • "RS" - SERBIA

          • "SK" - SLOVAKIA

          • "SI" - SLOVENIA

          • "ZA" - SOUTH AFRICA

          • "ES" - SPAIN

          • "SE" - SWEDEN

          • "CH" - SWITZERLAND

          • "UA" - UKRAINE

          • "AE" - UNITED ARAB EMIRATES

          • "US" - UNITED STATES

          • "UK" - UNITED KINGDOM

          • "UY" - URUGUAY

          • "VE" - VENEZUELA

    • EncryptionConfig — (map)

      An Key Management Service (KMS) key and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the key. You can specify this optional object in the CreateDataset and CreatePredictor requests.

      • RoleArnrequired — (String)

        The ARN of the IAM role that Amazon Forecast can assume to access the KMS key.

        Passing a role across Amazon Web Services accounts is not allowed. If you pass a role that isn't in your account, you get an InvalidInputException error.

      • KMSKeyArnrequired — (String)

        The Amazon Resource Name (ARN) of the KMS key.

    • ReferencePredictorArn — (String)

      The ARN of the predictor to retrain or upgrade. This parameter is only used when retraining or upgrading a predictor. When creating a new predictor, do not specify a value for this parameter.

      When upgrading or retraining a predictor, only specify values for the ReferencePredictorArn and PredictorName. The value for PredictorName must be a unique predictor name.

    • OptimizationMetric — (String)

      The accuracy metric used to optimize the predictor.

      Possible values include:
      • "WAPE"
      • "RMSE"
      • "AverageWeightedQuantileLoss"
      • "MASE"
      • "MAPE"
    • ExplainPredictor — (Boolean)

      Create an Explainability resource for the predictor.

    • Tags — (Array<map>)

      Optional metadata to help you categorize and organize your predictors. Each tag consists of a key and an optional value, both of which you define. Tag keys and values are case sensitive.

      The following restrictions apply to tags:

      • For each resource, each tag key must be unique and each tag key must have one value.

      • Maximum number of tags per resource: 50.

      • Maximum key length: 128 Unicode characters in UTF-8.

      • Maximum value length: 256 Unicode characters in UTF-8.

      • Accepted characters: all letters and numbers, spaces representable in UTF-8, and + - = . _ : / @. If your tagging schema is used across other services and resources, the character restrictions of those services also apply.

      • Key prefixes cannot include any upper or lowercase combination of aws: or AWS:. Values can have this prefix. If a tag value has aws as its prefix but the key does not, Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of aws do not count against your tags per resource limit. You cannot edit or delete tag keys with this prefix.

      • Keyrequired — (String)

        One part of a key-value pair that makes up a tag. A key is a general label that acts like a category for more specific tag values.

      • Valuerequired — (String)

        The optional part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key).

    • MonitorConfig — (map)

      The configuration details for predictor monitoring. Provide a name for the monitor resource to enable predictor monitoring.

      Predictor monitoring allows you to see how your predictor's performance changes over time. For more information, see Predictor Monitoring.

      • MonitorNamerequired — (String)

        The name of the monitor resource.

    • TimeAlignmentBoundary — (map)

      The time boundary Forecast uses to align and aggregate any data that doesn't align with your forecast frequency. Provide the unit of time and the time boundary as a key value pair. For more information on specifying a time boundary, see Specifying a Time Boundary. If you don't provide a time boundary, Forecast uses a set of Default Time Boundaries.

      • Month — (String)

        The month to use for time alignment during aggregation. The month must be in uppercase.

        Possible values include:
        • "JANUARY"
        • "FEBRUARY"
        • "MARCH"
        • "APRIL"
        • "MAY"
        • "JUNE"
        • "JULY"
        • "AUGUST"
        • "SEPTEMBER"
        • "OCTOBER"
        • "NOVEMBER"
        • "DECEMBER"
      • DayOfMonth — (Integer)

        The day of the month to use for time alignment during aggregation.

      • DayOfWeek — (String)

        The day of week to use for time alignment during aggregation. The day must be in uppercase.

        Possible values include:
        • "MONDAY"
        • "TUESDAY"
        • "WEDNESDAY"
        • "THURSDAY"
        • "FRIDAY"
        • "SATURDAY"
        • "SUNDAY"
      • Hour — (Integer)

        The hour of day to use for time alignment during aggregation.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • PredictorArn — (String)

        The Amazon Resource Name (ARN) of the predictor.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createDataset(params = {}, callback) ⇒ AWS.Request

Creates an Amazon Forecast dataset. The information about the dataset that you provide helps Forecast understand how to consume the data for model training. This includes the following:

  • DataFrequency - How frequently your historical time-series data is collected.

  • Domain and DatasetType - Each dataset has an associated dataset domain and a type within the domain. Amazon Forecast provides a list of predefined domains and types within each domain. For each unique dataset domain and type within the domain, Amazon Forecast requires your data to include a minimum set of predefined fields.

  • Schema - A schema specifies the fields in the dataset, including the field name and data type.

After creating a dataset, you import your training data into it and add the dataset to a dataset group. You use the dataset group to create a predictor. For more information, see Importing datasets.

To get a list of all your datasets, use the ListDatasets operation.

For example Forecast datasets, see the Amazon Forecast Sample GitHub repository.

Note: The Status of a dataset must be ACTIVE before you can import training data. Use the DescribeDataset operation to get the status.

Service Reference:

Examples: