简体   繁体   English

在云中实际训练谷歌云机器学习引擎——方法说明

[英]training google cloud ml engine actually in the cloud- clarification on the approach

I am trying to implement cloud based predictions for an sklearn model using google cloud ML engine.我正在尝试使用谷歌云机器学习引擎为 sklearn 模型实现基于云的预测。 I am able to do this however it seems that even when using the REST API, it always references a trainer module that is actually trained offline /or on a standard python3 runtime that has sklearn installed, rather than any google service:我能够做到这一点,但似乎即使在使用 REST API 时,它也总是引用实际离线/或在安装了 sklearn 的标准 python3 运行时训练的训练器模块,而不是任何谷歌服务:

training_inputs = {'scaleTier': 'BASIC',
#'masterType': 'standard',
#'parameterServerType': 'large_model',
#'workerCount': 9,
#'parameterServerCount': 3,
'packageUris': ['gs://pathto/trainer/package/packages/trainer-0.0.0.tar.gz'],
'pythonModule': 'trainer.task',
'region': 'europe-west1',
'jobDir': ,
'runtimeVersion': '1.12',
'pythonVersion': '3.5'}

So, the way I see it, whether using gcloud (command line submission ) or the REST API via:所以,在我看来,无论是使用 gcloud(命令行提交)还是通过 REST API:

request = ml.projects().jobs().create(body=job_spec, parent=project_id)

The actual training is done by my python code running sklearn- ie the google cloud ML engine all it does is receive model specs from a sklearn model.bst file and then run the actual predictions.实际的训练是由我运行 sklearn 的 python 代码完成的——即谷歌云机器学习引擎它所做的只是从 sklearn 的model.bst文件中接收模型规范,然后运行实际的预测。 Is my understanding correct ?我的理解正确吗? thanks for your help,感谢您的帮助,

To answer your question, here is some background about ML Engine: the module referred in the command is the main module which starts whole training process.为了回答您的问题,这里是有关 ML Engine 的一些背景知识:命令中引用的模块是启动整个训练过程的主模块 This process will include the training file and evaluation file in the code as in this example , and ML Engine will be in charge to create the model based on these files.此过程将在代码中包含本示例中的训练文件和评估文件,ML Engine 将负责基于这些文件创建模型。 Therefore, when submitting a training job to ML Engine, the train process will use ML Engine resources for each training step to create the model, which can be deployed into ML Engine for prediction.因此,当向 ML Engine 提交训练作业时,训练过程将使用 ML Engine 资源为每个训练步骤创建模型,该模型可以部署到 ML Engine 中进行预测。

For your question, ML Engine does not interfere the training datasets and model coding.对于您的问题,ML Engine 不会干扰训练数据集和模型编码。 That why it needs trainer module with the model specification and code.这就是为什么它需要带有模型规范和代码的训练器模块。 It provides resources for the model training and prediction, and manage the different version of the model.它为模型训练和预测提供资源,并管理模型的不同版本。 The diagram in this document should be a good reference for what ML Engine does.文档中的图表应该是 ML Engine 功能的一个很好的参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM