Want to keep learning?

This content is taken from the The University of Glasgow's online course, Getting Started with Teaching Data Science in Schools. Join the course to learn more.

Skip to 0 minutes and 6 seconds JEREMY: Hey, Lovisa. When we’re modelling data in the real world, sometimes it’s a bit confusing to know exactly how to model the attributes. Can you give us an example, maybe?

Skip to 0 minutes and 16 seconds LOVISA: It’s very true. If we just take these lollipops that I happened to find in my pocket, then we will find out how we choose to model it depends very much on who we are, what our goals are, and what the context is. So if I were a physicist, for example, and I wanted to model the colour of these lollipops, then I know that colour is a physical wavelength, and a continuous attribute.

Skip to 0 minutes and 40 seconds JEREMY: Yeah.

Skip to 0 minutes and 41 seconds LOVISA: But if I were a computer scientist, then I would know that these colours would be encoded as discrete bit strings, so it would be a numerical, but discrete, attribute.

Skip to 0 minutes and 53 seconds JEREMY: Or, if you’re using CSS, you could say colour equals purple, or colour equals red, and they’d be strings.

Skip to 0 minutes and 59 seconds LOVISA: That’s true. See, it depends on context. But if I were an artist, then I would perhaps, categorise these as different pigments and it would be a categorical attribute. But I think we can all agree that what comes most naturally to us would be to model this as a categorical attribute in terms of the good ones, and the disgusting ones.

Skip to 1 minute and 23 seconds JEREMY: Oh, no, blackcurrant is my favourite. Thanks, Lovisa.

Skip to 1 minute and 26 seconds LOVISA: Thanks. That leaves me with three.

Modelling Real World Data

In general, data is either numbers (numerical data) or labelled values from a limited set of possible values (categorical data).

Numerical data may be discrete (whole numbers) or continuous (real numbers, with decimal points).

As a short exercise, think of an example of numerical data and categorical data for features from the following data sets:

  1. Scotland’s 2001 census data
  2. Bicycles in the Glasgow city bike hire scheme
  3. Olympic Games athletes data

As a further thought experiment, can you see how values of these different kinds might map onto the concrete data types Jeremy introduced in an earlier video?

Share this video:

This video is from the free online course:

Getting Started with Teaching Data Science in Schools

The University of Glasgow