I just want to indicate a different approach using a density estimate.
Given your data, it is easy to insert a smoothed pdf using kernel density estimation . The python code below shows how to use the kde module in scipy .
from scipy.stats.kde import gaussian_kde from numpy import linspace import matplotlib.pyplot as plt data1 = [385,515,975,1136,2394,2436,4051,4399,4484,4768,4768,4849,4856,4954,5020,5020,5020,5020,5020,5020,5020,5020,5020,5052,5163,5200,5271,5421,5421,5442,5746,5765,5903,5992,5992,6046,6122,6205,6208,6239,6310,6360,6416,6512,6536,6543,6581,6609,6696,6699,6752,6796,6806,6855,6859,6886,6906,6911,6923,6953,7016,7072,7086,7089,7110,7232,7278,7293,7304,7309,7348,7367,7378,7380,7419,7453,7454,7492,7506,7549,7563,7721,7723,7731,7745,7750,7751,7783,7791,7813,7813,7814,7818,7833,7863,7875,7886,7887,7902,7907,7935,7942,7942,7948,7973,7995,8002,8013,8013,8015,8024,8025,8030,8038,8041,8050,8056,8060,8064,8071,8081,8082,8085,8093,8124,8139,8142,8167,8179,8204,8214,8223,8225,8247,8248,8253,8258,8264,8265,8265,8269,8277,8278,8289,8300,8312,8314,8323,8328,8334,8363,8369,8390,8397,8399,8399,8401,8436,8442,8456,8457,8471,8474,8483,8503,8511,8516,8533,8560,8571,8575,8583,8592,8593,8626,8635,8635,8644,8659,8685,8695,8695,8702,8714,8715,8717,8729,8732,8740,8743,8750,8756,8772,8772,8778,8797,8828,8840,8840,8843,8856,8865,8874,8876,8878,8885,8887,8893,8896,8905,8910,8955,8970,8971,8991,8995,9014,9016,9042,9043,9063,9069,9104,9106,9107,9116,9131,9157,9227,9359,9471] data2 = [12,16,29,32,33,35,39,42,44,44,44,45,45,45,45,45,45,45,45,45,47,51,51,51,57,57,60,61,61,62,71,75,75,75,75,75,75,76,76,76,76,76,76,79,84,84,85,89,93,93,95,96,97,98,100,100,100,100,100,102,102,103,105,108,109,109,109,109,109,109,109,109,109,109,109,109,110,110,112,113,114,114,116,116,118,119,120,121,122,124,125,128,129,130,131,132,133,133,137,138,144,144,146,146,146,148,149,149,150,150,150,151,153,155,157,159,164,164,164,167,169,170,171,171,171,171,173,174,175,176,176,177,178,179,180,181,181,183,184,185,187,191,193,199,203,203,205,205,206,212,213,214,214,219,224,224,224,225,225,226,227,227,228,231,234,234,235,237,240,244,245,245,246,246,246,248,249,250,250,251,255,255,257,264,264,267,270,271,271,281,282,286,286,291,291,292,292,294,295,299,301,302,304,304,304,304,304,306,308,314,318,329,340,344,345,356,359,363,368,368,371,375,379,386,389,390,392,394,408,418,438,440,456,456,458,460,461,467,491,503,505,508,524,557,558,568,591,609,622,656,665,668,687,705,728,817,839,965,1013,1093,1126,1512,1935,2159,2384,2424,2426,2484,2738,2746,2751,3006,3184,3184,3184,3184,3184,4023,5842,5842,6502,7443,7781,8132,8237,8501] pdf1 = gaussian_kde(data1) pdf2 = gaussian_kde(data2) x = linspace(0, 9500, 1000) plt.plot(x, pdf1(x),'r') plt.plot(x, pdf2(x),'g') plt.legend(['data1 pdf', 'data2 pdf']) plt.show()

In the graph green is pdf for the second data set; red is the pdf for the first dataset. It is clear that the boundary of the solution is a vertical line passing through the point where green intersects red.
To find the border numerically, we can do something like below (suppose there is only one intersection, otherwise it does not make sense):
min_diff = 10000 min_diff_x = -1 for x in linspace(3600, 4000, 400): diff = abs(pdf1(x) - pdf2(x)) if diff < min_diff: min_diff = diff min_diff_x = x print min_diff, min_diff_x
We found that the border is located at approximately 3762.
If there are several intersections of two PDF files, in order to predict which class the data point x belongs to, we calculate pdf1(x) and pdf2(x) , the maximum is the class that minimizes the risk of bikes. See here for more information on Bayesian risk and an estimate of the probability of prediction errors.
The following is an example that actually includes three PDF files, at any point in the x query, we need to ask three PDF files separately and choose one with the maximum pdf(x) value as the predicted class.
