title: How to set a value for a specific threshold in SVC model and generate a confusion matrix?
body: <p>I need to set a value to a specific threshold and generate a confusion matrix. The data is in a csv file (11,1 MB), this link for download is: <a href="https://drive.google.com/file/d/1cQFp7HteaaL37CefsbMNuHqPzkINCVzs/view?usp=sharing" rel="noreferrer">https://drive.google.com/file/d/1cQFp7HteaaL37CefsbMNuHqPzkINCVzs/view?usp=sharing</a>?</p>
  
  <p>First, i received a error message: ""AttributeError: predict_proba is not available when  probability=False""
  So i used this for correction:</p>
  
  <pre><code>svc = SVC(C=1e9,gamma= 1e-07)
  scv_calibrated = CalibratedClassifierCV(svc)
  svc_model = scv_calibrated.fit(X_train, y_train) 
  </code></pre>
  
  <p>I saw a lot on the internet and I didn't quite understand how a specific threshold value is being persolanized. Sounds pretty hard.
  Now, i see a wrong output: </p>
  
  <pre><code>array([[   0,    0],
         [5359,   65]])
  </code></pre>
  
  <p>I have no idea whats is somenthing wrong. </p>
  
  <p>i need help and i'm new in that.
  thanks</p>
  
  <pre><code>from sklearn.model_selection import train_test_split
  
  df = pd.read_csv('fraud_data.csv')
  
  X = df.iloc[:,:-1]
  y = df.iloc[:,-1]
  
  X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
  
  
  
  def answer_four():
      from sklearn.metrics import confusion_matrix
      from sklearn.svm import SVC
      from sklearn.calibration import CalibratedClassifierCV
      from sklearn.model_selection import train_test_split
  
  
      svc = SVC(C=1e9,gamma= 1e-07)
      scv_calibrated = CalibratedClassifierCV(svc)
      svc_model = scv_calibrated.fit(X_train, y_train)
  
      # set threshold as -220
      y_pred = (svc_model.predict_proba(X_test)[:,1] &gt;= -220) 
  
      conf_matrix = confusion_matrix(y_pred, svc_model.predict(X_test))
  
      return conf_matrix
  answer_four()
  </code></pre>
  
  <p>This function should return a confusion matrix, a 2x2 numpy array with 4 integers.</p>