Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 Problem 3 Download the file salmon_data.csv included with the homework. Make sure this file is in the same folder as your homework file.

imageimage

3 Problem 3 Download the file salmon_data.csv included with the homework. Make sure this file is in the same folder as your homework file. This file contains the annual Chinook salmon counts taken at Bonneville on the Columbia river (in the second column) from the years 1938 to 2021 (in the first column) 2. In this problem, we will fit this data with a curve to predict salmon populations. (a) Load salmon_data.csv in your solution script. The data has two vectors: year is the year and salmon is the salmon count in the corresponding year. You do NOT need to upload this file to Gradescope. Your code will be tested using the counts for another species of salmon. Because of this, your code should not have any answers hard-coded in: your code needs to work for whatever data set is provided. 2Data from www.cbr.washington.edu (b) Use polyfit to find the line of best fit (degree 1). Save the coefficients for the polynomial as an array to the variable A22. (c) Use polyfit to find the best-fit polynomial of degree 3 for this data. Save the coefficients for the polynomial as an array to the variable A23. (Note: you may get a warning here, ignore it.) (d) Use polyfit to find the best-fit polynomial of degree 5 for this data. Save the coefficients for the polynomial as an array to the variable A24. (Note: you may get a warning here, ignore it.) (e) You now have three models for predicting the number of salmon in a given year: a degree-1 polynomial, a degree-3 polynomial, and a degree-5 polynomial. Call these three polynomials p, p3, and p5 respectively. Let's see how these models extrapolate to the future. The number of Chinook Salmon in 2022 was 752638. For each of the three polynomials, find the percentage error between what your polynomial predicts is the number of salmon in 2022 and the true number of salmon. In other words, calculate err1 = err3 = err5 = p1 (2022) 752638| - 752638 |P3 (2022) 752638| 752638 P3 (2022) 752638| - 752638 Save erri as A25, err3 as A26, and err5 as A27. Warning: Make sure that you are evaluating p(2022) using the built-in python function for doing so, otherwise your answer will not be within the Gradescope error tolerance. (f) Which of these 3 models should we choose based on their abilities to extrapolate? Save A28 as either 1, 3, or 5, based on which model is best based on our errors.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Integrated Accounting

Authors: Dale A. Klooster, Warren Allen, Glenn Owen

8th edition

1285462726, 1285462721, 978-1285462721

More Books

Students also viewed these Programming questions

Question

Explain the benefits of graphs over tables in presenting data.

Answered: 1 week ago

Question

What is the biggest challenge facing the organization?

Answered: 1 week ago

Question

Determine miller indices of plane X z 2/3 90% a/3

Answered: 1 week ago