Menu
CoddyTech

Recap: Diabetes Data

Part of the Statistics for ML section of Coddy's Machine Learning journey. Lesson 60 of 64.

challenge icon

Challenge

Medium

Ten measurements of 442 diabetes patients, already scaled to small numbers around 0, and a label that is a number: how far the disease progressed a year later.

A histogram of disease progression for 442 patients, from about 25 to 346, piled up on the low side with a long tail to the right

Load load_diabetes with as_frame=True. The program reads the feature a doctor asks about. Print:

  1. First look: patients and missing cells.
  2. The label's mean and median, to 1 decimal.
  3. The strongest feature and its signed r, to 2 decimals.
  4. A line from the asked feature: slope and intercept to 1 decimal, R squared to 2.

For a made-up clinic and the input age:

Patients: 300
Missing cells: 0
Progression: mean 118.6, median 118.0
Strongest feature: s2 (r = -0.75)
Line for age: slope 127.6, intercept 118.6
R squared: 0.01

One feature explains a part. In section 3, a model will use all ten at once.

Try it yourself

import numpy as np
from sklearn.datasets import load_diabetes

feature = input()

# Write your code below

All lessons in Statistics for ML

Practice on your own: Online Python compiler