-
Notifications
You must be signed in to change notification settings - Fork 23
feat(samples): add all feature values samples #981
Conversation
Warning: This pull request is touching the following templated files:
|
Here is the summary of changes. You are about to add 5 region tags.
This comment is generated by snippet-bot.
|
.setParent(EntityTypeName.of(project, location, featurestoreId, entityTypeId).toString()) | ||
.addAllRequests(createFeatureRequests).build(); | ||
|
||
OperationFuture<BatchCreateFeaturesResponse, BatchCreateFeaturesOperationMetadata> future = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name the operationFutures consistently across the files, maybe use batchCreateFeaturesOperationFuture or just future, but use same across.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will use same across
List<CreateFeatureRequest> createFeatureRequests = new ArrayList<>(); | ||
|
||
Feature titleFeature = Feature.newBuilder().setDescription("The title of the movie") | ||
.setValueType(ValueType.valueOf("STRING")).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the ENUM directly here and in other places as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will update to ENUM type everywhere as below,
.setValueType(ValueType.valueOf("STRING")).build(); | |
.setValueType(ValueType.STRING).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
||
Feature titleFeature = Feature.newBuilder().setDescription("The title of the movie") | ||
.setValueType(ValueType.valueOf("STRING")).build(); | ||
Feature genresFeature = Feature.newBuilder().setDescription("The genres of the movie") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change to singular genre
, to me genres represents an array of genres.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the same features as https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/feature_store/gapic-feature-store.ipynb sample tutorial provided in SOW.
So thought it is ok, should we change it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, let's retain it for now. It was a minor nit.
System.out.format("Operation name: %s%n", future.getInitialFuture().get().getName()); | ||
System.out.println("Waiting for operation to finish..."); | ||
BatchCreateFeaturesResponse batchCreateFeaturesResponse = | ||
future.get(timeout, TimeUnit.SECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm, is the behavior here to wait the 300 sec and timeout otherwise. If there is a response available, it's returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, if the response is not received in 300 sec it will throw timeout
.setCsvReadInstances(CsvSource.newBuilder().setGcsSource(gcsSource)) | ||
.setDestination( | ||
FeatureValueDestination.newBuilder().setBigqueryDestination(bigQueryDestination)) | ||
// .addAllPassThroughFields(passThroughFieldsList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we include this as well, if possible ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing that as there are no passThroughFields for the movie prediction example.
List<String> ids = new ArrayList<>(); | ||
ids.add("*"); | ||
FeatureSelector featureSelector = FeatureSelector.newBuilder() | ||
.setIdMatcher(IdMatcher.newBuilder().addAllIds(ids).build()).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: inline something like addAllIds(ArrayList.of()...)
, or make a class variable if intended for developer to update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will add inline as below,
.setIdMatcher(IdMatcher.newBuilder().addAllIds(ids).build()).build(); | |
.setIdMatcher(IdMatcher.newBuilder().addAllIds(Arrays.asList("title","genres","average_rating")).build()).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it's better to make it one of the variables the developer has to update and pass it down here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated code to pass the feature selector ids as a list object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure sample tests pass before merging.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #945 ☕️