createDataset method
Creates an empty dataset and adds it to the specified dataset group. Use CreateDatasetImportJob to import your training data to a dataset.
There are three types of datasets:
- Interactions
- Items
- Users
Interactions dataset is required in order to train a
model (also referred to as creating a solution).
A dataset can be in one of the following states:
- CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
- DELETE PENDING > DELETE IN_PROGRESS
Related APIs
May throw InvalidInputException. May throw ResourceNotFoundException. May throw ResourceAlreadyExistsException. May throw LimitExceededException. May throw ResourceInUseException.
Parameter datasetGroupArn :
The Amazon Resource Name (ARN) of the dataset group to add the dataset to.
Parameter datasetType :
The type of dataset.
One of the following (case insensitive) values:
- Interactions
- Items
- Users
Parameter name :
The name for the dataset.
Parameter schemaArn :
The ARN of the schema to associate with the dataset. The schema defines
the dataset fields.
Implementation
Future<CreateDatasetResponse> createDataset({
required String datasetGroupArn,
required String datasetType,
required String name,
required String schemaArn,
}) async {
ArgumentError.checkNotNull(datasetGroupArn, 'datasetGroupArn');
_s.validateStringLength(
'datasetGroupArn',
datasetGroupArn,
0,
256,
isRequired: true,
);
ArgumentError.checkNotNull(datasetType, 'datasetType');
_s.validateStringLength(
'datasetType',
datasetType,
0,
256,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
63,
isRequired: true,
);
ArgumentError.checkNotNull(schemaArn, 'schemaArn');
_s.validateStringLength(
'schemaArn',
schemaArn,
0,
256,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonPersonalize.CreateDataset'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'datasetGroupArn': datasetGroupArn,
'datasetType': datasetType,
'name': name,
'schemaArn': schemaArn,
},
);
return CreateDatasetResponse.fromJson(jsonResponse.body);
}