Provides metrics on the accuracy of the models that were trained by the CreatePredictor operation. Use metrics to see how well the model performed and to decide whether to use the predictor to generate a forecast. For more information, see Predictor Metrics.
This operation generates metrics for each backtest window that was evaluated. The number of backtest windows (NumberOfBacktestWindows) is specified using the EvaluationParameters object, which is optionally included in the CreatePredictor request. If NumberOfBacktestWindows isn't specified, the number defaults to one.
The parameters of the filling method determine which items contribute to the metrics. If you want all items to contribute, specify zero. If you want only those items that have complete data in the range being evaluated to contribute, specify nan. For more information, see FeaturizationMethod.
Before you can get accuracy metrics, the Status of the predictor must be ACTIVE, signifying that training has completed. To get the status, use the DescribePredictor operation.
Parameters:
-
predictor_arn
(Arn)
–
The Amazon Resource Name (ARN) of the predictor to get metrics for.
Raises:
Source code in docs_src/capo_forecast/_services/async_forecast.py
| async def get_accuracy_metrics(
self,
predictor_arn: "capo_forecast.types.arn.Arn",
*,
config_overrides: Optional[AsyncforecastClientConfig] = None,
) -> "capo_forecast.types.get_accuracy_metrics_response.GetAccuracyMetricsResponse":
"""<p>Provides metrics on the accuracy of the models that were trained by the <a>CreatePredictor</a> operation. Use metrics to see how well the model performed and to decide whether to use the predictor to generate a forecast. For more information, see <a href="https://docs.aws.amazon.com/forecast/latest/dg/metrics.html">Predictor Metrics</a>.</p> <p>This operation generates metrics for each backtest window that was evaluated. The number of backtest windows (<code>NumberOfBacktestWindows</code>) is specified using the <a>EvaluationParameters</a> object, which is optionally included in the <code>CreatePredictor</code> request. If <code>NumberOfBacktestWindows</code> isn't specified, the number defaults to one.</p> <p>The parameters of the <code>filling</code> method determine which items contribute to the metrics. If you want all items to contribute, specify <code>zero</code>. If you want only those items that have complete data in the range being evaluated to contribute, specify <code>nan</code>. For more information, see <a>FeaturizationMethod</a>.</p> <note> <p>Before you can get accuracy metrics, the <code>Status</code> of the predictor must be <code>ACTIVE</code>, signifying that training has completed. To get the status, use the <a>DescribePredictor</a> operation.</p> </note>
Args:
predictor_arn: <p>The Amazon Resource Name (ARN) of the predictor to get metrics for.</p>
Raises:
capo_forecast.errors.invalid_input_exception.InvalidInputException: <p>We can't process the request because it includes an invalid value or a value that exceeds the valid range.</p>
capo_forecast.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
capo_forecast.errors.resource_not_found_exception.ResourceNotFoundException: <p>We can't find a resource with that Amazon Resource Name (ARN). Check the ARN and try again.</p>
capo_forecast.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_forecast.types.get_accuracy_metrics_request.GetAccuracyMetricsRequest]",
) -> AsyncOperationResponse[
"capo_forecast.types.get_accuracy_metrics_response.GetAccuracyMetricsResponse"
]:
import capo_forecast._operations.amazon_forecast.get_accuracy_metrics
(
output,
http_response,
) = await capo_forecast._operations.amazon_forecast.get_accuracy_metrics.async_get_accuracy_metrics(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetAccuracyMetrics")
)
input_: capo_forecast.types.get_accuracy_metrics_request.GetAccuracyMetricsRequest = {
"predictor_arn": predictor_arn
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|