Skip to content

Instantly share code, notes, and snippets.

@dkn22
Last active March 26, 2018 14:18
Show Gist options
  • Save dkn22/cab41c912e15e1339e20807326591dce to your computer and use it in GitHub Desktop.
Save dkn22/cab41c912e15e1339e20807326591dce to your computer and use it in GitHub Desktop.
embed rossman data
import pandas as pd
from embedder.regression import Embedder
from embedder.preprocessing import (categorize,
pick_emb_dim, encode_categorical)
rossman = pd.read_csv('rossman.csv')
y = rossman['Sales']
X = rossman.drop('Sales', axis=1)
cat_vars = categorize(rossman)
embedding_dict = pick_emb_dim(cat_vars, max_dim=50)
X_encoded, encoders = encode_categorical(X)
embedder = Embedder(embedding_dict, model_json=None)
embedder.fit(X_encoded, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment