Skip to content

Instantly share code, notes, and snippets.

@logkcal
Last active November 23, 2017 00:00
Show Gist options
  • Save logkcal/55474a44a40c3e90391b2dfcf2f8c627 to your computer and use it in GitHub Desktop.
Save logkcal/55474a44a40c3e90391b2dfcf2f8c627 to your computer and use it in GitHub Desktop.

Q: How to implement StandardScalar? Do we have to? http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html

Dense features

Features       Feature Columns        Examples
Integer scalar numeric_column('age') 24
Float scaler   numeric_column('price') $3.14
Normalized float normalizer_fn=lambda e: tf.log(e + 1.0) norm' price

Sparse features

Features       Feature Columns        Examples
String linear categorical_column_with_hash_bucket(100) 'red'
String linear categorical_column_with_vocabulary_list 'red'
String deep embedding_column(categorical_column, dim) 'magenta'
String deep list embedding_column(categorical_column, dim) groceries
String deep 1 hot indicator_column(categorical_column) 0-1-0-0-0-0
Integerized/id categorical_column_with_identity(ubound) product_id
Buketized intgr bucketized_column(numeric_column) age_bands
Buketized float bucketized_column(numeric_column) price_bands

Crossing features

Features       Feature Columns        Examples
Bucket x category crossed_column(age_bands_col, color_col) senior_grey
Feature x magnitude weighted_categorical_column(sku, weight) a 9kg;z 5kg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment