# Simple good way to fit a 2D dataset consisting of positive and negative examples such that the function is monotonic in both dimensions

I have a set of positive and negative samples in 2D (x, y), and I would like to fit a curve f to this data set so that f(x, y_c) is increasing in x and f(x_c, y) is increasing in y. The function f(x, y) can be thought of as the probability that a new random sample from point (x, y) is positive. The function f can be arbitrary (I wouldn't assume that it's linear or logarithmic or even a fixed-degree polynomial), but it should be smooth. For example, one idea is to bucket the samples into rectangles, compute the probability of a positive sample from each bucket, and then deal with any violations to monotonicity. (This is a little simple; it might be preferable to incorporate the data from neighboring buckets in some way.)

Is there a standard technique for solving this problem?

-
 I have an idea how to approach this but please tell me first what x_c,y_c do represent. – steffen Dec 21 '11 at 8:14 I suppose that he means that the first derivative of f with respect to x and the first derivative of f with respect to y are positive. – mzuba Dec 21 '11 at 13:30 i.e. he has prior information that values in the first quadrant are most likely to be positive. – mzuba Dec 21 '11 at 13:38 @steffen, mzuba, yes, the partial derivatives with respect to both x and y are non-negative. – jonderry Dec 21 '11 at 22:42