Loading

Sentiment Classification

Solution for submission 175607

A detailed solution for submission 175607 submitted for challenge Sentiment Classification

kadruschki

Starter Code for Sentiment Classification

In this baseline we will be training an sklearn model to do a multi-class classificattion of sentiment from face embeddings.

Downloading Dataset

Installing puzzle datasets via aicrowd-cli

In [1]:
!pip install aicrowd-cli

# Make sure to re-run below code whenever you restart colab notebook
%load_ext aicrowd.magic
Requirement already satisfied: aicrowd-cli in /usr/local/lib/python3.7/dist-packages (0.1.14)
Requirement already satisfied: python-slugify<6,>=5.0.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (5.0.2)
Requirement already satisfied: tqdm<5,>=4.56.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (4.62.3)
Requirement already satisfied: click<8,>=7.1.2 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (7.1.2)
Requirement already satisfied: rich<11,>=10.0.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (10.16.2)
Requirement already satisfied: pyzmq==22.1.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (22.1.0)
Requirement already satisfied: toml<1,>=0.10.2 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (0.10.2)
Requirement already satisfied: requests<3,>=2.25.1 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (2.27.1)
Requirement already satisfied: requests-toolbelt<1,>=0.9.1 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (0.9.1)
Requirement already satisfied: GitPython==3.1.18 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (3.1.18)
Requirement already satisfied: semver<3,>=2.13.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (2.13.0)
Requirement already satisfied: typing-extensions>=3.7.4.0 in /usr/local/lib/python3.7/dist-packages (from GitPython==3.1.18->aicrowd-cli) (3.10.0.2)
Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.7/dist-packages (from GitPython==3.1.18->aicrowd-cli) (4.0.9)
Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.7/dist-packages (from gitdb<5,>=4.0.1->GitPython==3.1.18->aicrowd-cli) (5.0.0)
Requirement already satisfied: text-unidecode>=1.3 in /usr/local/lib/python3.7/dist-packages (from python-slugify<6,>=5.0.0->aicrowd-cli) (1.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (2.0.12)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (1.24.3)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (2021.10.8)
Requirement already satisfied: colorama<0.5.0,>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from rich<11,>=10.0.0->aicrowd-cli) (0.4.4)
Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /usr/local/lib/python3.7/dist-packages (from rich<11,>=10.0.0->aicrowd-cli) (2.6.1)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from rich<11,>=10.0.0->aicrowd-cli) (0.9.1)
In [2]:
# Logging in from our AIcrowd account. Make sure you have accepted the puzzle rules before logging in!  

%aicrowd login
Please login here: https://api.aicrowd.com/auth/ACD6wIcCY5_i5BMiXNcXrzhPXZrqwJ-W2Cnk4K1uVKc
API Key valid
Gitlab access token valid
Saved details successfully!
In [3]:
# Creating a new data directory and downloading the dataset 

!rm -rf data
!mkdir data
%aicrowd ds dl -c sentiment-classification -o data

Importing Libraries

In this baseline, we will be using sklearn many Classifiers to classify the sentiment of face embeddings. In the end, SVC is used.

In [63]:
import pandas as pd
import os
import numpy as np
from ast import literal_eval
import random
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import f1_score, accuracy_score
from tensorflow.keras import models, layers
from tensorflow import keras
import tensorflow as tf
# from sklearn import svm
from sklearn.svm import SVC
from sklearn import metrics
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import cross_validate
from sklearn.metrics import accuracy_score, make_scorer, f1_score
from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler, Normalizer
from sklearn.utils import shuffle
from lightgbm import LGBMClassifier
import lightgbm 
from sklearn.model_selection import RandomizedSearchCV
import random
from sklearn.model_selection import train_test_split
# import seaborn as sns

random.seed(42)
In [5]:
# Load the TensorBoard notebook extension
%load_ext tensorboard
# Clear any logs from previous runs
!rm -rf ./logs

log_dir = 'logs/test/'

Reading Dataset

As mented in the challenge readme, we have three different sets provided - train, validation and test respectively.

In [6]:
# Reading the csv 

train = pd.read_csv("data/train.csv")
val = pd.read_csv("data/val.csv")
submission = pd.read_csv("data/sample_submission.csv")

train
Out[6]:
embeddings label
0 [0.3206779360771179, 0.988215982913971, 1.0441... positive
1 [0.05074610561132431, 1.0742985010147095, 0.60... negative
2 [0.41962647438049316, 0.4505457878112793, 1.39... negative
3 [0.4361684024333954, 0.19191382825374603, 0.83... positive
4 [0.6382085084915161, 0.8352395296096802, 0.393... neutral
... ... ...
4995 [2.2057647705078125, 1.1072001457214355, 0.435... neutral
4996 [0.6344252228736877, 1.164398193359375, 0.7155... negative
4997 [0.9160683155059814, 0.39996421337127686, 0.82... negative
4998 [0.006456990726292133, 0.18667978048324585, 0.... positive
4999 [1.337027668952942, 0.8853631615638733, 0.6706... negative

5000 rows × 2 columns

In [7]:
# Getting the feature and labels from each set. 


X = [literal_eval(embedding)  for embedding in train['embeddings'].values]
y = train['label'].values

X_val = [literal_eval(embedding)  for embedding in val['embeddings'].values]
y_val = val['label'].values
In [8]:
def label_to_int(y):
  y_res = np.zeros(y.shape)
  for i in range(0,len(y)):
    if y[i] == 'positive':
      y_res[i] = 2
    elif y[i] == 'neutral':
      y_res[i] = 1
    elif y[i] == 'negative':
      y_res[i] = 0
  return y_res

def int_to_label(y):
  y_res = np.zeros(y.shape).astype("U", copy=False)
  for i in range(0,len(y)):
    if y[i] == 2:
      y_res[i] = 'positive'
    elif y[i] == 1:
      y_res[i] = 'neutral'
    elif y[i] == 0:
      y_res[i] = 'negative'
    else:
      print("ERROR")
  return y_res
In [9]:
X_train = np.array(X).astype('float32')
X_val = np.array(X_val).astype('float32')
y = np.array(y)
y_train = label_to_int(y)
y_train = np.array(y_train).astype(np.uint8)
y_val_num = label_to_int(y_val)
y_val_num = np.array(y_val_num).astype(np.uint8)
In [10]:
def scale_data(X):
    mu = np.mean(X,axis=0)
    sigma = np.std(X, axis=0)

    normed = (X - mu)/sigma
    return normed

#scaler = StandardScaler()                    # Create feature transformer object, can accept hyperparameters like models can! 
X_train2 = np.concatenate([X, X_val])
y_train2 = label_to_int(np.concatenate([y, y_val]))
X_train2, y_train2 = shuffle(X_train2, y_train2, random_state=42)
#scaler.fit(X_train2)                          # Fitting the transformer on the train split
#X_train2_scaled = scale_data(X_train2)   # Transforming the train+val split
#X_train_scaled = scale_data(X_train)   # Transforming the train split
#X_val_scaled = scale_data(X_val)   # Transforming the val split
In [11]:
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2
from sklearn.feature_selection import f_classif
from sklearn.preprocessing import PolynomialFeatures
print(X_train2.shape)
selector = SelectKBest(f_classif, k=500)
selector.fit(X_train2, y_train2)
X_kbest = selector.transform(X_train2)
print(X_kbest.shape)
scaler = Normalizer("l1")
X_train_scaled = scaler.fit_transform(X_train2)
(7000, 512)
(7000, 500)

Building the model

Here, we will be biuld some models.

In [12]:
callback = keras.callbacks.TensorBoard(
    log_dir="/content/gdrive/My Drive/logsRelu",
    histogram_freq=1,  # How often to log histogram visualizations
    embeddings_freq=1,  # How often to log embedding visualizations
    update_freq="batch",
)  # How often to write logs (default: once per epoch)
In [13]:
# MLP Network
model1 = models.Sequential()
#model.add(layers.Flatten(input_shape=(28, 28, 1)))
model1.add(layers.Dense(3, activation='tanh', input_shape=(512,)))
model1.add(layers.Dense(3))
model1.add(layers.Dense(3))
model1.add(layers.Dense(3))


model1.summary()

model1.compile(optimizer=keras.optimizers.RMSprop(),  # Optimizer
            # Loss function to minimize
            loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),
            # List of metrics to monitor
            metrics=['sparse_categorical_accuracy'],
            )
Model: "sequential"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 dense (Dense)               (None, 3)                 1539      
                                                                 
 dense_1 (Dense)             (None, 3)                 12        
                                                                 
 dense_2 (Dense)             (None, 3)                 12        
                                                                 
 dense_3 (Dense)             (None, 3)                 12        
                                                                 
=================================================================
Total params: 1,575
Trainable params: 1,575
Non-trainable params: 0
_________________________________________________________________
In [14]:
#relu
#F1 Score : 0.7718555624302187
#Accuracy Score : 0.768

#F1 Score : 0.7688335267842854
#Accuracy Score : 0.7715

#F1 Score : 0.7691153347965752
#Accuracy Score : 0.769
#tanh
#F1 Score : 0.7807127478931334
#Accuracy Score : 0.783

#F1 Score : 0.7757699844251622
#Accuracy Score : 0.7815
# 512-512-3
#F1 Score : 0.7806896514347366
#Accuracy Score : 0.7765
In [15]:
# defining parameter range
param_grid = {'C': [ 1, 10, 100],
               'gamma': [ "scale"],
               'degree': [2, 3, 4],
               'kernel': ['poly']}
grid = GridSearchCV(SVC(), param_grid, refit = True, verbose = 3)

clf = SVC(kernel="poly", C=1, gamma="scale", degree=3, decision_function_shape='ovr', break_ties=True)
In [85]:
params = {
    'n_estimators': [400, 700, 1000, 1500, 2000],
    'colsample_bytree': [0.7, 0.8],
    'max_depth': [10, 15, 20, 25],
    'num_leaves': [50, 100, 200],
    'reg_alpha': [1.1, 1.2, 1.3],
    'reg_lambda': [1.1, 1.2, 1.3],
    'min_split_gain': [0.3, 0.4],
    'subsample': [0.7, 0.8, 0.9],
    'subsample_freq': [20],
    "objective" : "multiclass",
    "metric" : ["multi_error"],
    "learning_rate" : [0.1, 0.2, 0.5],
    "min_data_in_leaf" : [1, 5, 7, 10, 15, 20, 30]}

def gridsearchlgbm(train_X, train_y, cv=10, param_grid=params):    
    print('Classification')
    model = lightgbm.LGBMClassifier(n_estimators= param_grid['n_estimators'],
                            colsample_bytree= param_grid['colsample_bytree'],
                            max_depth= param_grid['max_depth'],
                            num_leaves = param_grid['num_leaves'],
                            reg_alpha= param_grid['reg_alpha'],
                            reg_lambda= param_grid['reg_lambda'],
                            min_split_gain= param_grid['min_split_gain'],
                            subsample= param_grid['subsample'],
                            subsample_freq= param_grid['subsample_freq'],
                            objective = param_grid['objective'],
                            metric = param_grid['metric'],
                            learning_rate = param_grid['learning_rate'],
                            min_data_in_leaf=  param_grid["min_data_in_leaf"])
    
    print("grid")
    model_rsc = RandomizedSearchCV(model, param_grid, cv = cv, verbose=3)#if not working use np.random.RandomState(123)
    model_rsc = model_rsc.fit(train_X, train_y)

    best_param = model_rsc.best_params_
    print(best_param) 
    print("grid done")
    return best_param
In [86]:
#search
#params = gridsearchlgbm(X_train2[:5000], y_train2[:5000])
#train with best params
#model = lightgbm.LGBMClassifier(**params)
# model = lightgbm.LGBMRegressor(**params)
#fit
#model.fit(X_train2[:5000], y_train2[:5000])
#predict
#preds = model.predict(X_train2[5000:])
Classification
grid
Fitting 10 folds for each of 10 candidates, totalling 100 fits
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.720 total time=  25.4s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.762 total time=  24.5s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.742 total time=  24.5s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.744 total time=  24.6s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.714 total time=  25.1s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.712 total time=  24.2s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.760 total time=  24.6s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.758 total time=  24.5s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.768 total time=  25.1s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=25, metric=multi_error, min_data_in_leaf=15, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.2, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.736 total time=  24.3s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.712 total time=  26.6s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.772 total time=  26.5s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.730 total time=  26.5s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.716 total time=  26.7s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.712 total time=  26.7s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.742 total time=  26.4s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.742 total time=  26.7s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.752 total time=  26.6s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.742 total time=  26.4s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=2000, num_leaves=100, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.754 total time=  26.5s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.728 total time=  13.5s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.756 total time=  13.6s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.726 total time=  13.7s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.730 total time=  13.6s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.720 total time=  13.5s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.724 total time=  13.5s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.762 total time=  13.6s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.744 total time=  13.6s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.734 total time=  13.6s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=7, min_split_gain=0.3, n_estimators=700, num_leaves=200, objective=l, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.728 total time=  13.6s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.726 total time=  13.1s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.758 total time=  13.0s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.738 total time=  12.9s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.740 total time=  12.9s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.704 total time=  12.7s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.724 total time=  13.0s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.764 total time=  13.0s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.762 total time=  13.2s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.744 total time=  13.1s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=20, min_split_gain=0.4, n_estimators=700, num_leaves=50, objective=a, reg_alpha=1.2, reg_lambda=1.2, subsample=0.9, subsample_freq=20;, score=0.736 total time=  13.1s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.720 total time=  20.8s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.764 total time=  20.9s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.746 total time=  20.7s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.734 total time=  20.8s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.714 total time=  20.7s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.734 total time=  20.5s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.764 total time=  20.4s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.740 total time=  20.4s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.754 total time=  20.5s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.1, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.3, n_estimators=1000, num_leaves=100, objective=a, reg_alpha=1.2, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.766 total time=  20.6s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.688 total time=   9.6s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.740 total time=   9.7s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.728 total time=   9.6s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.704 total time=   9.6s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.710 total time=   9.6s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.702 total time=   9.5s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.724 total time=   9.7s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.714 total time=   9.5s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.716 total time=   9.5s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=1, min_split_gain=0.4, n_estimators=700, num_leaves=100, objective=l, reg_alpha=1.2, reg_lambda=1.3, subsample=0.7, subsample_freq=20;, score=0.738 total time=   9.7s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.714 total time=  12.4s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.758 total time=  12.6s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.698 total time=  12.7s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.716 total time=  12.8s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.694 total time=  12.6s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.686 total time=  12.5s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.744 total time=  12.4s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.710 total time=  12.6s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.714 total time=  12.5s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.5, max_depth=20, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=1000, num_leaves=200, objective=m, reg_alpha=1.1, reg_lambda=1.1, subsample=0.7, subsample_freq=20;, score=0.712 total time=  12.7s
[CV 1/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.724 total time=   9.6s
[CV 2/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.760 total time=   9.5s
[CV 3/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.732 total time=   9.5s
[CV 4/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.734 total time=   9.5s
[CV 5/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.700 total time=   9.4s
[CV 6/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.720 total time=   9.5s
[CV 7/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.748 total time=   9.5s
[CV 8/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.738 total time=   9.6s
[CV 9/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.726 total time=   9.8s
[CV 10/10] END colsample_bytree=0.8, learning_rate=0.2, max_depth=15, metric=multi_error, min_data_in_leaf=10, min_split_gain=0.4, n_estimators=400, num_leaves=50, objective=u, reg_alpha=1.3, reg_lambda=1.2, subsample=0.7, subsample_freq=20;, score=0.742 total time=   9.8s
[CV 1/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.702 total time=  15.5s
[CV 2/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.742 total time=  15.4s
[CV 3/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.704 total time=  15.4s
[CV 4/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.714 total time=  15.4s
[CV 5/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.696 total time=  15.5s
[CV 6/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.718 total time=  15.4s
[CV 7/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.728 total time=  15.4s
[CV 8/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.746 total time=  15.3s
[CV 9/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.730 total time=  15.3s
[CV 10/10] END colsample_bytree=0.8, learning_rate=0.5, max_depth=10, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.3, n_estimators=1000, num_leaves=200, objective=u, reg_alpha=1.3, reg_lambda=1.1, subsample=0.8, subsample_freq=20;, score=0.740 total time=  15.2s
[CV 1/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.714 total time=   9.2s
[CV 2/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.770 total time=   9.3s
[CV 3/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.736 total time=   9.3s
[CV 4/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.740 total time=   9.1s
[CV 5/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.716 total time=   9.2s
[CV 6/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.722 total time=   9.2s
[CV 7/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.724 total time=   9.2s
[CV 8/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.752 total time=   9.2s
[CV 9/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.734 total time=   9.2s
[CV 10/10] END colsample_bytree=0.7, learning_rate=0.2, max_depth=20, metric=multi_error, min_data_in_leaf=5, min_split_gain=0.4, n_estimators=400, num_leaves=200, objective=c, reg_alpha=1.3, reg_lambda=1.3, subsample=0.9, subsample_freq=20;, score=0.734 total time=   9.1s
{'subsample_freq': 20, 'subsample': 0.8, 'reg_lambda': 1.1, 'reg_alpha': 1.2, 'objective': 'a', 'num_leaves': 100, 'n_estimators': 1000, 'min_split_gain': 0.3, 'min_data_in_leaf': 10, 'metric': 'multi_error', 'max_depth': 15, 'learning_rate': 0.1, 'colsample_bytree': 0.7}
grid done
In [87]:
print("\nLightGBM")
print(f"F1 Score : {f1_score(y_train2[5000:], preds, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_train2[5000:], preds)}")
LightGBM
F1 Score : 0.7341591964598636
Accuracy Score : 0.7385
In [16]:
SEARCH_PARAMS = {'learning_rate': 0.4,
                 'max_depth': 15,
                 'num_leaves': 20,
                 'feature_fraction': 0.8,
                 'subsample': 0.2}

FIXED_PARAMS={'objective': 'multiclass',
              'metric': 'multi_error',
              'is_unbalance': True,
              'boosting':'gbdt',
              'num_boost_round':600,
              'early_stopping_rounds':50}

parameters = {
    'objective': 'multiclass',
    'metric': 'multi_logloss',
    'is_unbalance': 'true',
    'boosting': 'dart',
    'max_depth': 26,
    'num_leaves': 29,
    'num_classes': 3,
    'feature_fraction': 0.6,
    'subsample': 0.2,
    'learning_rate': 0.01, 
    'bagging_freq': 6, 
    'iterationmax_dropdrop_rate': 0.3}

train_data = lightgbm.Dataset(X_train, label=y_train)
val_data = lightgbm.Dataset(X_val, label=label_to_int(y_val))

Training the model

Here, we will be training our model using the training set.

In [17]:
model_lgbm = lightgbm.train(parameters, train_data,                     
                     valid_sets=[val_data],
                     num_boost_round=FIXED_PARAMS['num_boost_round'],
                     early_stopping_rounds=FIXED_PARAMS['early_stopping_rounds'],
                     valid_names=['valid'],
                     )

score = model_lgbm.best_score['valid']['multi_logloss']
[1]	valid's multi_logloss: 1.09422
/usr/local/lib/python3.7/dist-packages/lightgbm/callback.py:189: UserWarning: Early stopping is not available in dart mode
  warnings.warn('Early stopping is not available in dart mode')
[2]	valid's multi_logloss: 1.09024
[3]	valid's multi_logloss: 1.08615
[4]	valid's multi_logloss: 1.08242
[5]	valid's multi_logloss: 1.07879
[6]	valid's multi_logloss: 1.07515
[7]	valid's multi_logloss: 1.0717
[8]	valid's multi_logloss: 1.073
[9]	valid's multi_logloss: 1.06942
[10]	valid's multi_logloss: 1.06585
[11]	valid's multi_logloss: 1.06228
[12]	valid's multi_logloss: 1.06349
[13]	valid's multi_logloss: 1.0599
[14]	valid's multi_logloss: 1.05647
[15]	valid's multi_logloss: 1.05336
[16]	valid's multi_logloss: 1.05039
[17]	valid's multi_logloss: 1.04718
[18]	valid's multi_logloss: 1.04383
[19]	valid's multi_logloss: 1.04075
[20]	valid's multi_logloss: 1.03762
[21]	valid's multi_logloss: 1.03842
[22]	valid's multi_logloss: 1.03554
[23]	valid's multi_logloss: 1.03261
[24]	valid's multi_logloss: 1.02962
[25]	valid's multi_logloss: 1.0269
[26]	valid's multi_logloss: 1.024
[27]	valid's multi_logloss: 1.02125
[28]	valid's multi_logloss: 1.02216
[29]	valid's multi_logloss: 1.01928
[30]	valid's multi_logloss: 1.01619
[31]	valid's multi_logloss: 1.01614
[32]	valid's multi_logloss: 1.01328
[33]	valid's multi_logloss: 1.01035
[34]	valid's multi_logloss: 1.00766
[35]	valid's multi_logloss: 1.00882
[36]	valid's multi_logloss: 1.01074
[37]	valid's multi_logloss: 1.00778
[38]	valid's multi_logloss: 1.00505
[39]	valid's multi_logloss: 1.00226
[40]	valid's multi_logloss: 1.00141
[41]	valid's multi_logloss: 1.00283
[42]	valid's multi_logloss: 1.00018
[43]	valid's multi_logloss: 1.00158
[44]	valid's multi_logloss: 0.998958
[45]	valid's multi_logloss: 0.996308
[46]	valid's multi_logloss: 0.998428
[47]	valid's multi_logloss: 0.995945
[48]	valid's multi_logloss: 0.995609
[49]	valid's multi_logloss: 0.997208
[50]	valid's multi_logloss: 0.998888
[51]	valid's multi_logloss: 0.996139
[52]	valid's multi_logloss: 0.993884
[53]	valid's multi_logloss: 0.995025
[54]	valid's multi_logloss: 0.992489
[55]	valid's multi_logloss: 0.989777
[56]	valid's multi_logloss: 0.991472
[57]	valid's multi_logloss: 0.988877
[58]	valid's multi_logloss: 0.990554
[59]	valid's multi_logloss: 0.992164
[60]	valid's multi_logloss: 0.989672
[61]	valid's multi_logloss: 0.990867
[62]	valid's multi_logloss: 0.988353
[63]	valid's multi_logloss: 0.985871
[64]	valid's multi_logloss: 0.987208
[65]	valid's multi_logloss: 0.9886
[66]	valid's multi_logloss: 0.985908
[67]	valid's multi_logloss: 0.983698
[68]	valid's multi_logloss: 0.981089
[69]	valid's multi_logloss: 0.982472
[70]	valid's multi_logloss: 0.983219
[71]	valid's multi_logloss: 0.984081
[72]	valid's multi_logloss: 0.981752
[73]	valid's multi_logloss: 0.979165
[74]	valid's multi_logloss: 0.980345
[75]	valid's multi_logloss: 0.977866
[76]	valid's multi_logloss: 0.977978
[77]	valid's multi_logloss: 0.97898
[78]	valid's multi_logloss: 0.979947
[79]	valid's multi_logloss: 0.977463
[80]	valid's multi_logloss: 0.974997
[81]	valid's multi_logloss: 0.976087
[82]	valid's multi_logloss: 0.973494
[83]	valid's multi_logloss: 0.974839
[84]	valid's multi_logloss: 0.976193
[85]	valid's multi_logloss: 0.977461
[86]	valid's multi_logloss: 0.975174
[87]	valid's multi_logloss: 0.972694
[88]	valid's multi_logloss: 0.974268
[89]	valid's multi_logloss: 0.975159
[90]	valid's multi_logloss: 0.976474
[91]	valid's multi_logloss: 0.977652
[92]	valid's multi_logloss: 0.975153
[93]	valid's multi_logloss: 0.972662
[94]	valid's multi_logloss: 0.973911
[95]	valid's multi_logloss: 0.97485
[96]	valid's multi_logloss: 0.975879
[97]	valid's multi_logloss: 0.973472
[98]	valid's multi_logloss: 0.974479
[99]	valid's multi_logloss: 0.971988
[100]	valid's multi_logloss: 0.969497
[101]	valid's multi_logloss: 0.970891
[102]	valid's multi_logloss: 0.971995
[103]	valid's multi_logloss: 0.973187
[104]	valid's multi_logloss: 0.970755
[105]	valid's multi_logloss: 0.972026
[106]	valid's multi_logloss: 0.973229
[107]	valid's multi_logloss: 0.974445
[108]	valid's multi_logloss: 0.972164
[109]	valid's multi_logloss: 0.973211
[110]	valid's multi_logloss: 0.974321
[111]	valid's multi_logloss: 0.971892
[112]	valid's multi_logloss: 0.969436
[113]	valid's multi_logloss: 0.966926
[114]	valid's multi_logloss: 0.964383
[115]	valid's multi_logloss: 0.962314
[116]	valid's multi_logloss: 0.960325
[117]	valid's multi_logloss: 0.961239
[118]	valid's multi_logloss: 0.959279
[119]	valid's multi_logloss: 0.960279
[120]	valid's multi_logloss: 0.96141
[121]	valid's multi_logloss: 0.962549
[122]	valid's multi_logloss: 0.963707
[123]	valid's multi_logloss: 0.961355
[124]	valid's multi_logloss: 0.958733
[125]	valid's multi_logloss: 0.959659
[126]	valid's multi_logloss: 0.960854
[127]	valid's multi_logloss: 0.958552
[128]	valid's multi_logloss: 0.959537
[129]	valid's multi_logloss: 0.95694
[130]	valid's multi_logloss: 0.955089
[131]	valid's multi_logloss: 0.956055
[132]	valid's multi_logloss: 0.953767
[133]	valid's multi_logloss: 0.951455
[134]	valid's multi_logloss: 0.952604
[135]	valid's multi_logloss: 0.950169
[136]	valid's multi_logloss: 0.95144
[137]	valid's multi_logloss: 0.952481
[138]	valid's multi_logloss: 0.950279
[139]	valid's multi_logloss: 0.948206
[140]	valid's multi_logloss: 0.949489
[141]	valid's multi_logloss: 0.950505
[142]	valid's multi_logloss: 0.951575
[143]	valid's multi_logloss: 0.949459
[144]	valid's multi_logloss: 0.950413
[145]	valid's multi_logloss: 0.948223
[146]	valid's multi_logloss: 0.949492
[147]	valid's multi_logloss: 0.950705
[148]	valid's multi_logloss: 0.951845
[149]	valid's multi_logloss: 0.949638
[150]	valid's multi_logloss: 0.947471
[151]	valid's multi_logloss: 0.948705
[152]	valid's multi_logloss: 0.949852
[153]	valid's multi_logloss: 0.947444
[154]	valid's multi_logloss: 0.94837
[155]	valid's multi_logloss: 0.946213
[156]	valid's multi_logloss: 0.947446
[157]	valid's multi_logloss: 0.948083
[158]	valid's multi_logloss: 0.949313
[159]	valid's multi_logloss: 0.950485
[160]	valid's multi_logloss: 0.951662
[161]	valid's multi_logloss: 0.949493
[162]	valid's multi_logloss: 0.950277
[163]	valid's multi_logloss: 0.948069
[164]	valid's multi_logloss: 0.945842
[165]	valid's multi_logloss: 0.943564
[166]	valid's multi_logloss: 0.94148
[167]	valid's multi_logloss: 0.939225
[168]	valid's multi_logloss: 0.937004
[169]	valid's multi_logloss: 0.935202
[170]	valid's multi_logloss: 0.936317
[171]	valid's multi_logloss: 0.934661
[172]	valid's multi_logloss: 0.935715
[173]	valid's multi_logloss: 0.93404
[174]	valid's multi_logloss: 0.932052
[175]	valid's multi_logloss: 0.929887
[176]	valid's multi_logloss: 0.930771
[177]	valid's multi_logloss: 0.931831
[178]	valid's multi_logloss: 0.932831
[179]	valid's multi_logloss: 0.930715
[180]	valid's multi_logloss: 0.931644
[181]	valid's multi_logloss: 0.929585
[182]	valid's multi_logloss: 0.92742
[183]	valid's multi_logloss: 0.925277
[184]	valid's multi_logloss: 0.923293
[185]	valid's multi_logloss: 0.924643
[186]	valid's multi_logloss: 0.922763
[187]	valid's multi_logloss: 0.920623
[188]	valid's multi_logloss: 0.918629
[189]	valid's multi_logloss: 0.91977
[190]	valid's multi_logloss: 0.92084
[191]	valid's multi_logloss: 0.918798
[192]	valid's multi_logloss: 0.916692
[193]	valid's multi_logloss: 0.914487
[194]	valid's multi_logloss: 0.915517
[195]	valid's multi_logloss: 0.916464
[196]	valid's multi_logloss: 0.914689
[197]	valid's multi_logloss: 0.915514
[198]	valid's multi_logloss: 0.916507
[199]	valid's multi_logloss: 0.914706
[200]	valid's multi_logloss: 0.915851
[201]	valid's multi_logloss: 0.916982
[202]	valid's multi_logloss: 0.918061
[203]	valid's multi_logloss: 0.916103
[204]	valid's multi_logloss: 0.917
[205]	valid's multi_logloss: 0.918003
[206]	valid's multi_logloss: 0.916339
[207]	valid's multi_logloss: 0.917338
[208]	valid's multi_logloss: 0.915478
[209]	valid's multi_logloss: 0.916571
[210]	valid's multi_logloss: 0.917556
[211]	valid's multi_logloss: 0.918514
[212]	valid's multi_logloss: 0.916448
[213]	valid's multi_logloss: 0.914582
[214]	valid's multi_logloss: 0.91275
[215]	valid's multi_logloss: 0.910896
[216]	valid's multi_logloss: 0.911986
[217]	valid's multi_logloss: 0.910162
[218]	valid's multi_logloss: 0.908453
[219]	valid's multi_logloss: 0.909387
[220]	valid's multi_logloss: 0.907297
[221]	valid's multi_logloss: 0.908338
[222]	valid's multi_logloss: 0.906605
[223]	valid's multi_logloss: 0.904783
[224]	valid's multi_logloss: 0.905915
[225]	valid's multi_logloss: 0.907105
[226]	valid's multi_logloss: 0.908047
[227]	valid's multi_logloss: 0.908809
[228]	valid's multi_logloss: 0.906734
[229]	valid's multi_logloss: 0.907708
[230]	valid's multi_logloss: 0.906125
[231]	valid's multi_logloss: 0.904338
[232]	valid's multi_logloss: 0.902505
[233]	valid's multi_logloss: 0.903442
[234]	valid's multi_logloss: 0.901846
[235]	valid's multi_logloss: 0.902759
[236]	valid's multi_logloss: 0.90102
[237]	valid's multi_logloss: 0.899223
[238]	valid's multi_logloss: 0.897585
[239]	valid's multi_logloss: 0.895965
[240]	valid's multi_logloss: 0.894196
[241]	valid's multi_logloss: 0.89527
[242]	valid's multi_logloss: 0.893636
[243]	valid's multi_logloss: 0.89474
[244]	valid's multi_logloss: 0.895712
[245]	valid's multi_logloss: 0.894043
[246]	valid's multi_logloss: 0.892428
[247]	valid's multi_logloss: 0.890714
[248]	valid's multi_logloss: 0.891824
[249]	valid's multi_logloss: 0.892721
[250]	valid's multi_logloss: 0.891034
[251]	valid's multi_logloss: 0.892053
[252]	valid's multi_logloss: 0.892975
[253]	valid's multi_logloss: 0.891242
[254]	valid's multi_logloss: 0.889674
[255]	valid's multi_logloss: 0.888078
[256]	valid's multi_logloss: 0.886775
[257]	valid's multi_logloss: 0.885163
[258]	valid's multi_logloss: 0.883637
[259]	valid's multi_logloss: 0.884606
[260]	valid's multi_logloss: 0.885685
[261]	valid's multi_logloss: 0.886643
[262]	valid's multi_logloss: 0.884882
[263]	valid's multi_logloss: 0.883496
[264]	valid's multi_logloss: 0.881977
[265]	valid's multi_logloss: 0.880492
[266]	valid's multi_logloss: 0.879144
[267]	valid's multi_logloss: 0.880084
[268]	valid's multi_logloss: 0.878615
[269]	valid's multi_logloss: 0.879602
[270]	valid's multi_logloss: 0.878127
[271]	valid's multi_logloss: 0.879107
[272]	valid's multi_logloss: 0.877505
[273]	valid's multi_logloss: 0.87584
[274]	valid's multi_logloss: 0.876721
[275]	valid's multi_logloss: 0.875191
[276]	valid's multi_logloss: 0.876265
[277]	valid's multi_logloss: 0.874638
[278]	valid's multi_logloss: 0.875515
[279]	valid's multi_logloss: 0.873971
[280]	valid's multi_logloss: 0.874901
[281]	valid's multi_logloss: 0.87576
[282]	valid's multi_logloss: 0.874132
[283]	valid's multi_logloss: 0.8751
[284]	valid's multi_logloss: 0.873426
[285]	valid's multi_logloss: 0.871903
[286]	valid's multi_logloss: 0.870119
[287]	valid's multi_logloss: 0.868657
[288]	valid's multi_logloss: 0.869617
[289]	valid's multi_logloss: 0.868223
[290]	valid's multi_logloss: 0.866663
[291]	valid's multi_logloss: 0.865127
[292]	valid's multi_logloss: 0.86616
[293]	valid's multi_logloss: 0.867143
[294]	valid's multi_logloss: 0.865672
[295]	valid's multi_logloss: 0.866663
[296]	valid's multi_logloss: 0.867604
[297]	valid's multi_logloss: 0.866085
[298]	valid's multi_logloss: 0.866948
[299]	valid's multi_logloss: 0.865672
[300]	valid's multi_logloss: 0.866499
[301]	valid's multi_logloss: 0.867471
[302]	valid's multi_logloss: 0.866135
[303]	valid's multi_logloss: 0.86704
[304]	valid's multi_logloss: 0.86798
[305]	valid's multi_logloss: 0.868958
[306]	valid's multi_logloss: 0.869824
[307]	valid's multi_logloss: 0.870581
[308]	valid's multi_logloss: 0.86937
[309]	valid's multi_logloss: 0.870215
[310]	valid's multi_logloss: 0.868802
[311]	valid's multi_logloss: 0.867489
[312]	valid's multi_logloss: 0.866227
[313]	valid's multi_logloss: 0.864725
[314]	valid's multi_logloss: 0.865519
[315]	valid's multi_logloss: 0.866395
[316]	valid's multi_logloss: 0.865027
[317]	valid's multi_logloss: 0.863406
[318]	valid's multi_logloss: 0.861945
[319]	valid's multi_logloss: 0.862775
[320]	valid's multi_logloss: 0.86137
[321]	valid's multi_logloss: 0.862113
[322]	valid's multi_logloss: 0.860559
[323]	valid's multi_logloss: 0.859256
[324]	valid's multi_logloss: 0.860204
[325]	valid's multi_logloss: 0.858734
[326]	valid's multi_logloss: 0.859632
[327]	valid's multi_logloss: 0.858229
[328]	valid's multi_logloss: 0.859048
[329]	valid's multi_logloss: 0.857694
[330]	valid's multi_logloss: 0.858544
[331]	valid's multi_logloss: 0.859393
[332]	valid's multi_logloss: 0.860192
[333]	valid's multi_logloss: 0.861089
[334]	valid's multi_logloss: 0.861979
[335]	valid's multi_logloss: 0.860613
[336]	valid's multi_logloss: 0.861491
[337]	valid's multi_logloss: 0.860233
[338]	valid's multi_logloss: 0.858629
[339]	valid's multi_logloss: 0.859407
[340]	valid's multi_logloss: 0.860258
[341]	valid's multi_logloss: 0.858802
[342]	valid's multi_logloss: 0.857265
[343]	valid's multi_logloss: 0.855892
[344]	valid's multi_logloss: 0.856676
[345]	valid's multi_logloss: 0.855446
[346]	valid's multi_logloss: 0.854073
[347]	valid's multi_logloss: 0.854865
[348]	valid's multi_logloss: 0.853531
[349]	valid's multi_logloss: 0.852201
[350]	valid's multi_logloss: 0.853093
[351]	valid's multi_logloss: 0.85168
[352]	valid's multi_logloss: 0.850294
[353]	valid's multi_logloss: 0.84883
[354]	valid's multi_logloss: 0.849555
[355]	valid's multi_logloss: 0.850383
[356]	valid's multi_logloss: 0.848881
[357]	valid's multi_logloss: 0.849607
[358]	valid's multi_logloss: 0.848025
[359]	valid's multi_logloss: 0.84887
[360]	valid's multi_logloss: 0.84747
[361]	valid's multi_logloss: 0.846267
[362]	valid's multi_logloss: 0.84482
[363]	valid's multi_logloss: 0.845638
[364]	valid's multi_logloss: 0.846411
[365]	valid's multi_logloss: 0.845236
[366]	valid's multi_logloss: 0.846031
[367]	valid's multi_logloss: 0.846907
[368]	valid's multi_logloss: 0.845637
[369]	valid's multi_logloss: 0.846337
[370]	valid's multi_logloss: 0.844988
[371]	valid's multi_logloss: 0.845795
[372]	valid's multi_logloss: 0.844476
[373]	valid's multi_logloss: 0.843197
[374]	valid's multi_logloss: 0.841701
[375]	valid's multi_logloss: 0.840333
[376]	valid's multi_logloss: 0.841059
[377]	valid's multi_logloss: 0.83974
[378]	valid's multi_logloss: 0.84056
[379]	valid's multi_logloss: 0.841345
[380]	valid's multi_logloss: 0.840107
[381]	valid's multi_logloss: 0.840935
[382]	valid's multi_logloss: 0.841762
[383]	valid's multi_logloss: 0.840581
[384]	valid's multi_logloss: 0.839174
[385]	valid's multi_logloss: 0.840025
[386]	valid's multi_logloss: 0.838785
[387]	valid's multi_logloss: 0.837482
[388]	valid's multi_logloss: 0.836127
[389]	valid's multi_logloss: 0.834851
[390]	valid's multi_logloss: 0.833694
[391]	valid's multi_logloss: 0.834504
[392]	valid's multi_logloss: 0.83316
[393]	valid's multi_logloss: 0.831906
[394]	valid's multi_logloss: 0.830734
[395]	valid's multi_logloss: 0.829463
[396]	valid's multi_logloss: 0.830216
[397]	valid's multi_logloss: 0.828963
[398]	valid's multi_logloss: 0.827985
[399]	valid's multi_logloss: 0.826754
[400]	valid's multi_logloss: 0.825688
[401]	valid's multi_logloss: 0.826379
[402]	valid's multi_logloss: 0.825177
[403]	valid's multi_logloss: 0.825873
[404]	valid's multi_logloss: 0.824693
[405]	valid's multi_logloss: 0.823552
[406]	valid's multi_logloss: 0.824266
[407]	valid's multi_logloss: 0.823088
[408]	valid's multi_logloss: 0.823889
[409]	valid's multi_logloss: 0.822825
[410]	valid's multi_logloss: 0.821691
[411]	valid's multi_logloss: 0.820469
[412]	valid's multi_logloss: 0.821197
[413]	valid's multi_logloss: 0.821978
[414]	valid's multi_logloss: 0.820788
[415]	valid's multi_logloss: 0.819619
[416]	valid's multi_logloss: 0.818597
[417]	valid's multi_logloss: 0.819424
[418]	valid's multi_logloss: 0.820201
[419]	valid's multi_logloss: 0.819165
[420]	valid's multi_logloss: 0.819921
[421]	valid's multi_logloss: 0.818791
[422]	valid's multi_logloss: 0.817561
[423]	valid's multi_logloss: 0.816426
[424]	valid's multi_logloss: 0.815463
[425]	valid's multi_logloss: 0.816222
[426]	valid's multi_logloss: 0.815127
[427]	valid's multi_logloss: 0.813882
[428]	valid's multi_logloss: 0.81465
[429]	valid's multi_logloss: 0.813499
[430]	valid's multi_logloss: 0.814177
[431]	valid's multi_logloss: 0.812807
[432]	valid's multi_logloss: 0.811793
[433]	valid's multi_logloss: 0.810661
[434]	valid's multi_logloss: 0.811389
[435]	valid's multi_logloss: 0.812075
[436]	valid's multi_logloss: 0.810999
[437]	valid's multi_logloss: 0.809992
[438]	valid's multi_logloss: 0.810645
[439]	valid's multi_logloss: 0.811317
[440]	valid's multi_logloss: 0.810246
[441]	valid's multi_logloss: 0.808994
[442]	valid's multi_logloss: 0.807938
[443]	valid's multi_logloss: 0.808614
[444]	valid's multi_logloss: 0.807563
[445]	valid's multi_logloss: 0.806508
[446]	valid's multi_logloss: 0.807192
[447]	valid's multi_logloss: 0.806125
[448]	valid's multi_logloss: 0.805002
[449]	valid's multi_logloss: 0.804002
[450]	valid's multi_logloss: 0.802953
[451]	valid's multi_logloss: 0.801903
[452]	valid's multi_logloss: 0.802578
[453]	valid's multi_logloss: 0.803239
[454]	valid's multi_logloss: 0.803904
[455]	valid's multi_logloss: 0.802888
[456]	valid's multi_logloss: 0.803572
[457]	valid's multi_logloss: 0.804306
[458]	valid's multi_logloss: 0.803261
[459]	valid's multi_logloss: 0.802219
[460]	valid's multi_logloss: 0.802847
[461]	valid's multi_logloss: 0.801828
[462]	valid's multi_logloss: 0.80252
[463]	valid's multi_logloss: 0.803215
[464]	valid's multi_logloss: 0.802047
[465]	valid's multi_logloss: 0.800853
[466]	valid's multi_logloss: 0.801545
[467]	valid's multi_logloss: 0.800348
[468]	valid's multi_logloss: 0.800973
[469]	valid's multi_logloss: 0.799923
[470]	valid's multi_logloss: 0.800602
[471]	valid's multi_logloss: 0.799944
[472]	valid's multi_logloss: 0.800582
[473]	valid's multi_logloss: 0.799608
[474]	valid's multi_logloss: 0.79863
[475]	valid's multi_logloss: 0.797681
[476]	valid's multi_logloss: 0.798273
[477]	valid's multi_logloss: 0.797244
[478]	valid's multi_logloss: 0.797924
[479]	valid's multi_logloss: 0.798584
[480]	valid's multi_logloss: 0.797687
[481]	valid's multi_logloss: 0.796787
[482]	valid's multi_logloss: 0.795615
[483]	valid's multi_logloss: 0.794772
[484]	valid's multi_logloss: 0.79382
[485]	valid's multi_logloss: 0.794433
[486]	valid's multi_logloss: 0.793352
[487]	valid's multi_logloss: 0.79233
[488]	valid's multi_logloss: 0.791317
[489]	valid's multi_logloss: 0.790411
[490]	valid's multi_logloss: 0.791065
[491]	valid's multi_logloss: 0.791682
[492]	valid's multi_logloss: 0.792287
[493]	valid's multi_logloss: 0.792894
[494]	valid's multi_logloss: 0.791816
[495]	valid's multi_logloss: 0.790728
[496]	valid's multi_logloss: 0.789754
[497]	valid's multi_logloss: 0.788894
[498]	valid's multi_logloss: 0.78761
[499]	valid's multi_logloss: 0.788186
[500]	valid's multi_logloss: 0.787325
[501]	valid's multi_logloss: 0.787946
[502]	valid's multi_logloss: 0.786951
[503]	valid's multi_logloss: 0.78601
[504]	valid's multi_logloss: 0.786632
[505]	valid's multi_logloss: 0.787186
[506]	valid's multi_logloss: 0.786225
[507]	valid's multi_logloss: 0.78557
[508]	valid's multi_logloss: 0.784792
[509]	valid's multi_logloss: 0.784122
[510]	valid's multi_logloss: 0.783409
[511]	valid's multi_logloss: 0.784031
[512]	valid's multi_logloss: 0.78314
[513]	valid's multi_logloss: 0.782181
[514]	valid's multi_logloss: 0.78128
[515]	valid's multi_logloss: 0.780307
[516]	valid's multi_logloss: 0.780875
[517]	valid's multi_logloss: 0.781459
[518]	valid's multi_logloss: 0.781937
[519]	valid's multi_logloss: 0.782542
[520]	valid's multi_logloss: 0.781751
[521]	valid's multi_logloss: 0.780891
[522]	valid's multi_logloss: 0.781484
[523]	valid's multi_logloss: 0.782086
[524]	valid's multi_logloss: 0.782689
[525]	valid's multi_logloss: 0.783259
[526]	valid's multi_logloss: 0.78235
[527]	valid's multi_logloss: 0.782919
[528]	valid's multi_logloss: 0.78192
[529]	valid's multi_logloss: 0.781153
[530]	valid's multi_logloss: 0.780207
[531]	valid's multi_logloss: 0.78076
[532]	valid's multi_logloss: 0.779731
[533]	valid's multi_logloss: 0.780298
[534]	valid's multi_logloss: 0.779378
[535]	valid's multi_logloss: 0.778616
[536]	valid's multi_logloss: 0.779097
[537]	valid's multi_logloss: 0.778432
[538]	valid's multi_logloss: 0.777475
[539]	valid's multi_logloss: 0.778101
[540]	valid's multi_logloss: 0.77871
[541]	valid's multi_logloss: 0.779286
[542]	valid's multi_logloss: 0.778391
[543]	valid's multi_logloss: 0.779009
[544]	valid's multi_logloss: 0.779582
[545]	valid's multi_logloss: 0.778475
[546]	valid's multi_logloss: 0.777679
[547]	valid's multi_logloss: 0.776781
[548]	valid's multi_logloss: 0.77599
[549]	valid's multi_logloss: 0.776533
[550]	valid's multi_logloss: 0.775651
[551]	valid's multi_logloss: 0.774841
[552]	valid's multi_logloss: 0.773926
[553]	valid's multi_logloss: 0.774589
[554]	valid's multi_logloss: 0.775091
[555]	valid's multi_logloss: 0.774154
[556]	valid's multi_logloss: 0.774724
[557]	valid's multi_logloss: 0.775281
[558]	valid's multi_logloss: 0.774361
[559]	valid's multi_logloss: 0.773656
[560]	valid's multi_logloss: 0.772762
[561]	valid's multi_logloss: 0.773326
[562]	valid's multi_logloss: 0.77384
[563]	valid's multi_logloss: 0.774344
[564]	valid's multi_logloss: 0.774947
[565]	valid's multi_logloss: 0.774111
[566]	valid's multi_logloss: 0.773273
[567]	valid's multi_logloss: 0.772568
[568]	valid's multi_logloss: 0.773053
[569]	valid's multi_logloss: 0.773624
[570]	valid's multi_logloss: 0.774123
[571]	valid's multi_logloss: 0.773326
[572]	valid's multi_logloss: 0.772553
[573]	valid's multi_logloss: 0.773042
[574]	valid's multi_logloss: 0.7736
[575]	valid's multi_logloss: 0.772694
[576]	valid's multi_logloss: 0.773281
[577]	valid's multi_logloss: 0.773805
[578]	valid's multi_logloss: 0.774359
[579]	valid's multi_logloss: 0.774861
[580]	valid's multi_logloss: 0.775399
[581]	valid's multi_logloss: 0.77445
[582]	valid's multi_logloss: 0.774949
[583]	valid's multi_logloss: 0.77423
[584]	valid's multi_logloss: 0.774743
[585]	valid's multi_logloss: 0.774032
[586]	valid's multi_logloss: 0.774485
[587]	valid's multi_logloss: 0.773653
[588]	valid's multi_logloss: 0.774182
[589]	valid's multi_logloss: 0.774746
[590]	valid's multi_logloss: 0.775186
[591]	valid's multi_logloss: 0.775754
[592]	valid's multi_logloss: 0.776283
[593]	valid's multi_logloss: 0.775532
[594]	valid's multi_logloss: 0.77604
[595]	valid's multi_logloss: 0.77652
[596]	valid's multi_logloss: 0.775785
[597]	valid's multi_logloss: 0.776298
[598]	valid's multi_logloss: 0.776816
[599]	valid's multi_logloss: 0.776045
[600]	valid's multi_logloss: 0.774981
In [18]:
model_lgbm.best_score
Out[18]:
defaultdict(dict, {'valid': {'multi_logloss': 0.7749809311982349}})
In [49]:
model_knn = KNeighborsClassifier(n_neighbors=7)
model_rfc = RandomForestClassifier()
model_gnb = GaussianNB()
model_knn
Out[49]:
KNeighborsClassifier(n_neighbors=7)
In [50]:
model_knn.fit(X_train_scaled[:5000], y_train2[:5000])
model_rfc.fit(X_train, y)
model_gnb.fit(X_train, y_train)
Out[50]:
GaussianNB()
In [21]:
scoring = {'Accuracy': make_scorer(accuracy_score), 'F1': make_scorer(f1_score, 
               average='weighted')}
cv=10
scores = cross_validate(clf, X_train_scaled, y_train2, cv=cv, scoring=scoring, return_estimator=True)
In [22]:
print(scores['test_F1'])
print(np.mean(scores['test_F1']))
print(scores['test_Accuracy'])
print(np.mean(scores['test_Accuracy']))
[0.83627797 0.80732799 0.82128755 0.81796782 0.81345598 0.81100868
 0.83987268 0.81530875 0.82425385 0.79512613]
0.8181887404196218
[0.83714286 0.80571429 0.82142857 0.81714286 0.81285714 0.81142857
 0.84142857 0.81714286 0.82428571 0.79714286]
0.8185714285714285
In [22]:

In [23]:
#grid.fit(X_train2, y_train2)
In [24]:
#grid.best_estimator_.get_params()
In [25]:
history = model1.fit(X_train2[0:5000], 
                    y_train2[0:5000], 
                    batch_size=100, 
                    epochs=100,
                    validation_data=(X_train2[5000:], y_train2[5000:]),
 #                   callbacks=[callback]
                    )
Epoch 1/100
50/50 [==============================] - 1s 7ms/step - loss: 1.1500 - sparse_categorical_accuracy: 0.3744 - val_loss: 1.0537 - val_sparse_categorical_accuracy: 0.4320
Epoch 2/100
50/50 [==============================] - 0s 4ms/step - loss: 1.0090 - sparse_categorical_accuracy: 0.4618 - val_loss: 0.9617 - val_sparse_categorical_accuracy: 0.4935
Epoch 3/100
50/50 [==============================] - 0s 4ms/step - loss: 0.9261 - sparse_categorical_accuracy: 0.4844 - val_loss: 0.8846 - val_sparse_categorical_accuracy: 0.5125
Epoch 4/100
50/50 [==============================] - 0s 4ms/step - loss: 0.8547 - sparse_categorical_accuracy: 0.5232 - val_loss: 0.8146 - val_sparse_categorical_accuracy: 0.6085
Epoch 5/100
50/50 [==============================] - 0s 3ms/step - loss: 0.7877 - sparse_categorical_accuracy: 0.6460 - val_loss: 0.7815 - val_sparse_categorical_accuracy: 0.6525
Epoch 6/100
50/50 [==============================] - 0s 4ms/step - loss: 0.7310 - sparse_categorical_accuracy: 0.6700 - val_loss: 0.7284 - val_sparse_categorical_accuracy: 0.6715
Epoch 7/100
50/50 [==============================] - 0s 3ms/step - loss: 0.6863 - sparse_categorical_accuracy: 0.6914 - val_loss: 0.6906 - val_sparse_categorical_accuracy: 0.6800
Epoch 8/100
50/50 [==============================] - 0s 4ms/step - loss: 0.6433 - sparse_categorical_accuracy: 0.7128 - val_loss: 0.6561 - val_sparse_categorical_accuracy: 0.7155
Epoch 9/100
50/50 [==============================] - 0s 4ms/step - loss: 0.6188 - sparse_categorical_accuracy: 0.7236 - val_loss: 0.6234 - val_sparse_categorical_accuracy: 0.7295
Epoch 10/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5955 - sparse_categorical_accuracy: 0.7354 - val_loss: 0.5971 - val_sparse_categorical_accuracy: 0.7425
Epoch 11/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5718 - sparse_categorical_accuracy: 0.7464 - val_loss: 0.6016 - val_sparse_categorical_accuracy: 0.7275
Epoch 12/100
50/50 [==============================] - 0s 3ms/step - loss: 0.5674 - sparse_categorical_accuracy: 0.7518 - val_loss: 0.6740 - val_sparse_categorical_accuracy: 0.6960
Epoch 13/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5503 - sparse_categorical_accuracy: 0.7586 - val_loss: 0.5734 - val_sparse_categorical_accuracy: 0.7495
Epoch 14/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5455 - sparse_categorical_accuracy: 0.7644 - val_loss: 0.5648 - val_sparse_categorical_accuracy: 0.7535
Epoch 15/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5337 - sparse_categorical_accuracy: 0.7628 - val_loss: 0.5579 - val_sparse_categorical_accuracy: 0.7600
Epoch 16/100
50/50 [==============================] - 0s 3ms/step - loss: 0.5342 - sparse_categorical_accuracy: 0.7646 - val_loss: 0.6044 - val_sparse_categorical_accuracy: 0.7255
Epoch 17/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5225 - sparse_categorical_accuracy: 0.7758 - val_loss: 0.5707 - val_sparse_categorical_accuracy: 0.7510
Epoch 18/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5212 - sparse_categorical_accuracy: 0.7706 - val_loss: 0.6001 - val_sparse_categorical_accuracy: 0.7425
Epoch 19/100
50/50 [==============================] - 0s 3ms/step - loss: 0.5130 - sparse_categorical_accuracy: 0.7784 - val_loss: 0.5469 - val_sparse_categorical_accuracy: 0.7655
Epoch 20/100
50/50 [==============================] - 0s 3ms/step - loss: 0.5050 - sparse_categorical_accuracy: 0.7800 - val_loss: 0.5752 - val_sparse_categorical_accuracy: 0.7530
Epoch 21/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4989 - sparse_categorical_accuracy: 0.7872 - val_loss: 0.8525 - val_sparse_categorical_accuracy: 0.6445
Epoch 22/100
50/50 [==============================] - 0s 4ms/step - loss: 0.5016 - sparse_categorical_accuracy: 0.7844 - val_loss: 0.6151 - val_sparse_categorical_accuracy: 0.7220
Epoch 23/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4959 - sparse_categorical_accuracy: 0.7868 - val_loss: 0.5705 - val_sparse_categorical_accuracy: 0.7505
Epoch 24/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4928 - sparse_categorical_accuracy: 0.7880 - val_loss: 0.5708 - val_sparse_categorical_accuracy: 0.7390
Epoch 25/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4819 - sparse_categorical_accuracy: 0.7950 - val_loss: 0.5346 - val_sparse_categorical_accuracy: 0.7750
Epoch 26/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4907 - sparse_categorical_accuracy: 0.7900 - val_loss: 0.5350 - val_sparse_categorical_accuracy: 0.7680
Epoch 27/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4745 - sparse_categorical_accuracy: 0.8012 - val_loss: 0.5370 - val_sparse_categorical_accuracy: 0.7710
Epoch 28/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4743 - sparse_categorical_accuracy: 0.7946 - val_loss: 0.5737 - val_sparse_categorical_accuracy: 0.7505
Epoch 29/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4792 - sparse_categorical_accuracy: 0.7938 - val_loss: 0.5275 - val_sparse_categorical_accuracy: 0.7760
Epoch 30/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4703 - sparse_categorical_accuracy: 0.8022 - val_loss: 0.5519 - val_sparse_categorical_accuracy: 0.7570
Epoch 31/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4789 - sparse_categorical_accuracy: 0.7978 - val_loss: 0.5327 - val_sparse_categorical_accuracy: 0.7715
Epoch 32/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4630 - sparse_categorical_accuracy: 0.8034 - val_loss: 0.5611 - val_sparse_categorical_accuracy: 0.7640
Epoch 33/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4655 - sparse_categorical_accuracy: 0.8006 - val_loss: 0.5805 - val_sparse_categorical_accuracy: 0.7500
Epoch 34/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4640 - sparse_categorical_accuracy: 0.8034 - val_loss: 0.5458 - val_sparse_categorical_accuracy: 0.7655
Epoch 35/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4534 - sparse_categorical_accuracy: 0.8074 - val_loss: 0.5426 - val_sparse_categorical_accuracy: 0.7750
Epoch 36/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4580 - sparse_categorical_accuracy: 0.8022 - val_loss: 0.6252 - val_sparse_categorical_accuracy: 0.7215
Epoch 37/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4572 - sparse_categorical_accuracy: 0.8034 - val_loss: 0.5400 - val_sparse_categorical_accuracy: 0.7630
Epoch 38/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4498 - sparse_categorical_accuracy: 0.8068 - val_loss: 0.5367 - val_sparse_categorical_accuracy: 0.7675
Epoch 39/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4520 - sparse_categorical_accuracy: 0.8074 - val_loss: 0.5253 - val_sparse_categorical_accuracy: 0.7845
Epoch 40/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4479 - sparse_categorical_accuracy: 0.8070 - val_loss: 0.5182 - val_sparse_categorical_accuracy: 0.7825
Epoch 41/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4393 - sparse_categorical_accuracy: 0.8094 - val_loss: 0.5238 - val_sparse_categorical_accuracy: 0.7770
Epoch 42/100
50/50 [==============================] - 0s 5ms/step - loss: 0.4505 - sparse_categorical_accuracy: 0.8050 - val_loss: 0.6063 - val_sparse_categorical_accuracy: 0.7495
Epoch 43/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4399 - sparse_categorical_accuracy: 0.8114 - val_loss: 0.5481 - val_sparse_categorical_accuracy: 0.7685
Epoch 44/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4362 - sparse_categorical_accuracy: 0.8166 - val_loss: 0.5189 - val_sparse_categorical_accuracy: 0.7785
Epoch 45/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4438 - sparse_categorical_accuracy: 0.8078 - val_loss: 0.5212 - val_sparse_categorical_accuracy: 0.7835
Epoch 46/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4370 - sparse_categorical_accuracy: 0.8132 - val_loss: 0.5195 - val_sparse_categorical_accuracy: 0.7845
Epoch 47/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4335 - sparse_categorical_accuracy: 0.8182 - val_loss: 0.5188 - val_sparse_categorical_accuracy: 0.7880
Epoch 48/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4354 - sparse_categorical_accuracy: 0.8108 - val_loss: 0.5258 - val_sparse_categorical_accuracy: 0.7765
Epoch 49/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4224 - sparse_categorical_accuracy: 0.8238 - val_loss: 0.5396 - val_sparse_categorical_accuracy: 0.7785
Epoch 50/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4249 - sparse_categorical_accuracy: 0.8218 - val_loss: 0.5192 - val_sparse_categorical_accuracy: 0.7865
Epoch 51/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4297 - sparse_categorical_accuracy: 0.8182 - val_loss: 0.5310 - val_sparse_categorical_accuracy: 0.7765
Epoch 52/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4296 - sparse_categorical_accuracy: 0.8234 - val_loss: 0.6036 - val_sparse_categorical_accuracy: 0.7435
Epoch 53/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4216 - sparse_categorical_accuracy: 0.8238 - val_loss: 0.5246 - val_sparse_categorical_accuracy: 0.7795
Epoch 54/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4299 - sparse_categorical_accuracy: 0.8148 - val_loss: 0.5466 - val_sparse_categorical_accuracy: 0.7695
Epoch 55/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4210 - sparse_categorical_accuracy: 0.8196 - val_loss: 0.5221 - val_sparse_categorical_accuracy: 0.7775
Epoch 56/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4184 - sparse_categorical_accuracy: 0.8280 - val_loss: 0.6047 - val_sparse_categorical_accuracy: 0.7375
Epoch 57/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4232 - sparse_categorical_accuracy: 0.8242 - val_loss: 0.5442 - val_sparse_categorical_accuracy: 0.7665
Epoch 58/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4144 - sparse_categorical_accuracy: 0.8256 - val_loss: 0.5371 - val_sparse_categorical_accuracy: 0.7740
Epoch 59/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4146 - sparse_categorical_accuracy: 0.8170 - val_loss: 0.5387 - val_sparse_categorical_accuracy: 0.7765
Epoch 60/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4161 - sparse_categorical_accuracy: 0.8208 - val_loss: 0.5177 - val_sparse_categorical_accuracy: 0.7800
Epoch 61/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4136 - sparse_categorical_accuracy: 0.8254 - val_loss: 0.5629 - val_sparse_categorical_accuracy: 0.7605
Epoch 62/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4161 - sparse_categorical_accuracy: 0.8252 - val_loss: 0.5176 - val_sparse_categorical_accuracy: 0.7895
Epoch 63/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4109 - sparse_categorical_accuracy: 0.8282 - val_loss: 0.5410 - val_sparse_categorical_accuracy: 0.7705
Epoch 64/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4174 - sparse_categorical_accuracy: 0.8258 - val_loss: 0.5830 - val_sparse_categorical_accuracy: 0.7505
Epoch 65/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4150 - sparse_categorical_accuracy: 0.8260 - val_loss: 0.5169 - val_sparse_categorical_accuracy: 0.7835
Epoch 66/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4098 - sparse_categorical_accuracy: 0.8270 - val_loss: 0.5322 - val_sparse_categorical_accuracy: 0.7830
Epoch 67/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4047 - sparse_categorical_accuracy: 0.8324 - val_loss: 0.5238 - val_sparse_categorical_accuracy: 0.7785
Epoch 68/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4021 - sparse_categorical_accuracy: 0.8320 - val_loss: 0.5264 - val_sparse_categorical_accuracy: 0.7790
Epoch 69/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4064 - sparse_categorical_accuracy: 0.8314 - val_loss: 0.5438 - val_sparse_categorical_accuracy: 0.7690
Epoch 70/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4028 - sparse_categorical_accuracy: 0.8304 - val_loss: 0.5273 - val_sparse_categorical_accuracy: 0.7800
Epoch 71/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4038 - sparse_categorical_accuracy: 0.8328 - val_loss: 0.5413 - val_sparse_categorical_accuracy: 0.7785
Epoch 72/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3982 - sparse_categorical_accuracy: 0.8318 - val_loss: 0.5792 - val_sparse_categorical_accuracy: 0.7575
Epoch 73/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4019 - sparse_categorical_accuracy: 0.8302 - val_loss: 0.5429 - val_sparse_categorical_accuracy: 0.7810
Epoch 74/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3953 - sparse_categorical_accuracy: 0.8304 - val_loss: 0.5409 - val_sparse_categorical_accuracy: 0.7745
Epoch 75/100
50/50 [==============================] - 0s 3ms/step - loss: 0.4088 - sparse_categorical_accuracy: 0.8246 - val_loss: 0.5462 - val_sparse_categorical_accuracy: 0.7800
Epoch 76/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3924 - sparse_categorical_accuracy: 0.8338 - val_loss: 0.5275 - val_sparse_categorical_accuracy: 0.7830
Epoch 77/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3992 - sparse_categorical_accuracy: 0.8314 - val_loss: 0.5421 - val_sparse_categorical_accuracy: 0.7800
Epoch 78/100
50/50 [==============================] - 0s 4ms/step - loss: 0.4010 - sparse_categorical_accuracy: 0.8292 - val_loss: 0.5312 - val_sparse_categorical_accuracy: 0.7770
Epoch 79/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3985 - sparse_categorical_accuracy: 0.8280 - val_loss: 0.5317 - val_sparse_categorical_accuracy: 0.7775
Epoch 80/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3981 - sparse_categorical_accuracy: 0.8312 - val_loss: 0.5404 - val_sparse_categorical_accuracy: 0.7715
Epoch 81/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3959 - sparse_categorical_accuracy: 0.8316 - val_loss: 0.5867 - val_sparse_categorical_accuracy: 0.7720
Epoch 82/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3896 - sparse_categorical_accuracy: 0.8338 - val_loss: 0.5368 - val_sparse_categorical_accuracy: 0.7785
Epoch 83/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3971 - sparse_categorical_accuracy: 0.8342 - val_loss: 0.5130 - val_sparse_categorical_accuracy: 0.7865
Epoch 84/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3916 - sparse_categorical_accuracy: 0.8376 - val_loss: 0.5127 - val_sparse_categorical_accuracy: 0.7885
Epoch 85/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3919 - sparse_categorical_accuracy: 0.8320 - val_loss: 0.5377 - val_sparse_categorical_accuracy: 0.7755
Epoch 86/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3903 - sparse_categorical_accuracy: 0.8376 - val_loss: 0.5523 - val_sparse_categorical_accuracy: 0.7690
Epoch 87/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3828 - sparse_categorical_accuracy: 0.8420 - val_loss: 0.5455 - val_sparse_categorical_accuracy: 0.7625
Epoch 88/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3969 - sparse_categorical_accuracy: 0.8344 - val_loss: 0.5218 - val_sparse_categorical_accuracy: 0.7860
Epoch 89/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3868 - sparse_categorical_accuracy: 0.8418 - val_loss: 0.5136 - val_sparse_categorical_accuracy: 0.7875
Epoch 90/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3846 - sparse_categorical_accuracy: 0.8384 - val_loss: 0.5490 - val_sparse_categorical_accuracy: 0.7675
Epoch 91/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3837 - sparse_categorical_accuracy: 0.8384 - val_loss: 0.5211 - val_sparse_categorical_accuracy: 0.7845
Epoch 92/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3792 - sparse_categorical_accuracy: 0.8440 - val_loss: 0.5597 - val_sparse_categorical_accuracy: 0.7750
Epoch 93/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3803 - sparse_categorical_accuracy: 0.8406 - val_loss: 0.5767 - val_sparse_categorical_accuracy: 0.7745
Epoch 94/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3849 - sparse_categorical_accuracy: 0.8382 - val_loss: 0.5976 - val_sparse_categorical_accuracy: 0.7720
Epoch 95/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3796 - sparse_categorical_accuracy: 0.8412 - val_loss: 0.5417 - val_sparse_categorical_accuracy: 0.7830
Epoch 96/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3882 - sparse_categorical_accuracy: 0.8362 - val_loss: 0.5164 - val_sparse_categorical_accuracy: 0.7840
Epoch 97/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3782 - sparse_categorical_accuracy: 0.8464 - val_loss: 0.5861 - val_sparse_categorical_accuracy: 0.7665
Epoch 98/100
50/50 [==============================] - 0s 4ms/step - loss: 0.3810 - sparse_categorical_accuracy: 0.8384 - val_loss: 0.6040 - val_sparse_categorical_accuracy: 0.7490
Epoch 99/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3815 - sparse_categorical_accuracy: 0.8420 - val_loss: 0.5427 - val_sparse_categorical_accuracy: 0.7730
Epoch 100/100
50/50 [==============================] - 0s 3ms/step - loss: 0.3777 - sparse_categorical_accuracy: 0.8406 - val_loss: 0.5684 - val_sparse_categorical_accuracy: 0.7740
In [26]:
# Start TensorBoard
#%reload_ext tensorboard
#%tensorboard --logdir="/content/gdrive/My Drive"

Testing the Model

Here, we will be evaluator our model using validation set

In [51]:
y_pred_knn = model_knn.predict(X_train_scaled[5000:])
y_pred_rfc = model_rfc.predict(X_val)
y_pred_gnb = model_gnb.predict(X_val)
y_pred_gnb = int_to_label(y_pred_gnb)
y_pred_lgbm = model_lgbm.predict(X_val)
y_pred_lgbm = int_to_label(np.argmax(y_pred_lgbm, axis=1))
y_pred_mlp = model1.predict(X_val)
y_pred_mlp = int_to_label(np.argmax(y_pred_mlp, axis=1))
y_pred_pos = ['positive'] * len(y_pred_rfc)
y_pred_neu = ['neutral'] * len(y_pred_rfc)
y_pred_neg = ['negative'] * len(y_pred_rfc)
In [ ]:
y_pred_lgbm.shape
In [52]:
print("KNeighborsClassifier")
print(f"F1 Score : {f1_score(y_train2[5000:], y_pred_knn, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_train2[5000:], y_pred_knn)}")

print("\nRandomForestClassifier")
print(f"F1 Score : {f1_score(y_val, y_pred_rfc, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_rfc)}")

print("\nGaussian Naive Bayes")
print(f"F1 Score : {f1_score(y_val, y_pred_gnb, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_rfc)}")

print("\nLightGBM")
print(f"F1 Score : {f1_score(y_val, y_pred_lgbm, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_lgbm)}")

print("\nSVC")
print(f"F1 Score : {np.mean(scores['test_F1'])} (mean)  {scores['test_F1']}")
print(f"Accuracy Score : {np.mean(scores['test_Accuracy'])} (mean)  {scores['test_Accuracy']}")

print("\nMLP")
print(f"F1 Score : {f1_score(y_val, y_pred_mlp, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_mlp)}")

print("\nOnly positive")
print(f"F1 Score : {f1_score(y_val, y_pred_pos, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_pos)}")

print("\nOnly neutral")
print(f"F1 Score : {f1_score(y_val, y_pred_neu, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_neu)}")

print("\nOnly negative")
print(f"F1 Score : {f1_score(y_val, y_pred_neg, average='weighted')}")
print(f"Accuracy Score : {accuracy_score(y_val, y_pred_neg)}")
KNeighborsClassifier
F1 Score : 0.6142914731017637
Accuracy Score : 0.6195

RandomForestClassifier
F1 Score : 0.6716998673575035
Accuracy Score : 0.675

Gaussian Naive Bayes
F1 Score : 0.6098698971860746
Accuracy Score : 0.675

LightGBM
F1 Score : 0.6896053741392523
Accuracy Score : 0.698

SVC
F1 Score : 0.8181887404196218 (mean)  [0.83627797 0.80732799 0.82128755 0.81796782 0.81345598 0.81100868
 0.83987268 0.81530875 0.82425385 0.79512613]
Accuracy Score : 0.8185714285714285 (mean)  [0.83714286 0.80571429 0.82142857 0.81714286 0.81285714 0.81142857
 0.84142857 0.81714286 0.82428571 0.79714286]

MLP
F1 Score : 0.8075736049375514
Accuracy Score : 0.8095

Only positive
F1 Score : 0.19381334800146682
Accuracy Score : 0.3635

Only neutral
F1 Score : 0.1521796429927839
Accuracy Score : 0.3165

Only negative
F1 Score : 0.15515151515151515
Accuracy Score : 0.32

Generating the Predictions

Generating Predictions from test data to make submission in the puzzle.

In [53]:
def mean_to_label(y):
  y_res = np.zeros(y.shape).astype("U", copy=False)
  for i in range(0,len(y)):
    if y[i] >= 1.4:
      y_res[i] = 'positive'
    elif y[i] <= 0.6:
      y_res[i] = 'negative'
    elif y[i] < 1.4 or y[i] > 0.6:
      y_res[i] = 'neutral'
    else:
      print("ERROR")
  return y_res

def preds_to_label(y):
  y = np.array(y)
  print(y.shape)
  y_res = np.zeros(y.shape[1])
  for i in range(0,y_res.shape[0]):
    values, counts = np.unique(y[:,i], return_counts=True)
    winner = np.argwhere(counts == np.amax(counts))
    if len(winner) == 1:
      y_res[i] = int(values[np.argmax(counts)])
    else:
      y_res[i] = 1
      print(int(values[np.argmax(counts)]))
  y_res = int_to_label(y_res)
  return y_res
In [187]:
submission_embeddings = [literal_eval(embedding)  for embedding in submission['embeddings'].values]

X_test_kbest = scaler.transform(submission_embeddings)     # Transforming the test split
prediction_list = []
estimator_index_list = [ 5, 6, 7, 8, 9]
for i in estimator_index_list:
  estimator = scores['estimator'][i]
  prediction_list.append(estimator.predict(X_test_kbest))
predictions = np.mean(prediction_list, axis = 0)
##predictions = scores['estimator'][2].predict(X_test_kbest)
rounded = np.round(predictions)
predictions = int_to_label(rounded)
#predictions = preds_to_label(prediction_list)
predictions.shape
Out[187]:
(3001,)
In [188]:
submission['label'] = predictions
print(predictions[0:100])
submission
['neutral' 'neutral' 'neutral' 'negative' 'negative' 'positive' 'positive'
 'positive' 'negative' 'positive' 'positive' 'negative' 'neutral'
 'neutral' 'positive' 'negative' 'neutral' 'positive' 'positive'
 'negative' 'neutral' 'positive' 'positive' 'negative' 'neutral'
 'negative' 'positive' 'positive' 'neutral' 'negative' 'positive'
 'positive' 'positive' 'negative' 'negative' 'neutral' 'neutral' 'neutral'
 'negative' 'negative' 'negative' 'negative' 'neutral' 'positive'
 'positive' 'neutral' 'positive' 'negative' 'negative' 'negative'
 'neutral' 'neutral' 'neutral' 'positive' 'negative' 'negative' 'neutral'
 'positive' 'negative' 'neutral' 'neutral' 'positive' 'positive'
 'negative' 'positive' 'positive' 'positive' 'positive' 'negative'
 'negative' 'neutral' 'neutral' 'negative' 'neutral' 'positive' 'positive'
 'negative' 'negative' 'positive' 'neutral' 'neutral' 'neutral' 'neutral'
 'neutral' 'neutral' 'neutral' 'positive' 'positive' 'negative' 'neutral'
 'negative' 'positive' 'positive' 'positive' 'positive' 'negative'
 'positive' 'negative' 'neutral' 'negative']
Out[188]:
embeddings label
0 [0.08109518140554428, 0.3090009093284607, 1.36... neutral
1 [0.6809610724449158, 1.1909409761428833, 0.892... neutral
2 [0.14851869642734528, 0.7872061133384705, 0.89... neutral
3 [0.44697386026382446, 0.36429283022880554, 0.7... negative
4 [1.8009324073791504, 0.26081395149230957, 0.40... negative
... ... ...
2996 [0.9138844609260559, 0.9460961222648621, 0.571... negative
2997 [0.7667452096939087, 0.7896291613578796, 0.648... negative
2998 [0.8158280849456787, 2.404792070388794, 0.9924... neutral
2999 [0.4161085784435272, 0.3146701455116272, 1.139... positive
3000 [0.7037264108657837, 0.6421875357627869, 1.215... negative

3001 rows × 2 columns

In [189]:
from collections import Counter

values, counts = np.unique(y_train2, return_counts=True)
print(values)
print(counts)

values, counts = np.unique(predictions, return_counts=True)
print(values)
print(counts)
[0. 1. 2.]
[2262 2327 2411]
['negative' 'neutral' 'positive']
[1014  988  999]

Saving the Predictions

In [ ]:
# Saving the predictions
!rm -rf assets
!mkdir assets
submission.to_csv(os.path.join("assets", "submission.csv"))

Submitting our Predictions

In [ ]:
%aicrowd notebook submit -c sentiment-classification -a assets --no-verify

Congratulations to making your first submission in the puzzle 🎉 . Let's continue with the journey by improving the baseline & making submission! Don't be shy to ask question related to any errors you are getting or doubts in any part of this notebook in discussion forum or in AIcrowd Discord sever, AIcrew will be happy to help you :)

Have a cool new idea that you want to see in the next blitz ? Let us know!


Comments

You must login before you can post a comment.

Execute