I'm trying to generate a sample of x's and their labels - y's, for binary classifier.
I know that my x's are uniformly distributed in [0,1]. But my y's distribution derived by my x's:
if x in [0.2, 0.4] or in [0.6, 0.8] - P[Y=1] = 0.1. If x is outside of these bounds then P[Y=1] = 0.8 .
I think that the best way to do that is by using NumPy (and not using for-loops and if-condition) but until now I didn't succeed.
This is my attempt:
s = np.random.uniform(0,1,100) # 100 x samples in [0,1] uniformly distributed
condition = (np.logical_or((s>0.2)&(s < 0.4), (s>0.6)&(s < 0.8))) # attempt to mark with True the places of x in bounds.
x_in_bounds = np.select(condlist, s) # this line doesn't work
... # how to generate the y values?
I am trying unsuccessfully to find a way to randomly generate the y values according to the conditions on the sample of the x values. I'd love to understand what I'm missing.