Introduction and Data Generation

Create a scenario and compile data to understand the concepts of bias, variance, and trade-offs.

We'll cover the following

The bias-variance trade-off is essential to improve the model performance. Let’s learn this using sample data on student morale in the courses or workshops they attend. The main goal here is to visually explore the concept of bias and variance in modeling and understand the importance of their trade-off.

Context building

Let’s assume several students participated in a course for a few weeks. Understandably, the participants’ morale will not be the same. It depends upon the complexity of the topic, their interest in that topic, workload, the instructors’ ability to deliver, and so on. Let’s generate some data showing students’ morale vs. the day of the course. We’ll train models to predict participants’ morale over time (days).

Generating data

We need data to work with. Let’s generate some data on days elapsed and the morale measured each day. We can use the arange() function from numpy to create the number of 84 days for a 12-week course.

Get hands-on with 1200+ tech skills courses.