Good day everyone! Id like to get a lot of diffrent results and see standard deviation. Here my code:
lr_score, lr_tune_params = auto_tune_lr_second(x_train, x_test, y_train, y_test)
print('Random state changing...')
for i in range(1, 151):
LR = LogisticRegression(C=lr_tune_params[0], max_iter=lr_tune_params[1], penalty=lr_tune_params[2], random_state=i)
LR.fit(x_train, y_train)
pred = LR.predict(x_test)
pr_money_lr.append(find_profit(confusion_matrix(y_test, pred)))
pr_money_lr = np.array(pr_money_lr)
lr_mean = pr_money_lr.mean()
lr_std = pr_money_lr.std()
print ([lr_mean - lr_std, lr_mean + lr_std])
where auto_tune_lr_second(x_train, x_test, y_train, y_test)
is the same thing as GridSearch(),
function find_profit(confusion_matrix(y_test, pred))
is hand-made metric for optimization which get confusion matrix and return some scalar result.
In every iteration i change random_state
but i get the same results(the same confusion matrix). I tried to set diffrent random_states
as a parameter in Logistic Regrassion
and tried to set diffrent numpy.random.seed()
. None of them worked. Do you have any ideas why i get the same results with diffrent random_states?