SimonSmethMac
SimonSmethMac

Reputation: 87

Cloud ML Feature methods

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()

Upvotes: 0

Views: 101

Answers (2)

Rajiv Bharadwaja
Rajiv Bharadwaja

Reputation: 100

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.

Upvotes: 0

Jay Loomis
Jay Loomis

Reputation: 26

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)

Upvotes: 1

Related Questions