text_html_output_1.png
from lightgbm import LGBMRegressor

from sklearn.model_selection import KFold, train_test_split

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)

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)

study.best_params

optuna_params = study.best_params
optuna_params['metric'] = 'rmse'
optuna_params['random_state'] = SEED
optuna_params['n_estimators'] = 10000

X_train, X_test, y_train, y_test = train_test_split(feature_matrix, target, test_size=0.2, random_state=SEED)
model_optuna = LGBMRegressor(**optuna_params)
model_optuna.fit(X_train, y_train, eval_set=[(X_test, y_test)], early_stopping_rounds=300, verbose=300)