I have this function to create a gaussian distribution for testing out some ML…
- User
I have this function to create a gaussian distribution for testing out some ML algorithms. However, I think this will create a new, random dataset every time it is called. Is there a way to make sure this always creates the same dataset? like when setting a random seed?
def create_gaussian_data(num_rows=5e4, num_features=3): zero_range = [.4, .6] one_range = [.6, .6] X = torch.zeros((int(num_rows), num_features))
for i in range(num_features): X1 = torch.normal(zero_range[0], zero_range[1], (int(num_rows / 2), 1)) X12 = torch.normal(one_range[0], one_range[1], (int(num_rows / 2), 1)) new_col = torch.cat((X1, X12), dim=0) X[:, i] = new_col.squeeze() Y_0 = torch.tensor([0] * int(num_rows / 2)) Y_1 = torch.tensor([1] * int(num_rows / 2)) Y = torch.cat((Y_0, Y_1), dim=0) # Adding some noise to make it less obvious but still linearly separable X_noise = torch.normal(.5, .5, (int(num_rows), 1)) X = torch.cat((X, X_noise), dim=1) return X, Y Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.