class SyntheticRegressionData(d2l.DataModule): #@save
“”“Synthetic data for linear regression.”""
def init(self, w, b, noise=0.01, num_train=1000, num_val=1000,
batch_size=32):
super().init()
self.save_hyperparameters()
n = num_train + num_val
self.X = torch.randn(n, len(w))
noise = torch.randn(n, 1) * noise
Sorry guys,I am thinking a lot about num_train=1000, num_val=1000, what does they mean?
self.X = torch.randn(n, len(w))
for me ,I think n would be 1000 instead of 2000, len(w) is 2,why not just put 2 because our goal is clear,and noise = torch.randn(n, 1) * noise as well, why it comes to 2000?
Thanks for help