Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

class DeleteModel {

static void deleteModel() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

class DeployModel {

static void deployModel() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

class ImportDataset {

static void importDataset() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String datasetId = "YOUR_DATASET_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

class LanguageTextClassificationCreateDataset {

static void createDataset() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String displayName = "YOUR_DATASET_NAME";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

class LanguageTextClassificationCreateModel {

static void createModel() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String datasetId = "YOUR_DATASET_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class LanguageTextClassificationPredict {

static void predict() throws IOException {
public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class ListModelEvaluations {

static void listModelEvaluations() throws IOException {
public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
Expand All @@ -48,51 +48,54 @@ static void listModelEvaluations(String projectId, String modelId) throws IOExce
// Get the full path of the model.
ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
ListModelEvaluationsRequest modelEvaluationsrequest =
ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();

// List all the model evaluations in the model by applying filter.
System.out.println("List of model evaluations:");
for (ModelEvaluation modelEvaluation :
client.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
client.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {

System.out.format("Model Evaluation Name: %s\n", modelEvaluation.getName());
System.out.format("Model Annotation Spec Id: %s", modelEvaluation.getAnnotationSpecId());
System.out.println("Create Time:");
System.out.format("\tseconds: %s\n", modelEvaluation.getCreateTime().getSeconds());
System.out.format("\tnanos: %s", modelEvaluation.getCreateTime().getNanos() / 1e9);
System.out.format(
"Evalution Example Count: %d\n", modelEvaluation.getEvaluatedExampleCount());
"Evalution Example Count: %d\n", modelEvaluation.getEvaluatedExampleCount());
// [END automl_language_sentiment_analysis_list_model_evaluations]
// [END automl_language_text_classification_list_model_evaluations]
// [END automl_translate_list_model_evaluations]
// [END automl_vision_classification_list_model_evaluations]
// [END automl_vision_object_detection_list_model_evaluations]
System.out.format("Entity Extraction Model Evaluation Metrics: %s\n",
modelEvaluation.getTextExtractionEvaluationMetrics());
System.out.format(
"Entity Extraction Model Evaluation Metrics: %s\n",
modelEvaluation.getTextExtractionEvaluationMetrics());
// [END automl_language_entity_extraction_list_model_evaluations]

// [START automl_language_sentiment_analysis_list_model_evaluations]
System.out.format("Sentiment Analysis Model Evaluation Metrics: %s\n",
modelEvaluation.getTextSentimentEvaluationMetrics());
System.out.format(
"Sentiment Analysis Model Evaluation Metrics: %s\n",
modelEvaluation.getTextSentimentEvaluationMetrics());
// [END automl_language_sentiment_analysis_list_model_evaluations]

// [START automl_language_text_classification_list_model_evaluations]
// [START automl_vision_classification_list_model_evaluations]
System.out.format("Classification Model Evaluation Metrics: %s\n",
modelEvaluation.getClassificationEvaluationMetrics());
System.out.format(
"Classification Model Evaluation Metrics: %s\n",
modelEvaluation.getClassificationEvaluationMetrics());
// [END automl_language_text_classification_list_model_evaluations]
// [END automl_vision_classification_list_model_evaluations]

// [START automl_translate_list_model_evaluations]
System.out.format(
"Translate Model Evaluation Metrics: %s\n",
modelEvaluation.getTranslationEvaluationMetrics());
"Translate Model Evaluation Metrics: %s\n",
modelEvaluation.getTranslationEvaluationMetrics());
// [END automl_translate_list_model_evaluations]


// [START automl_vision_object_detection_list_model_evaluations]
System.out.format("Object Detection Model Evaluation Metrics: %s\n",
modelEvaluation.getImageObjectDetectionEvaluationMetrics());
System.out.format(
"Object Detection Model Evaluation Metrics: %s\n",
modelEvaluation.getImageObjectDetectionEvaluationMetrics());
// [START automl_language_entity_extraction_list_model_evaluations]
// [START automl_language_sentiment_analysis_list_model_evaluations]
// [START automl_language_text_classification_list_model_evaluations]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

class TranslateCreateDataset {

static void createDataset() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String displayName = "YOUR_DATASET_NAME";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

class TranslateCreateModel {

static void createModel() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String datasetId = "YOUR_DATASET_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class TranslatePredict {

static void predict() throws IOException {
public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

class VisionClassificationCreateDataset {

static void createDataset() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String displayName = "YOUR_DATASET_NAME";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

class VisionClassificationCreateModel {

static void createModel() throws IOException, ExecutionException, InterruptedException {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String datasetId = "YOUR_DATASET_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class VisionClassificationPredict {

static void predict() throws IOException {
public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
Expand Down