1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package machinelearning
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Creates a new Evaluation of an MLModel. An MLModel is evaluated on a set of
14// observations associated to a DataSource. Like a DataSource for an MLModel, the
15// DataSource for an Evaluation contains values for the Target Variable. The
16// Evaluation compares the predicted result for each observation to the actual
17// outcome and provides a summary so that you know how effective the MLModel
18// functions on the test data. Evaluation generates a relevant performance metric,
19// such as BinaryAUC, RegressionRMSE or MulticlassAvgFScore based on the
20// corresponding MLModelType: BINARY, REGRESSION or MULTICLASS. CreateEvaluation is
21// an asynchronous operation. In response to CreateEvaluation, Amazon Machine
22// Learning (Amazon ML) immediately returns and sets the evaluation status to
23// PENDING. After the Evaluation is created and ready for use, Amazon ML sets the
24// status to COMPLETED. You can use the GetEvaluation operation to check progress
25// of the evaluation during the creation operation.
26func (c *Client) CreateEvaluation(ctx context.Context, params *CreateEvaluationInput, optFns ...func(*Options)) (*CreateEvaluationOutput, error) {
27	if params == nil {
28		params = &CreateEvaluationInput{}
29	}
30
31	result, metadata, err := c.invokeOperation(ctx, "CreateEvaluation", params, optFns, addOperationCreateEvaluationMiddlewares)
32	if err != nil {
33		return nil, err
34	}
35
36	out := result.(*CreateEvaluationOutput)
37	out.ResultMetadata = metadata
38	return out, nil
39}
40
41type CreateEvaluationInput struct {
42
43	// The ID of the DataSource for the evaluation. The schema of the DataSource must
44	// match the schema used to create the MLModel.
45	//
46	// This member is required.
47	EvaluationDataSourceId *string
48
49	// A user-supplied ID that uniquely identifies the Evaluation.
50	//
51	// This member is required.
52	EvaluationId *string
53
54	// The ID of the MLModel to evaluate. The schema used in creating the MLModel must
55	// match the schema of the DataSource used in the Evaluation.
56	//
57	// This member is required.
58	MLModelId *string
59
60	// A user-supplied name or description of the Evaluation.
61	EvaluationName *string
62}
63
64// Represents the output of a CreateEvaluation operation, and is an acknowledgement
65// that Amazon ML received the request. CreateEvaluation operation is asynchronous.
66// You can poll for status updates by using the GetEvcaluation operation and
67// checking the Status parameter.
68type CreateEvaluationOutput struct {
69
70	// The user-supplied ID that uniquely identifies the Evaluation. This value should
71	// be identical to the value of the EvaluationId in the request.
72	EvaluationId *string
73
74	// Metadata pertaining to the operation's result.
75	ResultMetadata middleware.Metadata
76}
77
78func addOperationCreateEvaluationMiddlewares(stack *middleware.Stack, options Options) (err error) {
79	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateEvaluation{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateEvaluation{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	if err = addSetLoggerMiddleware(stack, options); err != nil {
88		return err
89	}
90	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
91		return err
92	}
93	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
94		return err
95	}
96	if err = addResolveEndpointMiddleware(stack, options); err != nil {
97		return err
98	}
99	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
100		return err
101	}
102	if err = addRetryMiddlewares(stack, options); err != nil {
103		return err
104	}
105	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
112		return err
113	}
114	if err = addClientUserAgent(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = addOpCreateEvaluationValidationMiddleware(stack); err != nil {
124		return err
125	}
126	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEvaluation(options.Region), middleware.Before); err != nil {
127		return err
128	}
129	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addResponseErrorMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addRequestResponseLogging(stack, options); err != nil {
136		return err
137	}
138	return nil
139}
140
141func newServiceMetadataMiddleware_opCreateEvaluation(region string) *awsmiddleware.RegisterServiceMetadata {
142	return &awsmiddleware.RegisterServiceMetadata{
143		Region:        region,
144		ServiceID:     ServiceID,
145		SigningName:   "machinelearning",
146		OperationName: "CreateEvaluation",
147	}
148}
149