Session Ready
Exercise

Testing on circular data

Another special case where it is easy to guess the value of \(r^2\) is when the model does not fit the testing dataset at all. In this case, \(r^2\) takes its lowest possible value 0.0.

The plot shows such a testing dataset and model. The testing dataset consists of data arranged in a circle of radius 1.0. The x and y co-ordinates of the data is shown on the plot. The model corresponds to a straight line y=0.

As one can easily see, the straight line does not fit the data at all. In this particular case, the value of \(r^2\) is known to be 0.0.

Your job is to write a test test_on_circular_data() for the function model_test() that performs this sanity check. pytest, numpy as np, model_test, sin, cos and pi have been imported for you.

Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4
  • Assign test_argument to a \(8 \times 2\) NumPy array holding the circular testing data shown in the plot, starting with (1.0, 0.0) and moving anticlockwise.