title: How to find the best straight line separating two regions having points with 2 different properties
body: <p>I have a bunch of points in a 2D plot. The red points indicate when my experiment is stable, the black when it is unstable. The two region are clearly separated by a line in this log-log plot, and I would like to find the best "separating line", i.e. the line that gives the criterion to separate the 2 regions and has the minimum error on this criterion. I did a search on various books and online but I could not find any approach to solve this problem. Are you aware of any tool? First of all one has to define the error. One thing that comes in my mind is: if the unknown line is ax+by+c=0, for each point (x0,y0) we define an error function like the following:</p>
  
  <pre><code>E=0 if point lays on the correct side of the line.
  E= distance(a*x+b*y+c=0,(x0,y0)) = |a*x0+b*y0+c|/sqrt(a^2+b^2)   if the point
     lies on the wrong side.
  </code></pre>
  
  <p>and we minimize the sum of the errors. Not simple though since there is a threshold. 
  If you guys know about some reference or link of approaches that solve this problem that would be appreciated.
  Cheers
  A.</p>
  
  <p><img src="https://i.stack.imgur.com/rfcaO.jpg" alt="enter image description here"></p>