This repository was archived by the owner on Sep 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
samples: updates samples to v1 (3 of 8) #215
Merged
+716
−900
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f6d8f70
samples: datasets
telpirion cea450c
samples: updates samples to v1 (2 of 10)
telpirion affa7ae
fix: removed unneeded sample
telpirion 18fcea4
fix: removed unneeded test
telpirion 57375e1
samples: updates the samples to v1 (3 of 10)
telpirion 2b21ee4
samples: more updates to v1
telpirion 71307f7
fix: reset files from other PR
telpirion a702f2f
fix: tests
telpirion cfb145f
Merge branch 'master' into v1-samples-3
telpirion 9bc07b1
fix: lint
telpirion 7a9b21d
fix: linter
telpirion 5397170
fix: lint
telpirion 202db77
Merge branch 'master' into v1-samples-3
telpirion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,28 +18,24 @@ | |
|
||
// [START aiplatform_create_training_pipeline_image_classification_sample] | ||
import com.google.cloud.aiplatform.util.ValueConverter; | ||
import com.google.cloud.aiplatform.v1beta1.DeployedModelRef; | ||
import com.google.cloud.aiplatform.v1beta1.EnvVar; | ||
import com.google.cloud.aiplatform.v1beta1.ExplanationMetadata; | ||
import com.google.cloud.aiplatform.v1beta1.ExplanationParameters; | ||
import com.google.cloud.aiplatform.v1beta1.ExplanationSpec; | ||
import com.google.cloud.aiplatform.v1beta1.FilterSplit; | ||
import com.google.cloud.aiplatform.v1beta1.FractionSplit; | ||
import com.google.cloud.aiplatform.v1beta1.InputDataConfig; | ||
import com.google.cloud.aiplatform.v1beta1.LocationName; | ||
import com.google.cloud.aiplatform.v1beta1.Model; | ||
import com.google.cloud.aiplatform.v1beta1.Model.ExportFormat; | ||
import com.google.cloud.aiplatform.v1beta1.ModelContainerSpec; | ||
import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; | ||
import com.google.cloud.aiplatform.v1beta1.PipelineServiceSettings; | ||
import com.google.cloud.aiplatform.v1beta1.Port; | ||
import com.google.cloud.aiplatform.v1beta1.PredefinedSplit; | ||
import com.google.cloud.aiplatform.v1beta1.PredictSchemata; | ||
import com.google.cloud.aiplatform.v1beta1.SampledShapleyAttribution; | ||
import com.google.cloud.aiplatform.v1beta1.TimestampSplit; | ||
import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; | ||
import com.google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlImageClassificationInputs; | ||
import com.google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlImageClassificationInputs.ModelType; | ||
import com.google.cloud.aiplatform.v1.DeployedModelRef; | ||
import com.google.cloud.aiplatform.v1.EnvVar; | ||
import com.google.cloud.aiplatform.v1.FilterSplit; | ||
import com.google.cloud.aiplatform.v1.FractionSplit; | ||
import com.google.cloud.aiplatform.v1.InputDataConfig; | ||
import com.google.cloud.aiplatform.v1.LocationName; | ||
import com.google.cloud.aiplatform.v1.Model; | ||
import com.google.cloud.aiplatform.v1.Model.ExportFormat; | ||
import com.google.cloud.aiplatform.v1.ModelContainerSpec; | ||
import com.google.cloud.aiplatform.v1.PipelineServiceClient; | ||
import com.google.cloud.aiplatform.v1.PipelineServiceSettings; | ||
import com.google.cloud.aiplatform.v1.Port; | ||
import com.google.cloud.aiplatform.v1.PredefinedSplit; | ||
import com.google.cloud.aiplatform.v1.PredictSchemata; | ||
import com.google.cloud.aiplatform.v1.TimestampSplit; | ||
import com.google.cloud.aiplatform.v1.TrainingPipeline; | ||
import com.google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlImageClassificationInputs; | ||
import com.google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlImageClassificationInputs.ModelType; | ||
import com.google.rpc.Status; | ||
import java.io.IOException; | ||
|
||
|
@@ -204,25 +200,6 @@ static void createTrainingPipelineImageClassificationSample( | |
System.out.format("Deployed Model Id: %s\n", deployedModelRef.getDeployedModelId()); | ||
} | ||
|
||
ExplanationSpec explanationSpec = modelResponse.getExplanationSpec(); | ||
System.out.println("Explanation Spec"); | ||
|
||
ExplanationParameters explanationParameters = explanationSpec.getParameters(); | ||
System.out.println("Parameters"); | ||
|
||
SampledShapleyAttribution sampledShapleyAttribution = | ||
explanationParameters.getSampledShapleyAttribution(); | ||
System.out.println("Sampled Shapley Attribution"); | ||
System.out.format("Path Count: %s\n", sampledShapleyAttribution.getPathCount()); | ||
|
||
ExplanationMetadata explanationMetadata = explanationSpec.getMetadata(); | ||
System.out.println("Metadata"); | ||
System.out.format("Inputs: %s\n", explanationMetadata.getInputsMap()); | ||
System.out.format("Outputs: %s\n", explanationMetadata.getOutputsMap()); | ||
System.out.format( | ||
"Feature Attributions Schema_uri: %s\n", | ||
explanationMetadata.getFeatureAttributionsSchemaUri()); | ||
|
||
Status status = trainingPipelineResponse.getError(); | ||
System.out.println("Error"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this suppose to error or does this need a catch statement? (same for other samples) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the service might run into an error during model training that is unrelated to the request sent by the customer. There isn't an error that we can catch for this. (Same as other samples.) |
||
System.out.format("Code: %s\n", status.getCode()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: no need 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.
Okay, thanks for letting me know!