Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. [Points 70] You are asked to predict weather temperature. You only know the linear regression model and luckily the given samples can be
2. [Points 70] You are asked to predict weather temperature. You only know the linear regression model and luckily the given samples can be mapped using it. In your given dataset temperature value depends on both humidity and visibility. To execute the tasks, you are given skeleton codes. Write your own code by modifying, updating, inserting code as necessary to estimate a linear equation for the given datasets. Write your code using raw python code. You can use NumPy, pandas, etc. However, you are not allowed to use any high-level API (such as TensorFlow, PyTorch, Maxnet, etc.) 1. [Points 5] get_data () function returns the data and split it into training and test set. Write data_iter() function to create batch-wise data and return batches as needed during your training. 2. [Points 5] You are fitting these data samples using a linear equation. Write a function create_model_parameter(mu, sigma, row, column) to create the parameters and initialize values with normal random values. mu and sigma represent mean and standard deviation, respectively. 3. [Points 5] Write your code for the linear regression given as model() function in the skeleton code. 4. [Points 5] Compute loss function using squared_loss() function. 5. [Points 10] Compute gradient using gradient() function for each parameter of your model. 6. [Points 10] Update you model parameter using sgd() function 7. [Points 15] Write your train() function to execute your linear regression for all the samples given. 8. [Points 15] Draw a single figure for training loss vs number epochs for three different batch sizes. Write your own function by modifying draw_loss(). Please choose batch sizes as small, large, and just exact. Explain the effect of batch sizes on the training loss.
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