I am given a dataset with features X and Y and need to learn to classify objects into 2 classes. The corresponding targets for the objects from the dataset are denoted as y:
Top left plot shows X vs Y scatter plot, produced with the following code:
# y is a target vector
plt.scatter(X, Y, c = y)
I use target variable y to colorcode the points.
The other three plots were produced by jittering X and Y values:
def jitter(data, stdev):
N = len(data)
return data + np.random.randn(N) * stdev
# sigma is a given std. dev. for Gaussian distribution
plt.scatter(jitter(X, sigma), jitter(Y, sigma), c = y)
That is, I add Gaussian noise to the features before drawing scatter plot.
I did that because I've read that some say that it is beneficial to jitter variables before building a scatter plot, or even a model. I don't understand why. To my mind,
target is completely determined by coordinates (x,y), i.e. the label of the point is completely determined by point's position (x,y). Saying the same in other words: if we only had two features (x,y), we could build a classifier, that would accurate 100% of time.
So I don't understand the point of jittering ...It is always beneficial to jitter variables before building a scatter plot? Is it beneficial for a model?