Cloud ML Feature methods

对着背影说爱祢 提交于 2019-12-12 03:47:59

问题


The pre-processing page in the cloud ML How to guide (https://cloud.google.com/ml/docs/how-tos/preprocessing-data) says that you should see the SDK reference documentation for details about each type of feature and the

Can anyone point me to this documentation or a list of feature types and their methods? I'm trying to setup a discrete target but keep getting "data type int64 expected type: float" errors whenever I set my target to .discrete() rather than .continuous()


回答1:


You need to download the SDK reference documentation:

  1. Navigate to the directory where you want to install the docs in the
    command line. If you used ~/google-cloud-ml to download the samples as recommended in the setup guide, it's a good place.

  2. Copy the documentation archive to your chosen directory using gsutil:

    gsutil cp gs://cloud-ml/sdk/cloudml-docs.latest.tar.gz .
    
  3. Unpack the archive:

    tar -xf cloudml-docs.latest.tar.gz
    

This creates a docs directory inside the directory that you chose. The documentation is essentially a local website: open docs/index.html in your browser to open it at its root. You can find the transform references in there.

(This information is now in the setup guide as well. It's the final step under LOCAL: MAC/LINUX)




回答2:


On the type-related errors, let's assume for a bit that your feature set is specified somewhat along the following lines:

feature_set = {
    'target': features.target('category').discrete()
}

When a discrete target is specified like above, the data-type of the target feature is an int64 due to one of the following:

  1. No vocab for target data-column (i.e. 'category') was generated during the analysis of your data, i.e. the metadata (in the generated metadata.yaml) has an empty list for the target data-column's vocab.
  2. A vocab for 'category' was indeed generated, and the data-type of the very first item (or key) of this vocab was an int.

Under these circumstances, if a float is encountered, the transformation to the target feature's data-type will fail.

Instead, casting the entire data-column ('category' in this case) into a float should help with this.



来源:https://stackoverflow.com/questions/40512481/cloud-ml-feature-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!