Search in sources :

Example 1 with ModelEvaluationName

use of com.google.cloud.automl.v1beta1.ModelEvaluationName in project java-automl by googleapis.

the class GetModelEvaluation method getModelEvaluation.

// Get a model evaluation
static void getModelEvaluation(String projectId, String modelId, String modelEvaluationId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
        // Get the full path of the model evaluation.
        ModelEvaluationName modelEvaluationFullId = ModelEvaluationName.of(projectId, "us-central1", modelId, modelEvaluationId);
        // Get complete detail of the model evaluation.
        ModelEvaluation modelEvaluation = client.getModelEvaluation(modelEvaluationFullId);
        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());
        // [END automl_language_sentiment_analysis_get_model_evaluation]
        // [END automl_language_text_classification_get_model_evaluation]
        // [END automl_translate_get_model_evaluation]
        // [END automl_vision_classification_get_model_evaluation]
        // [END automl_vision_object_detection_get_model_evaluation]
        System.out.format("Entity Extraction Model Evaluation Metrics: %s\n", modelEvaluation.getTextExtractionEvaluationMetrics());
        // [END automl_language_entity_extraction_get_model_evaluation]
        // [START automl_language_sentiment_analysis_get_model_evaluation]
        System.out.format("Sentiment Analysis Model Evaluation Metrics: %s\n", modelEvaluation.getTextSentimentEvaluationMetrics());
        // [END automl_language_sentiment_analysis_get_model_evaluation]
        // [START automl_language_text_classification_get_model_evaluation]
        // [START automl_vision_classification_get_model_evaluation]
        System.out.format("Classification Model Evaluation Metrics: %s\n", modelEvaluation.getClassificationEvaluationMetrics());
        // [END automl_language_text_classification_get_model_evaluation]
        // [END automl_vision_classification_get_model_evaluation]
        // [START automl_translate_get_model_evaluation]
        System.out.format("Translate Model Evaluation Metrics: %s\n", modelEvaluation.getTranslationEvaluationMetrics());
        // [END automl_translate_get_model_evaluation]
        // [START automl_vision_object_detection_get_model_evaluation]
        System.out.format("Object Detection Model Evaluation Metrics: %s\n", modelEvaluation.getImageObjectDetectionEvaluationMetrics());
    // [START automl_language_entity_extraction_get_model_evaluation]
    // [START automl_language_sentiment_analysis_get_model_evaluation]
    // [START automl_language_text_classification_get_model_evaluation]
    // [START automl_translate_get_model_evaluation]
    // [START automl_vision_classification_get_model_evaluation]
    }
}
Also used : ModelEvaluationName(com.google.cloud.automl.v1.ModelEvaluationName) ModelEvaluation(com.google.cloud.automl.v1.ModelEvaluation) AutoMlClient(com.google.cloud.automl.v1.AutoMlClient)

Example 2 with ModelEvaluationName

use of com.google.cloud.automl.v1beta1.ModelEvaluationName in project java-automl by googleapis.

the class GetModelEvaluation method getModelEvaluation.

// Get a model evaluation
static void getModelEvaluation(String projectId, String modelId, String modelEvaluationId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
        // Get the full path of the model evaluation.
        ModelEvaluationName modelEvaluationFullId = ModelEvaluationName.of(projectId, "us-central1", modelId, modelEvaluationId);
        // Get complete detail of the model evaluation.
        ModelEvaluation modelEvaluation = client.getModelEvaluation(modelEvaluationFullId);
        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());
        // [END automl_video_object_tracking_get_model_evaluation_beta]
        System.out.format("Classification Model Evaluation Metrics: %s%n", modelEvaluation.getClassificationEvaluationMetrics());
        // [END automl_video_classification_get_model_evaluation_beta]
        // [START automl_video_object_tracking_get_model_evaluation_beta]
        System.out.format("Video Object Tracking Evaluation Metrics: %s%n", modelEvaluation.getVideoObjectTrackingEvaluationMetrics());
    // [START automl_video_classification_get_model_evaluation_beta]
    }
}
Also used : ModelEvaluationName(com.google.cloud.automl.v1beta1.ModelEvaluationName) ModelEvaluation(com.google.cloud.automl.v1beta1.ModelEvaluation) AutoMlClient(com.google.cloud.automl.v1beta1.AutoMlClient)

Aggregations

AutoMlClient (com.google.cloud.automl.v1.AutoMlClient)1 ModelEvaluation (com.google.cloud.automl.v1.ModelEvaluation)1 ModelEvaluationName (com.google.cloud.automl.v1.ModelEvaluationName)1 AutoMlClient (com.google.cloud.automl.v1beta1.AutoMlClient)1 ModelEvaluation (com.google.cloud.automl.v1beta1.ModelEvaluation)1 ModelEvaluationName (com.google.cloud.automl.v1beta1.ModelEvaluationName)1