import torch
rng = torch.Generator().manual_seed(123)
X = torch.randn(1000, 1, generator=rng)
bias = torch.tensor([-1.5])
weights = torch.tensor([0.8])
pi = 1/(1 + torch.exp(-(X @ weights + bias))) # pi = sigmoid(X @ weights + bias)
y = torch.bernoulli(pi).squeeze() # binary labels sampled from Bernoulli distribution with probabilities given by pi