{"id":20113144,"url":"https://github.com/cloudacademy/mlengine-intro","last_synced_at":"2025-05-06T11:32:44.146Z","repository":{"id":39738400,"uuid":"155917453","full_name":"cloudacademy/mlengine-intro","owner":"cloudacademy","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-21T22:24:36.000Z","size":704,"stargazers_count":3,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-14T07:42:45.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudacademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-02T20:20:59.000Z","updated_at":"2020-05-18T20:04:30.000Z","dependencies_parsed_at":"2022-08-29T00:21:32.976Z","dependency_job_id":null,"html_url":"https://github.com/cloudacademy/mlengine-intro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fmlengine-intro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fmlengine-intro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fmlengine-intro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fmlengine-intro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudacademy","download_url":"https://codeload.github.com/cloudacademy/mlengine-intro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224501648,"owners_count":17321872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T18:23:25.428Z","updated_at":"2024-11-13T18:23:33.091Z","avatar_url":"https://github.com/cloudacademy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction to Google Cloud Machine Learning Engine\nThis file contains text you can copy and paste for the examples in Cloud Academy's _Introduction to Google Cloud Machine Learning Engine_ course.  \n\n### TensorFlow\nTensorFlow website: https://www.tensorflow.org  \nTensorFlow installation: https://www.tensorflow.org/install  \n\n```\npython -V       # Check which version of Python 2 is installed\npython3 -V      # Check which version of Python 3 is installed\npip install --user --upgrade pip\npip install --user --upgrade virtualenv\nvirtualenv mlenv\nsource mlenv/bin/activate\npip install tensorflow==1.10\npip install pandas\n```\n\n```\ngit clone https://github.com/cloudacademy/mlengine-intro.git\ncd mlengine-intro/iris/trainer\npython iris.py\n```\n\n### Training a Model with ML Engine\nGoogle Cloud SDK installation: https://cloud.google.com/sdk  \n\n```\ncd ..\ngcloud ai-platform local train --module-name trainer.iris --package-path trainer\n```\n\n```\nBUCKET=gs://[ProjectID]-ml  # Replace [ProjectID] with your Google Cloud Project ID  \nREGION=[Region]  # Replace [Region] with a Google Cloud Platform region, such as us-central1  \n```\n```\ngcloud ai-platform jobs submit training iris1 \\\n    --module-name trainer.iris \\\n    --package-path trainer \\\n    --staging-bucket $BUCKET \\\n    --region $REGION \\\n    --runtime-version 1.10\n```\n\n### Feature Engineering\nGoogle's original sample code: https://github.com/GoogleCloudPlatform/cloudml-samples/tree/master/census\n\n```\ncd ../census/estimator\n```\n\n```\ngcloud ai-platform local train \\\n    --module-name trainer.task \\\n    --package-path trainer \\\n    -- \\\n    --train-files data/adult.data.csv \\\n    --eval-files data/adult.test.csv \\\n    --model-type wide\n```\n\n### A Wide and Deep Model\n```\ngcloud ai-platform local train \\\n    --module-name trainer.task \\\n    --package-path trainer \\\n    -- \\\n    --train-files data/adult.data.csv \\\n    --eval-files data/adult.test.csv \\\n    --model-type deep\n```\n\n### Distributed Training on ML Engine\nHyperparameter Tuning: https://cloud.google.com/ml-engine/docs/concepts/hyperparameter-tuning-overview  \n\n```\ngsutil cp -r gs://cloudml-public/census/data $BUCKET  \nTRAIN_DATA=$BUCKET/data/adult.data.csv  \nEVAL_DATA=$BUCKET/data/adult.test.csv  \nJOB=census1  \n```\n\n```\ngcloud ai-platform jobs submit training $JOB \\\n    --job-dir $BUCKET/$JOB \\\n    --runtime-version 1.10 \\\n    --module-name trainer.task \\\n    --package-path trainer \\\n    --region $REGION \\\n    --scale-tier STANDARD_1 \\\n    -- \\\n    --train-files $TRAIN_DATA \\\n    --eval-files $EVAL_DATA\n```\n\n### Deploying a Model on ML Engine\n```\ngcloud ai-platform models create census --regions=$REGION  \ngsutil ls -r $BUCKET/census1/export  \n```\n```\n# Note: Replace [Path-to-model] below with your Cloud Storage path\ngcloud ai-platform versions create v1 \\\n    --model census \\\n    --runtime-version 1.10 \\\n    --origin [Path-to-model]\n```\n```\ngcloud ai-platform predict \\\n    --model census \\\n    --version v1 \\\n    --json-instances \\\n    ../test.json\n```\n\n### Conclusion\nCloud Machine Learning Engine documentation: https://cloud.google.com/ai-platform/docs  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fmlengine-intro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudacademy%2Fmlengine-intro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fmlengine-intro/lists"}