title: How to use calculated Threshold Value in Logistic Regression?
body: <p>I calculated best threshold value as 0.61 for the highest accuracy using below code in Python:</p>
  <pre><code># probability
  y_pred_prob = tv_lr.predict_proba(tv_x_test_vector)  
  
  # fpr, tpr, threshold
  fpr, tpr, threshold = roc_curve(y_test, y_pred_prob[:,1])
  
  # accuracy score for threshold
  accuracy_ls = []
  for thresh in threshold:
      y_pred = np.where(y_pred_prob[:,1]&gt;thresh, 1, 0)
      accuracy_ls.append(accuracy_score(y_test, y_pred))
  
  # Dataframe
  acc_thr_df = pd.concat([pd.Series(threshold), pd.Series(accuracy_ls)], axis=1, )
  acc_thr_df.columns = ['thresh', 'acc']
  acc_thr_df.sort_values(by='acc', ascending=False) # Chose the 1st value
  </code></pre>
  <p>When I use <code>tv_lr.predict(tv_x_test_vector)</code> It is using 0.5 as threshold.</p>
  <p>Please advise how to change the threshold value to 0.61? Is the code shown here correct to do this rather than using <code>tv_lr.predict(tv_x_test_vector)</code>?</p>
  <pre><code>y_pred = np.where(y_pred_prob[:,1]&gt;0.61, 1, 0)
  </code></pre>