Answers.Body: <p>I think you're looking for the minimization of <em>false positives</em>, that is, the instances that are classified as belonging to the desired class (the <em>positive</em> part of <em>false positives</em>) but that do not actually belong to that class (the <em>false</em> part of <em>false positives</em>). In practice, given your constraints, you may want to maximize the <a href="https://en.wikipedia.org/wiki/Precision_and_recall" rel="nofollow noreferrer">precision</a>, while maintaining a good <a href="https://scikit-learn.org/stable/auto_examples/model_selection/plot_precision_recall.html" rel="nofollow noreferrer">recall</a>.</p>
  
  <p>In <a href="https://stackoverflow.com/a/30000619/3924118">this answer</a> to the question <a href="https://stackoverflow.com/q/29994694/3924118">How can the model be tuned to improve precision, when precision is much more important than recall?</a>, the user suggests performing a grid search (using <a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html" rel="nofollow noreferrer"><code>sklearn.grid_search.GridSearchCV(clf, param_grid, scoring="precision")</code></a>) to find the parameters of the model that maximize the precision. See also the question <a href="https://stats.stackexchange.com/q/140266/82135">Classifier with adjustable precision vs recall</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-03T00:02:37.220Z
Answers.Text: Thanks! Some things already done.
  I have an opinion that basically algorithms try to separate both classes to the maximum.
  I don't have to do that, it's enough that as few false negatives as possible get into the desired class.
Answers.UserDisplayName: user287629
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-02T23:43:51.877Z
Answers.LastActivityDate: 2019-12-02T23:43:51.877Z
Answers.UserDisplayName: nbro
Body: <p>I have 50,000 samples. Of these 23,000 belong to the desired class <span class="math-container">$A$</span>. I can sacrifice the number of instances that are classified as belonging to the desired class <span class="math-container">$A$</span>. It will be enough for me to get 7000 instances in the desired class <span class="math-container">$A$</span>, provided that most of these instances classified as belonging to <span class="math-container">$A$</span> really belong to the desired class <span class="math-container">$A$</span>. How can I do this?</p>
  
  <p>The following is the confusion matrix in the case the instances are perfectly classified.</p>
  
  <pre><code>[[23000   0]
   [  0 27000]]
  </code></pre>
  
  <p>But it is unlikely to obtain this confusion matrix, so I'm quite satisfied with the following confusion matrix.</p>
  
  <pre><code>[[7000   16000]
   [  500 26500]]
  </code></pre>
  
  <p>I am currently using the <code>sklearn</code> library. I mainly use algorithms based on decision trees, as they are quite fast in the calculation.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-02T23:44:09.337Z
Comments.Text: Hi and welcome to this community! I've reformulated part of your post to make it clearer. Make sure I've not changed the intended meaning.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-02T23:50:36.667Z
Comments.Text: I have two classes. I'm only interested in the first one.
  As a rule the desired class is called positive.
  It is important to me that in the positive class got as 
  little as possible false negative labels that are predicted.
  I added two examples with a confusion matrix.
Comments.UserDisplayName: user287629
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-02T23:52:37.123Z
Comments.Text: That's what I thought. I've provided an answer below. I may edit it later to provide a complete example.
Comments.UserDisplayName: nbro
Tags: <machine-learning><classification><python>
Title: How can I minimise the false positives?
UserDisplayName: user287629
ThreadText: # How can I minimise the false positives?
  
  (Asked by: username_0 on 2019-12-02)
  
  I have 50,000 samples. Of these 23,000 belong to the desired class $A$. I can sacrifice the number of instances that are classified as belonging to the desired class $A$. It will be enough for me to get 7000 instances in the desired class $A$, provided that most of these instances classified as belonging to $A$ really belong to the desired class $A$. How can I do this?
  
  The following is the confusion matrix in the case the instances are perfectly classified.
  
  ```
  [[23000   0]
   [  0 27000]]
  
  ```
  
  But it is unlikely to obtain this confusion matrix, so I'm quite satisfied with the following confusion matrix.
  
  ```
  [[7000   16000]
   [  500 26500]]
  
  ```
  
  I am currently using the `sklearn` library. I mainly use algorithms based on decision trees, as they are quite fast in the calculation.
  
  **Tags:** machine-learning, classification, python
  
  > **Comments:**
  > **username_1**: Hi and welcome to this community! I've reformulated part of your post to make it clearer. Make sure I've not changed the intended meaning.  
  > **username_0**: I have two classes. I'm only interested in the first one. As a rule the desired class is called positive. It is important to me that in the positive class got as  little as possible false negative labels that are predicted. I added two examples with a confusion matrix.  
  > **username_1**: That's what I thought. I've provided an answer below. I may edit it later to provide a complete example.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-12-02. Score: 3 | Accepted answer
  
  I think you're looking for the minimization of *false positives*, that is, the instances that are classified as belonging to the desired class (the *positive* part of *false positives*) but that do not actually belong to that class (the *false* part of *false positives*). In practice, given your constraints, you may want to maximize the [precision](https://en.wikipedia.org/wiki/Precision_and_recall), while maintaining a good [recall](https://scikit-learn.org/stable/auto_examples/model_selection/plot_precision_recall.html).
  
  In [this answer](https://stackoverflow.com/a/30000619/3924118) to the question [How can the model be tuned to improve precision, when precision is much more important than recall?](https://stackoverflow.com/q/29994694/3924118), the user suggests performing a grid search (using [`sklearn.grid_search.GridSearchCV(clf, param_grid, scoring="precision")`](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html)) to find the parameters of the model that maximize the precision. See also the question [Classifier with adjustable precision vs recall](https://stats.stackexchange.com/q/140266/82135).
  
  > **Comments:**
  > **username_0**: Thanks! Some things already done. I have an opinion that basically algorithms try to separate both classes to the maximum. I don't have to do that, it's enough that as few false negatives as possible get into the desired class.  
  
  ---
  
  