Skip to content

Commit

Permalink
Language Automl samples (#126)
Browse files Browse the repository at this point in the history
* intial Natural Language commit

* fixed input path for skipped model test

* removed DS store, attempting linter again

* attempted linter fix

* removed lodash

* package json test directive fix, LLC fix

* dependencies for mathjs, automl in sample file added

* path fixes, project id fixes, test fixes

* comment/test cleanup

* fixed tutorial file

* manual readme update

* readme path fix model

* mefailenglishthat'sunmpossible spelling fix

* style fix for console statements

* Style fixes; thanks Ace!

* path fix!

* Fix ENV variable for project Id (GCLOUD_PROJECT)

* Language AutoML samples

* fixing lint issues

* Converting test to mocha

* Checking if Kokoro failure was a blip
  • Loading branch information
nirupa-kumar authored Sep 27, 2018
1 parent ed01a8d commit 852ec66
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 0 deletions.
142 changes: 142 additions & 0 deletions packages/google-cloud-language/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,145 @@ For more information, see https://cloud.google.com/natural-language/docs

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/README.md

### automlNaturalLanguageDataset

View the [source code][automlNaturalLanguageDataset_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/automl/automlNaturalLanguageDataset.js,samples/README.md)

__Usage:__ `node automlNaturalLanguageDataset.js --help`

```
automlNaturalLanguageDataset.js <command>
Commands:
automlNaturalLanguageDataset.js create-dataset creates a new Dataset
automlNaturalLanguageDataset.js list-datasets list all Datasets
automlNaturalLanguageDataset.js get-dataset Get a Dataset
automlNaturalLanguageDataset.js delete-dataset Delete a dataset
automlNaturalLanguageDataset.js import-data Import labeled items into dataset
automlNaturalLanguageDataset.js export-data Export a dataset to a Google Cloud Storage Bucket
Options:
--version Show version number [boolean]
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
--datasetName, -n Name of the Dataset [string] [default: "testDataSet"]
--datasetId, -i Id of the dataset [string]
--filter, -f Name of the Dataset to search for [string] [default: "text_classification_dataset_metadata:*"]
--multilabel, -m Type of the classification problem, False - MULTICLASS, True - MULTILABEL.
[string] [default: false]
--outputUri, -o URI (or local path) to export dataset [string]
--path, -p URI or local path to input .csv, or array of .csv paths
[string] [default: "gs://nodejs-docs-samples-vcm/flowerTraindataMini.csv"]
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "203278707824"]
--help Show help [boolean]
Examples:
node automlNaturalLanguageDataset.js create-dataset -n "newDataSet"
node automlNaturalLanguageDataset.js list-datasets -f "imageClassificationDatasetMetadata:*"
node automlNaturalLanguageDataset.js get-dataset -i "DATASETID"
node automlNaturalLanguageDataset.js delete-dataset -i "DATASETID"
node automlNaturalLanguageDataset.js import-data -i "dataSetId" -p "gs://myproject/mytraindata.csv"
node automlNaturalLanguageDataset.js export-data -i "dataSetId" -o "gs://myproject/outputdestination.csv"
For more information, see https://cloud.google.com/natural-language/docs
```

[automlNaturalLanguageDataset_docs]: https://cloud.google.com/natural-language/docs/
[automlNaturalLanguageDataset_code]: automl/automlNaturalLanguageDataset.js

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/README.md

### automlNaturalLanguageModel

View the [source code][automlNaturalLanguageModel_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/automl/automlNaturalLanguageModel.js,samples/README.md)

__Usage:__ `node automlNaturalLanguageModel.js --help`

```
analyze.v1beta2.js <command>
Commands:
automlNaturalLanguageModel.js create-model creates a new Model
automlNaturalLanguageModel.js get-operation-status Gets status of current operation
automlNaturalLanguageModel.js list-models list all Models
automlNaturalLanguageModel.js get-model Get a Model
automlNaturalLanguageModel.js list-model-evaluations List model evaluations
automlNaturalLanguageModel.js get-model-evaluation Get model evaluation
automlNaturalLanguageModel.js display-evaluation Display evaluation
automlNaturalLanguageModel.js delete-model Delete a Model
Options:
--version Show version number [boolean]
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
--datasetId, -i Id of the dataset [string]
--filter, -f Name of the Dataset to search for [string] [default: ""]
--modelName, -m Name of the model [string] [default: false]
--modelId, -a Id of the model [string] [default: ""]
--modelEvaluationId, -e Id of the model evaluation [string] [default: ""]
--operationFullId, -o Full name of an operation [string] [default: ""]
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "203278707824"]
--trainBudget, -t Budget for training the model [string] [default: ""]
--help Show help [boolean]
Examples:
node automlNaturalLanguageModel.js create-model -i "DatasetID" -m "myModelName" -t "2"
node automlNaturalLanguageModel.js get-operation-status -i "datasetId" -o "OperationFullID"
node automlNaturalLanguageModel.js list-models -f "textClassificationModelMetadata:*"
node automlNaturalLanguageModel.js get-model -a "ModelID"
node automlNaturalLanguageModel.js list-model-evaluations -a "ModelID"
node automlNaturalLanguageModel.js get-model-evaluation -a "ModelId" -e "ModelEvaluationID"
node automlNaturalLanguageModel.js display-evaluation -a "ModelId"
node automlNaturalLanguageModel.js delete-model -a "ModelID"
For more information, see https://cloud.google.com/natural-language/docs
```

[automlNaturalLanguageModel_docs]: https://cloud.google.com/natural-language/docs/
[automlNaturalLanguageModel_code]: automl/automlNaturalLanguageModel.js

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/README.md

### automlNaturalLanguagePredict

View the [source code][automlNaturalLanguagePredict_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/automl/automlNaturalLanguagePredict.js,samples/README.md)

__Usage:__ `node automlNaturalLanguagePredict.js --help`

```
automlNaturalLanguagePredict.js <command>
Commands:
automlNaturalLanguagePredict.js predict classify the content
Options:
--version Show version number [boolean]
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
--filePath, -f local text file path of the content to be classified [string] [default: "./resources/test.txt"]
--modelId, -i Id of the model which will be used for text classification [string]
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "203278707824"]
--scoreThreshold, -s A value from 0.0 to 1.0. When the model makes predictions for an image it willonly produce
results that have at least this confidence score threshold. Default is .5
[string] [default: "0.5"]
--help Show help [boolean]
Examples:
node automlNaturalLanguagePredict.js predict -i "modelId" -f "./resources/test.txt" -s "0.5"
For more information, see https://cloud.google.com/natural-language/docs
```

[automlNaturalLanguagePredict_docs]: https://cloud.google.com/natural-language/docs/
[automlNaturalLanguagePredict_code]: automl/automlNaturalLanguagePredict.js

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-language&page=editor&open_in_editor=samples/README.md


2 changes: 2 additions & 0 deletions packages/google-cloud-language/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"test": "mocha"
},
"dependencies": {
"@google-cloud/automl": "^0.1.1",
"mathjs": "^5.1.0",
"@google-cloud/language": "^2.0.0",
"@google-cloud/storage": "^2.0.0",
"yargs": "^12.0.0"
Expand Down

0 comments on commit 852ec66

Please sign in to comment.