diff --git a/ai-platform/snippets/create-training-pipeline-image-classification.js b/ai-platform/snippets/create-training-pipeline-image-classification.js index 80f98b1497..d7441eb47f 100644 --- a/ai-platform/snippets/create-training-pipeline-image-classification.js +++ b/ai-platform/snippets/create-training-pipeline-image-classification.js @@ -38,9 +38,8 @@ function main( // Imports the Google Cloud Pipeline Service Client library const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; const ModelType = definition.AutoMlImageClassificationInputs.ModelType; // Specifies the location of the api endpoint @@ -57,14 +56,13 @@ function main( const parent = `projects/${project}/locations/${location}`; // Values should match the input expected by your model. - const trainingTaskInputsMessage = new definition.AutoMlImageClassificationInputs( - { + const trainingTaskInputsMessage = + new definition.AutoMlImageClassificationInputs({ multiLabel: true, modelType: ModelType.CLOUD, budgetMilliNodeHours: 8000, disableEarlyStopping: false, - } - ); + }); const trainingTaskInputs = trainingTaskInputsMessage.toValue(); diff --git a/ai-platform/snippets/create-training-pipeline-image-object-detection.js b/ai-platform/snippets/create-training-pipeline-image-object-detection.js index 9cc841ab8e..fa6d97658a 100644 --- a/ai-platform/snippets/create-training-pipeline-image-object-detection.js +++ b/ai-platform/snippets/create-training-pipeline-image-object-detection.js @@ -36,9 +36,8 @@ async function main( // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; const ModelType = definition.AutoMlImageObjectDetectionInputs.ModelType; // Imports the Google Cloud Pipeline Service Client library @@ -56,13 +55,12 @@ async function main( // Configure the parent resource const parent = `projects/${project}/locations/${location}`; - const trainingTaskInputsObj = new definition.AutoMlImageObjectDetectionInputs( - { + const trainingTaskInputsObj = + new definition.AutoMlImageObjectDetectionInputs({ disableEarlyStopping: false, modelType: ModelType.CLOUD_HIGH_ACCURACY_1, budgetMilliNodeHours: 20000, - } - ); + }); const trainingTaskInputs = trainingTaskInputsObj.toValue(); const modelToUpload = {displayName: modelDisplayName}; diff --git a/ai-platform/snippets/create-training-pipeline-tabular-classification.js b/ai-platform/snippets/create-training-pipeline-tabular-classification.js index 385ebe15a6..2e9bad1419 100644 --- a/ai-platform/snippets/create-training-pipeline-tabular-classification.js +++ b/ai-platform/snippets/create-training-pipeline-tabular-classification.js @@ -37,9 +37,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; // Imports the Google Cloud Pipeline Service Client library const {PipelineServiceClient} = aiplatform.v1; diff --git a/ai-platform/snippets/create-training-pipeline-tabular-regression.js b/ai-platform/snippets/create-training-pipeline-tabular-regression.js index e9569eac07..0520792ede 100644 --- a/ai-platform/snippets/create-training-pipeline-tabular-regression.js +++ b/ai-platform/snippets/create-training-pipeline-tabular-regression.js @@ -37,9 +37,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; // Imports the Google Cloud Pipeline Service Client library const {PipelineServiceClient} = aiplatform.v1; diff --git a/ai-platform/snippets/create-training-pipeline-text-classification.js b/ai-platform/snippets/create-training-pipeline-text-classification.js index 2ddace19a6..766267d2ab 100644 --- a/ai-platform/snippets/create-training-pipeline-text-classification.js +++ b/ai-platform/snippets/create-training-pipeline-text-classification.js @@ -35,9 +35,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; // Imports the Google Cloud Pipeline Service Client library const {PipelineServiceClient} = aiplatform.v1; diff --git a/ai-platform/snippets/create-training-pipeline-text-entity-extraction.js b/ai-platform/snippets/create-training-pipeline-text-entity-extraction.js index 790e06fd65..083f86f6f6 100644 --- a/ai-platform/snippets/create-training-pipeline-text-entity-extraction.js +++ b/ai-platform/snippets/create-training-pipeline-text-entity-extraction.js @@ -35,9 +35,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; // Imports the Google Cloud Pipeline Service Client library const {PipelineServiceClient} = aiplatform.v1; diff --git a/ai-platform/snippets/create-training-pipeline-text-sentiment-analysis.js b/ai-platform/snippets/create-training-pipeline-text-sentiment-analysis.js index 70b17a8a89..636b8a40c3 100644 --- a/ai-platform/snippets/create-training-pipeline-text-sentiment-analysis.js +++ b/ai-platform/snippets/create-training-pipeline-text-sentiment-analysis.js @@ -35,9 +35,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; // Imports the Google Cloud Pipeline Service Client library const {PipelineServiceClient} = aiplatform.v1; diff --git a/ai-platform/snippets/create-training-pipeline-video-classification.js b/ai-platform/snippets/create-training-pipeline-video-classification.js index 992a1d0291..c76ba75177 100644 --- a/ai-platform/snippets/create-training-pipeline-video-classification.js +++ b/ai-platform/snippets/create-training-pipeline-video-classification.js @@ -35,9 +35,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; // Imports the Google Cloud Pipeline Service Client library const {PipelineServiceClient} = aiplatform.v1; diff --git a/ai-platform/snippets/create-training-pipeline-video-object-tracking.js b/ai-platform/snippets/create-training-pipeline-video-object-tracking.js index a8223066c4..34e36f3625 100644 --- a/ai-platform/snippets/create-training-pipeline-video-object-tracking.js +++ b/ai-platform/snippets/create-training-pipeline-video-object-tracking.js @@ -35,9 +35,8 @@ async function main( // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; const ModelType = definition.AutoMlVideoObjectTrackingInputs.ModelType; // Imports the Google Cloud Pipeline Service Client library @@ -55,11 +54,10 @@ async function main( // Configure the parent resource const parent = `projects/${project}/locations/${location}`; - const trainingTaskInputsObj = new definition.AutoMlVideoObjectTrackingInputs( - { + const trainingTaskInputsObj = + new definition.AutoMlVideoObjectTrackingInputs({ modelType: ModelType.CLOUD, - } - ); + }); const trainingTaskInputs = trainingTaskInputsObj.toValue(); const modelToUpload = {displayName: modelDisplayName}; diff --git a/ai-platform/snippets/predict-image-classification.js b/ai-platform/snippets/predict-image-classification.js index 68d4963717..0f2d65e57b 100644 --- a/ai-platform/snippets/predict-image-classification.js +++ b/ai-platform/snippets/predict-image-classification.js @@ -28,11 +28,8 @@ function main(filename, endpointId, project, location = 'us-central1') { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - instance, - params, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {instance, params, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Prediction Service Client library const {PredictionServiceClient} = aiplatform.v1; @@ -77,9 +74,8 @@ function main(filename, endpointId, project, location = 'us-central1') { const predictions = response.predictions; console.log('\tPredictions :'); for (const predictionValue of predictions) { - const predictionResultObj = prediction.ClassificationPredictionResult.fromValue( - predictionValue - ); + const predictionResultObj = + prediction.ClassificationPredictionResult.fromValue(predictionValue); for (const [i, label] of predictionResultObj.displayNames.entries()) { console.log(`\tDisplay name: ${label}`); console.log(`\tConfidences: ${predictionResultObj.confidences[i]}`); diff --git a/ai-platform/snippets/predict-image-object-detection.js b/ai-platform/snippets/predict-image-object-detection.js index 638c8883d5..2a884e39bb 100644 --- a/ai-platform/snippets/predict-image-object-detection.js +++ b/ai-platform/snippets/predict-image-object-detection.js @@ -28,11 +28,8 @@ async function main(filename, endpointId, project, location = 'us-central1') { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - instance, - params, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {instance, params, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Prediction Service Client library const {PredictionServiceClient} = aiplatform.v1; @@ -77,9 +74,10 @@ async function main(filename, endpointId, project, location = 'us-central1') { const predictions = response.predictions; console.log('Predictions :'); for (const predictionResultVal of predictions) { - const predictionResultObj = prediction.ImageObjectDetectionPredictionResult.fromValue( - predictionResultVal - ); + const predictionResultObj = + prediction.ImageObjectDetectionPredictionResult.fromValue( + predictionResultVal + ); for (const [i, label] of predictionResultObj.displayNames.entries()) { console.log(`\tDisplay name: ${label}`); console.log(`\tConfidences: ${predictionResultObj.confidences[i]}`); diff --git a/ai-platform/snippets/predict-tabular-classification.js b/ai-platform/snippets/predict-tabular-classification.js index c5d4bc4b1f..c5fd9efb18 100644 --- a/ai-platform/snippets/predict-tabular-classification.js +++ b/ai-platform/snippets/predict-tabular-classification.js @@ -27,9 +27,8 @@ async function main(endpointId, project, location = 'us-central1') { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Prediction service client const {PredictionServiceClient} = aiplatform.v1; @@ -72,9 +71,10 @@ async function main(endpointId, project, location = 'us-central1') { const predictions = response.predictions; console.log('Predictions :'); for (const predictionResultVal of predictions) { - const predictionResultObj = prediction.TabularClassificationPredictionResult.fromValue( - predictionResultVal - ); + const predictionResultObj = + prediction.TabularClassificationPredictionResult.fromValue( + predictionResultVal + ); for (const [i, class_] of predictionResultObj.classes.entries()) { console.log(`\tClass: ${class_}`); console.log(`\tScore: ${predictionResultObj.scores[i]}\n\n`); diff --git a/ai-platform/snippets/predict-tabular-regression.js b/ai-platform/snippets/predict-tabular-regression.js index bd600ae493..5ef754f5d5 100644 --- a/ai-platform/snippets/predict-tabular-regression.js +++ b/ai-platform/snippets/predict-tabular-regression.js @@ -27,9 +27,8 @@ async function main(endpointId, project, location = 'us-central1') { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Prediction service client const {PredictionServiceClient} = aiplatform.v1; @@ -92,9 +91,10 @@ async function main(endpointId, project, location = 'us-central1') { const predictions = response.predictions; console.log('\tPredictions :'); for (const predictionResultVal of predictions) { - const predictionResultObj = prediction.TabularRegressionPredictionResult.fromValue( - predictionResultVal - ); + const predictionResultObj = + prediction.TabularRegressionPredictionResult.fromValue( + predictionResultVal + ); console.log(`\tUpper bound: ${predictionResultObj.upper_bound}`); console.log(`\tLower bound: ${predictionResultObj.lower_bound}`); console.log(`\tLower bound: ${predictionResultObj.value}`); diff --git a/ai-platform/snippets/predict-text-classification.js b/ai-platform/snippets/predict-text-classification.js index 9a589269df..ec1a575b2c 100644 --- a/ai-platform/snippets/predict-text-classification.js +++ b/ai-platform/snippets/predict-text-classification.js @@ -28,10 +28,8 @@ async function main(text, endpointId, project, location) { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - instance, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {instance, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Model Service Client library const {PredictionServiceClient} = aiplatform.v1; @@ -48,11 +46,10 @@ async function main(text, endpointId, project, location) { // Configure the resources const endpoint = `projects/${project}/locations/${location}/endpoints/${endpointId}`; - const predictionInstance = new instance.TextClassificationPredictionInstance( - { + const predictionInstance = + new instance.TextClassificationPredictionInstance({ content: text, - } - ); + }); const instanceValue = predictionInstance.toValue(); const instances = [instanceValue]; @@ -68,9 +65,10 @@ async function main(text, endpointId, project, location) { console.log('Prediction results:'); for (const predictionResultValue of response.predictions) { - const predictionResult = prediction.ClassificationPredictionResult.fromValue( - predictionResultValue - ); + const predictionResult = + prediction.ClassificationPredictionResult.fromValue( + predictionResultValue + ); for (const [i, label] of predictionResult.displayNames.entries()) { console.log(`\tDisplay name: ${label}`); diff --git a/ai-platform/snippets/predict-text-entity-extraction.js b/ai-platform/snippets/predict-text-entity-extraction.js index 81742dcd3c..a863054f6a 100644 --- a/ai-platform/snippets/predict-text-entity-extraction.js +++ b/ai-platform/snippets/predict-text-entity-extraction.js @@ -28,10 +28,8 @@ async function main(text, endpointId, project, location = 'us-central1') { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - instance, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {instance, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Model Service Client library const {PredictionServiceClient} = aiplatform.v1; @@ -67,9 +65,10 @@ async function main(text, endpointId, project, location = 'us-central1') { console.log('\nPredictions :'); for (const predictionResultValue of response.predictions) { - const predictionResult = prediction.TextExtractionPredictionResult.fromValue( - predictionResultValue - ); + const predictionResult = + prediction.TextExtractionPredictionResult.fromValue( + predictionResultValue + ); for (const [i, label] of predictionResult.displayNames.entries()) { const textStartOffset = parseInt( diff --git a/ai-platform/snippets/predict-text-sentiment-analysis.js b/ai-platform/snippets/predict-text-sentiment-analysis.js index c7db6c02db..3dd225b0d7 100644 --- a/ai-platform/snippets/predict-text-sentiment-analysis.js +++ b/ai-platform/snippets/predict-text-sentiment-analysis.js @@ -28,10 +28,8 @@ async function main(text, endpointId, project, location = 'us-central1') { // const project = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; const aiplatform = require('@google-cloud/aiplatform'); - const { - instance, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {instance, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; // Imports the Google Cloud Model Service Client library const {PredictionServiceClient} = aiplatform.v1; @@ -67,9 +65,10 @@ async function main(text, endpointId, project, location = 'us-central1') { console.log('\nPredictions :'); for (const predictionResultValue of response.predictions) { - const predictionResult = prediction.TextSentimentPredictionResult.fromValue( - predictionResultValue - ); + const predictionResult = + prediction.TextSentimentPredictionResult.fromValue( + predictionResultValue + ); console.log(`\tSentiment measure: ${predictionResult.sentiment}`); } }