createRetrainingScheduler method

Future<CreateRetrainingSchedulerResponse> createRetrainingScheduler({
  1. required String lookbackWindow,
  2. required String modelName,
  3. required String retrainingFrequency,
  4. String? clientToken,
  5. ModelPromoteMode? promoteMode,
  6. DateTime? retrainingStartDate,
})

Creates a retraining scheduler on the specified model.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter lookbackWindow : The number of past days of data that will be used for retraining.

Parameter modelName : The name of the model to add the retraining scheduler to.

Parameter retrainingFrequency : This parameter uses the ISO 8601 standard to set the frequency at which you want retraining to occur in terms of Years, Months, and/or Days (note: other parameters like Time are not currently supported). The minimum value is 30 days (P30D) and the maximum value is 1 year (P1Y). For example, the following values are valid:

  • P3M15D – Every 3 months and 15 days
  • P2M – Every 2 months
  • P150D – Every 150 days

Parameter clientToken : A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one.

Parameter promoteMode : Indicates how the service will use new models. In MANAGED mode, new models will automatically be used for inference if they have better performance than the current model. In MANUAL mode, the new models will not be used until they are manually activated.

Parameter retrainingStartDate : The start date for the retraining scheduler. Lookout for Equipment truncates the time you provide to the nearest UTC day.

Implementation

Future<CreateRetrainingSchedulerResponse> createRetrainingScheduler({
  required String lookbackWindow,
  required String modelName,
  required String retrainingFrequency,
  String? clientToken,
  ModelPromoteMode? promoteMode,
  DateTime? retrainingStartDate,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target':
        'AWSLookoutEquipmentFrontendService.CreateRetrainingScheduler'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LookbackWindow': lookbackWindow,
      'ModelName': modelName,
      'RetrainingFrequency': retrainingFrequency,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (promoteMode != null) 'PromoteMode': promoteMode.value,
      if (retrainingStartDate != null)
        'RetrainingStartDate': unixTimestampToJson(retrainingStartDate),
    },
  );

  return CreateRetrainingSchedulerResponse.fromJson(jsonResponse.body);
}