Creates an empty dataset and adds it to the specified dataset group. Use CreateDatasetImportJob to import your training data to a dataset.
There are 5 types of datasets:
-
Item interactions
-
Items
-
Users
-
Action interactions
-
Actions
Each dataset type has an associated schema with required field types. Only the Item 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:
To get the status of the dataset, call DescribeDataset.
Related APIs
Parameters:
-
name
(Name)
–
The name for the dataset.
-
schema_arn
(Arn)
–
The ARN of the schema to associate with the dataset. The schema defines the dataset fields.
-
dataset_group_arn
(Arn)
–
The Amazon Resource Name (ARN) of the dataset group to add the dataset to.
-
dataset_type
(DatasetType)
–
The type of dataset.
One of the following (case insensitive) values:
-
Interactions
-
Items
-
Users
-
Actions
-
Action_Interactions
-
tags
(Optional[Tags], default:
None
)
–
A list of tags to apply to the dataset.
Raises:
Source code in docs_src/capo_personalize/_services/async_personalize.py
| async def create_dataset(
self,
name: "capo_personalize.types.name.Name",
schema_arn: "capo_personalize.types.arn.Arn",
dataset_group_arn: "capo_personalize.types.arn.Arn",
dataset_type: "capo_personalize.types.dataset_type.DatasetType",
*,
config_overrides: Optional[AsyncPersonalizeClientConfig] = None,
tags: Optional["capo_personalize.types.tags.Tags"] = None,
) -> "capo_personalize.types.create_dataset_response.CreateDatasetResponse":
"""<p>Creates an empty dataset and adds it to the specified dataset group. Use <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CreateDatasetImportJob.html">CreateDatasetImportJob</a> to import your training data to a dataset.</p> <p>There are 5 types of datasets:</p> <ul> <li> <p>Item interactions</p> </li> <li> <p>Items</p> </li> <li> <p>Users</p> </li> <li> <p>Action interactions</p> </li> <li> <p>Actions</p> </li> </ul> <p>Each dataset type has an associated schema with required field types. Only the <code>Item interactions</code> dataset is required in order to train a model (also referred to as creating a solution).</p> <p>A dataset can be in one of the following states:</p> <ul> <li> <p>CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED</p> </li> <li> <p>DELETE PENDING > DELETE IN_PROGRESS</p> </li> </ul> <p>To get the status of the dataset, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDataset.html">DescribeDataset</a>.</p> <p class="title"> <b>Related APIs</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CreateDatasetGroup.html">CreateDatasetGroup</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListDatasets.html">ListDatasets</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDataset.html">DescribeDataset</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DeleteDataset.html">DeleteDataset</a> </p> </li> </ul>
Args:
name: <p>The name for the dataset.</p>
schema_arn: <p>The ARN of the schema to associate with the dataset. The schema defines the dataset fields.</p>
dataset_group_arn: <p>The Amazon Resource Name (ARN) of the dataset group to add the dataset to.</p>
dataset_type: <p>The type of dataset.</p> <p>One of the following (case insensitive) values:</p> <ul> <li> <p>Interactions</p> </li> <li> <p>Items</p> </li> <li> <p>Users</p> </li> <li> <p>Actions</p> </li> <li> <p>Action_Interactions</p> </li> </ul>
tags: <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset.</p>
Raises:
capo_personalize.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
capo_personalize.errors.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of requests per second has been exceeded.</p>
capo_personalize.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
capo_personalize.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
capo_personalize.errors.resource_not_found_exception.ResourceNotFoundException: <p>Could not find the specified resource.</p>
capo_personalize.errors.too_many_tags_exception.TooManyTagsException: <p>You have exceeded the maximum number of tags you can apply to this resource. </p>
capo_personalize.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_personalize.types.create_dataset_request.CreateDatasetRequest]",
) -> AsyncOperationResponse[
"capo_personalize.types.create_dataset_response.CreateDatasetResponse"
]:
import capo_personalize._operations.amazon_personalize.create_dataset
(
output,
http_response,
) = await capo_personalize._operations.amazon_personalize.create_dataset.async_create_dataset(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_personalize.types.create_dataset_request.CreateDatasetRequest",
) -> dict[str, Any]:
import capo_personalize.types.create_dataset_request
return capo_personalize.types.create_dataset_request.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateDataset", redact_input=_redact_input),
)
input_: capo_personalize.types.create_dataset_request.CreateDatasetRequest = {
"name": name,
"schema_arn": schema_arn,
"dataset_group_arn": dataset_group_arn,
"dataset_type": dataset_type,
}
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|