This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 3: Understanding your data

How many attributes?

face Josiah Wang

Next question!

Question 2: How many features does each instance have?

It will also be useful to know how many features/attributes our dataset has. Since x is a NumPy array, let us use its .shape attribute to find out!

>>> print(x.shape)
(150, 4)
>>> print(y.shape)
(150,)

This actually answers both the first and second questions. Scikit-learn models expect the input x to be of size N \times K, for N instances and K features. So we answered both questions in one go! (N = 150, K = 4)

We also know that y has 150 labels (one label per instance). Sounds right!