Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 Generating the Data Before we fit a model, we need data to fit it to . The data set will be a set of
Generating the Data
Before we fit a model, we need data to fit it to The data set will be a set of points of the form dots, where each inR. To generate the data points the following instructions lay out how to generate dots, and then based on that vector.
Note: In the following, I am using to indicate a random value sampled from a normal distribution with mean and variance In order to generate random values, you need to specify a distribution see CS and normal distributions are fairly standard functionality for RNG packages. I am performing a slight abuse of notation when I write expression but this should be interpreted as adding a small random bit of noise sampled from that distribution to the value of expression All noise terms should be taken as independent. These terms are present to represent noise or fluctuations in the measurements that you collect from the real world.
dots, are iid random values, with distribution
For dots,
Note: The way to interpret this is that, for example, a little bit of noise
For dots,
Example: a little bit of noise
For dots,
For dots,
For dots,
The output data will be generated in the following way. For any input the output is given by
Note that with this setup, none of the oddindexed components of 'explicitly' show up in the value of
Note: This specifies that the value of is based on via a little noise and that the 'true' weights are given by
dots,
Problem : Write a function that takes as input a number of data points and gives as output a data matrix as a PyTorch tensor, with rows and columns, where each row is an vector as above, as well as a PyTorch tensor with rows and column, where each entry of is the corresponding value for that row of
Some functions that may be useful:
torch.zeros
torch.randn
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started