Created
          March 3, 2021 08:52 
        
      - 
      
- 
        Save PranjalDureja0002/38f80781fa9639415111db688503d2f6 to your computer and use it in GitHub Desktop. 
    model
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def find_best_threshold(threshold, fpr, tpr): | |
| t = threshold[np.argmax(tpr*(1-fpr))] | |
| print("the maximum value of tpr*(1-fpr)", max(tpr*(1-fpr)), "for threshold", np.round(t,3)) | |
| return t | |
| def predict_with_best_t(proba, threshold): | |
| predictions = [] | |
| for i in proba: | |
| if i>=threshold: | |
| predictions.append(1) | |
| else: | |
| predictions.append(0) | |
| return predictions | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment