Quiz: Interpolation and Regression

Main.PythonQuiz15 History

Hide minor edits - Show changes to markup

May 18, 2022, at 02:41 AM by 10.35.117.248 -
Added lines 1-93:

(:title Quiz: Interpolation and Regression:) (:keywords quiz, test, Python, plot, interpolate, regression, curve fit, introduction, course:) (:description Learning assessment on interpolation and regression with Python.:)


1. Given the following data:

  x, y
  0, 2
  1, 1

What is the predicted y value with a linear interpolation of the data at x=0.5?

A. 0.25
(:toggle hide q1a button show="Select":)

(:div id=q1a:)

Incorrect.

(:divend:)

B. 0.5
(:toggle hide q1b button show="Select":)

(:div id=q1b:)

Incorrect.

(:divend:)

C. 1.5
(:toggle hide q1c button show="Select":)

(:div id=q1c:)

Correct.

(:divend:)

D. 2.0
(:toggle hide q1d button show="Select":)

(:div id=q1d:)

Incorrect.

(:divend:)


2. What is a module for nonlinear regression in Python?

A. numpy.polyfit
(:toggle hide q2a button show="Select":)

(:div id=q2a:)

Incorrect. The polyfit function creates a polynomial regression of data.

(:divend:)

B. scipy.optimize.curve_fit
(:toggle hide q2b button show="Select":)

(:div id=q2b:)

Correct. Scipy.optimize package has a minimize and curve_fit function for nonlinear regression. Gekko is another Python package for optimization and regression.

(:divend:)

C. numpy.optimize
(:toggle hide q2c button show="Select":)

(:div id=q2c:)

Incorrect. Numpy does not have an optimization function.

(:divend:)


3. What is a Python function that can find solutions to nonlinear equations?

A. matplotlib.fsolve
(:toggle hide q3a button show="Select":)

(:div id=q3a:)

Incorrect. This package is used to create plots.

(:divend:)

B. numpy.optimize.fsolve
(:toggle hide q3b button show="Select":)

(:div id=q3b:)

Incorrect. Numpy is a base numerical Python package for other packages such as Scipy.

(:divend:)

C. scipy.optimize.fsolve
(:toggle hide q3c button show="Select":)

(:div id=q3c:)

Correct.

(:divend:)