text_plain_output_1.png
import featuretools as ft

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import numpy as np
import pandas as pd
import math, random
from sklearn.model_selection import KFold, train_test_split
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import LabelEncoder
pd.set_option('display.max_columns', 100)
from lightgbm import LGBMRegressor
SEED = 47

PATH = '../input/30-days-of-ml/'
df_train = pd.read_csv(PATH + '/train.csv')
df_test = pd.read_csv(PATH + '/test.csv')
df_sub = pd.read_csv(PATH + '/sample_submission.csv')

target = df_train['target']
features = df_train.drop(['id', 'target'], axis=1)

es = ft.EntitySet(id='data')
es.entity_from_dataframe(entity_id='january', dataframe=features, index='id')
feature_matrix, feature_defs = ft.dfs(entityset=es, target_entity='january', trans_primitives=['add_numeric', 'multiply_numeric'], verbose=1)

cat_features = ['cat0', 'cat1', 'cat2', 'cat3', 'cat4', 'cat5', 'cat6', 'cat7', 'cat8', 'cat9']
df_cat = feature_matrix[cat_features]
feature_matrix = feature_matrix.drop(cat_features, axis=1)

features = df_test.drop(cat_features, axis=1)
es = ft.EntitySet(id='data')
es.entity_from_dataframe(entity_id='target', dataframe=features, index='id')
test_feature_matrix, test_feature_defs = ft.dfs(entityset=es, target_entity='target', trans_primitives=['add_numeric', 'multiply_numeric'], verbose=1)