learn a threshold from labels and discrimination values?
Sort the points, group them by value, and try all <=2n+1 thresholds that classify differently (<=n+1 gaps between distinct data values including the sentinels +-infinity and <=n distinct data values). The latter step is linear-time if you try thresholds lesser to greater and keep track of how many points are misclassified in each way.
I have a set of {(v_i, c_i), i=1,..., n}, where v_i in R and c_i in {-1, 0, 1} are the discrimination value  and  label of the i-th training example. 
I would like to learn a threshold t so that the training error is the minimum when I declare the i-th example has label -1 if v_i < t, 0 if v_i=t, and 1 if v_i>t.
How can I learn the threshold t from {(v_i, c_i), i=1,..., n}, and what is an efficient algorithm for that? 
I am implementing that in Python, although I also hope to know how to implement that in  R efficiently.
Thanks!
Btw, why SO doesn't support LaTeX for math expressions? (I changed them to be code instead).