text_plain_output_1.png
from lightgbm import LGBMRegressor

from sklearn.model_selection import train_test_split

from sklearn.preprocessing import MinMaxScaler, OneHotEncoder, StandardScaler

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import seaborn as sns

train_path = '/kaggle/input/playground-series-s3e8/train.csv'
test_path = '/kaggle/input/playground-series-s3e8/test.csv'
train_df = pd.DataFrame(pd.read_csv(train_path))
test_df = pd.DataFrame(pd.read_csv(test_path))
ids = test_df[['id']]
df_copy = train_df

import seaborn as sns
def plot(dataframe, col):
    pass
train_df = train_df.drop('id', axis=1)

test_df = test_df.drop('id', axis=1)
train_y = train_df['price']
train_df = train_df.drop(['price'], axis=1)

encoder = OneHotEncoder(handle_unknown='ignore')
OH_cols_train = pd.DataFrame(encoder.fit_transform(train_df[['cut', 'color', 'clarity']]).toarray())
OH_cols_valid = pd.DataFrame(encoder.transform(test_df[['cut', 'color', 'clarity']]).toarray())
test_df = test_df.join(OH_cols_valid)
train_df = train_df.join(OH_cols_train)
train_df = train_df.drop(['cut', 'color', 'clarity'], axis=1)
test_df = test_df.drop(['cut', 'color', 'clarity'], axis=1)

X_train, X_test, y_train, y_test = train_test_split(train_df, train_y, test_size=0.2, random_state=42)
lgbm = LGBMRegressor(random_state=10, n_estimators=2730, reg_alpha=8.432915874559963, reg_lambda=1.140459608805678, colsample_bytree=0.5820085284323611, subsample=0.3005306113635547, learning_rate=0.003848337624183948, max_depth=82, num_leaves=60, min_child_samples=43)
lgbm.fit(X_train, y_train)

prediction = lgbm.predict(test_df)
print(prediction)