Skip to content

Commit

Permalink
samples: updates samples to v1 (6 of 10) (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
telpirion authored May 3, 2021
1 parent affc53c commit 5e006b6
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_image_classification_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationImageClassificationSample {
Expand Down Expand Up @@ -59,19 +57,6 @@ static void getModelEvaluationImageClassificationSample(
System.out.format("Metrics: %s\n", modelEvaluation.getMetrics());
System.out.format("Create Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("Slice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());

ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {
System.out.println("\t\tMean Attribution");
System.out.format(
"\t\t\tBaseline Output Value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output Value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature Attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Display Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_image_object_detection_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationImageObjectDetectionSample {
Expand Down Expand Up @@ -59,19 +57,6 @@ static void getModelEvaluationImageObjectDetectionSample(
System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());

ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {
System.out.println("\t\tMean Attribution");
System.out.format(
"\t\t\tBaseline Output Value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output Value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature Attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Display Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

// [START aiplatform_get_model_evaluation_sample]

import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationSample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

// [START aiplatform_get_model_evaluation_slice_sample]

import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationSliceSample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_tabular_classification_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTabularClassificationSample {
Expand Down Expand Up @@ -58,20 +56,6 @@ static void getModelEvaluationTabularClassification(
System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();

System.out.println("\tModel Explanation");
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {
System.out.println("\t\tMean Attributions");
System.out.format(
"\t\t\tBaseline Output value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Index Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_tabular_regression_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTabularRegressionSample {
Expand Down Expand Up @@ -58,20 +56,6 @@ static void getModelEvaluationTabularRegression(
System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();

System.out.println("\tModel Explanation");
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {
System.out.println("\t\tMean Attributions");
System.out.format(
"\t\t\tBaseline Output value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Index Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_text_classification_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTextClassificationSample {
Expand Down Expand Up @@ -60,21 +58,6 @@ static void getModelEvaluationTextClassificationSample(
System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());

System.out.println("\tModel Explanation");
ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {

System.out.println("\t\tMean Attribution");
System.out.format(
"\t\t\tBaseline Output Value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output Value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature Attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Display Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_text_entity_extraction_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTextEntityExtractionSample {
Expand Down Expand Up @@ -60,21 +58,6 @@ static void getModelEvaluationTextEntityExtractionSample(
System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());

System.out.println("\tModel Explanation");
ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {

System.out.println("\t\tMean Attribution");
System.out.format(
"\t\t\tBaseline Output Value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output Value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature Attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Display Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// [START aiplatform_get_model_evaluation_text_sentiment_analysis_sample]

import com.google.cloud.aiplatform.v1beta1.Attribution;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelExplanation;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTextSentimentAnalysisSample {
Expand Down Expand Up @@ -60,21 +58,6 @@ static void getModelEvaluationTextSentimentAnalysisSample(
System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());

System.out.println("\tModel Explanation");
ModelExplanation modelExplanation = modelEvaluation.getModelExplanation();
for (Attribution attribution : modelExplanation.getMeanAttributionsList()) {

System.out.println("\t\tMean Attribution");
System.out.format(
"\t\t\tBaseline Output Value: %s\n", attribution.getBaselineOutputValue());
System.out.format(
"\t\t\tInstance Output Value: %s\n", attribution.getInstanceOutputValue());
System.out.format("\t\t\tFeature Attributions: %s\n", attribution.getFeatureAttributions());
System.out.format("\t\t\tOutput Index: %s\n", attribution.getOutputIndexList());
System.out.format("\t\t\tOutput Display Name: %s\n", attribution.getOutputDisplayName());
System.out.format("\t\t\tApproximation Error: %s\n", attribution.getApproximationError());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package aiplatform;

// [START aiplatform_get_model_evaluation_video_action_recognition_sample]
import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoActionRecognitionSample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

// [START aiplatform_get_model_evaluation_video_classification_sample]

import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoClassificationSample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

// [START aiplatform_get_model_evaluation_object_tracking_sample]

import com.google.cloud.aiplatform.v1beta1.ModelEvaluation;
import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1beta1.ModelServiceClient;
import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoObjectTrackingSample {
Expand Down

0 comments on commit 5e006b6

Please sign in to comment.