MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

automl/get_model_evaluation.js:17–111  ·  view source on GitHub ↗
(
  projectId = 'YOUR_PROJECT_ID',
  location = 'us-central1',
  modelId = 'YOUR_MODEL_ID',
  modelEvaluationId = 'YOUR_MODEL_EVALUATION_ID'
)

Source from the content-addressed store, hash-verified

15'use strict';
16
17function main(
18 projectId = 'YOUR_PROJECT_ID',
19 location = 'us-central1',
20 modelId = 'YOUR_MODEL_ID',
21 modelEvaluationId = 'YOUR_MODEL_EVALUATION_ID'
22) {
23 // [START automl_language_entity_extraction_get_model_evaluation]
24 // [START automl_language_sentiment_analysis_get_model_evaluation]
25 // [START automl_language_text_classification_get_model_evaluation]
26 // [START automl_translate_get_model_evaluation]
27 // [START automl_vision_classification_get_model_evaluation]
28 // [START automl_vision_object_detection_get_model_evaluation]
29 /**
30 * TODO(developer): Uncomment these variables before running the sample.
31 */
32 // const projectId = 'YOUR_PROJECT_ID';
33 // const location = 'us-central1';
34 // const modelId = 'YOUR_MODEL_ID';
35 // const modelEvaluationId = 'YOUR_MODEL_EVALUATION_ID';
36
37 // Imports the Google Cloud AutoML library
38 const {AutoMlClient} = require('@google-cloud/automl').v1;
39
40 // Instantiates a client
41 const client = new AutoMlClient();
42
43 async function getModelEvaluation() {
44 // Construct request
45 const request = {
46 name: client.modelEvaluationPath(
47 projectId,
48 location,
49 modelId,
50 modelEvaluationId
51 ),
52 };
53
54 const [response] = await client.getModelEvaluation(request);
55
56 console.log(`Model evaluation name: ${response.name}`);
57 console.log(`Model annotation spec id: ${response.annotationSpecId}`);
58 console.log(`Model display name: ${response.displayName}`);
59 console.log('Model create time');
60 console.log(`\tseconds ${response.createTime.seconds}`);
61 console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
62 console.log(`Evaluation example count: ${response.evaluatedExampleCount}`);
63 // [END automl_language_sentiment_analysis_get_model_evaluation]
64 // [END automl_language_text_classification_get_model_evaluation]
65 // [END automl_translate_get_model_evaluation]
66 // [END automl_vision_classification_get_model_evaluation]
67 // [END automl_vision_object_detection_get_model_evaluation]
68 console.log(
69 `Entity extraction model evaluation metrics: ${response.textExtractionEvaluationMetrics}`
70 );
71 // [END automl_language_entity_extraction_get_model_evaluation]
72
73 // [START automl_language_sentiment_analysis_get_model_evaluation]
74 console.log(

Callers 1

Calls 1

getModelEvaluationFunction · 0.70

Tested by

no test coverage detected