2. [Points 70] You are asked to predict weather temperature. You only know the linear regression...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
answer all questions as instructed below. make sure you have attended all questions .Comparative Architectures (a) Describe the organisation of a two-level branch predictor that makes use of a global...
-
Now apply one of those decision making models (Philosophical) to this scenario: Scenario: You are a CPA in the accounting department at a HealthCare System with three other accountants. You are good...
-
Describe the five forces in Porter's competitive forces model, and explain how the Internet has affected each one.
-
What legal issues do you see arising from this report?...
-
The plate shown in Fig. P5.56 is \(0.5 \mathrm{~m}\) wide perpendicular to the paper. Calculate the velocity of the water jet required to hold the plate upright. Figure P5.56 d = 10.0 cm 20C water...
-
The English Garden Shop is a retail store that sells garden equipment, furniture, and supplies. Its credit purchases and purchases returns and allowances for July are listed on the next page. The...
-
Two + 3 . 0 nC charges are 1 0 m from each other. What is the electric potential energy of this system of particles?
-
A male carries a recessive mutation on the X chromosome that causes hemophilia, a blood clotting disorder. He marries a female who is phenotypically normal, but whose father had hemophilia. Suppose...
-
Would the common law protect human rights in Ontario without the Human Rights Code? How do you know this to be true?
-
What reasons might a person have to forego this planning? What do the other surveys indicate about Americans' propensity to plan their estates? 2. Why does a minor child need a guardian? What types...
-
Assume Foxed costs are $10,000, Selling price is $30 and variable costs are $10. What is the break even in sales Dollars?
-
One point of emphasis for those who argue there WILL NOT BE enough physicians in the future is the expanded numbers of individuals with insurance coverage due to the Affordable Care Act.
-
How would you display online shopping data? Are there any modeling or performance variables that jump out at you when analyzing it?
-
The DTRA Tool Book has now been in operation for a few years. Imagine that you are assigned to head a special project to identify further improvements to provide procure-ment professionals with the...
-
Presented below are income statements prepared on a LIFO and FIFO basis for Kenseth Company, which started operations on January 1, 2024. The company presently uses the LIFO method of pricing its...
-
Active-Ingredients is a company supplying baking ingredients in major hypermarkets that are facing intense competition from many local and foreign brands. Active-Ingredients is thinking of using a...
-
Nan-Clean is a newly developed cleaning liquid for milk bottles that uses special enzymes to remove dirt effectively. Nan-Clean has been positioned as a product that is made of natural ingredients...
-
Why do sample surveys have predetermined margins of error?
Study smarter with the SolutionInn App