Deep (learning) like Jacque Cousteau – Part 1 – Sets

(This article was first published on Embracing the Random | R,and kindly contributed to 188bet appR-bloggers)

(TL;DR: I'm going to go deep into deep learning.Sets are collections of things.)

I will be using a lot of LaTeX rendered with MathJax which doesn't show up in the 1188bet appRSS feed.Please visit my site directly to see equations and all that goodness!

Mural of Ol' Dirty Bastard

Here I go,deep type flow
Jacques Cousteau could never get this low

Ol' Dirty Bastard from Wu-Tang Clan's "Da Mystery of Chessboxin'"

Motivation for this series

I love deep learning.But a lot of the time I don't feel comfortable with it at a foundational level.I need to do something 金宝搏网址about this!I'd describe my learning style as one of ‘obsessive detail orientation'.So let's get into the detail together!

Our aim

Our aim is to develop an understanding of deep learningat a foundational levelbefore moving onto deep learning itself.This means we will be starting withmathematics!We will learn how toapply these ideas in R.

What I write may not be as academically rigorous.However,to make sure that what I write is somewhat correct,I will be referring to these great books:

  • Goodfellow,Ian,et al.Deep Learning
  • Strang,Gilbert.Linear Algebra and Its Applications
  • Shilov,Georgii Evgen'evich.Linear Algebra
  • Lipschutz,Seymour.Schaum's Outlines – Beginning Linear Algebra
  • Stewart,Ian,和大卫·高。The Foundations of Mathematics.

I will follow thenotationoutlined inGoodfellow,Ian,et al.

Let's get started on our adventure!

Today's topic: Sets

Before we touch anylinear algebra,let's (very) briefly describe what ais in maths.Sets will become important when we encounterscalars!

A set is a collection of ‘things'

Here are some examples of sets:

  • the integers between 1 and 10
  • the letters in the English alphabet

Thethingsinside our sets are calledelementsormembersof their sets.Some sets may not contain any elements.This is theempty set,which is depicted using the symbol.

The above two sets arefinitesets.However sets can also beinfinite.

What notation is used to depict sets?

Sets are normally descibed usingcurly braces.For example,the integers between 1 and 10 can be written like this:

where each element of our set is explicitly listed.

But sometimes it may be easier to use an ellipsis so that we don't have to write out all of the elements of our set.For example,we could write the previous set like this:

Sometimes it may beimpossibleto write out all members of our set because it is aninfinite set.For example – how can we depict all positive,even numbers using our set notation?We can do this!

What are some important,infinite sets?

Natural numbers

The set ofnatural numbersis the set of all ‘whole',positive numbers starting with 1 and increasing with no upperbound.

This set is depicted using an uppercase ‘N':

Examples of some natural numbers are.


The set ofintegersis the set of:

  • allnatural numbers,
  • allnatural numbers preceded with a negative sign,and
  • zero.

This set is depicted using an uppercase ‘Z':

Examples of some integers are.

Rational numbers

The set ofrational numbersconsists of numbers that can be described bydividing one integer by another (except for dividing an integer by zero).

This set is depicted using an uppercase ‘Q' for ‘quotient':

Examples of some rational numbers are

Real numbers

The set ofreal numbersconsists of allrational numbers,along withthose numbers that cannot be expressed by dividing two integers which are not ‘imaginary' numbers.This additional set of numbers is calledirrational numbers.

(Let's ignore imaginary numbers as they aren't important to us in achieving our goal!)

The set of real numbers is depicted using an upper case ‘R':

Examples of some real numbers are

How can we create sets in R?

One way is to use thesets package


Let's define a set:

set_one <- (1, 2, 3)
## {1,2,3}

Theorderin which the elements of the set are depicteddoesn't make a set unique.For example,these two sets are equivalent:

set_two <- (3, 2, 1)
print(set_one == set_two)
## [1] TRUE

We also discover thatlisting elements of a set multiple times doesn't make a set unique:

set_three <- (1, 1, 1)
set_four <- (1)
print(set_three == set_four)
## [1] TRUE

We could also use somebase R functionsto emulate sets and their operations,but let's leave it at this.


The area of set theory is huge and I could easily get lost in it.But we have covered off enough to talk 金宝搏网址aboutscalarsso let's move on.



To leave a commentfor the author,please follow the link and comment on their blog: Embracing the Random | R.

188bet appR-bloggers.comoffers daily e-mail updates金宝搏网址 Rnews and tutorialson topics such as: Data science, Big Data, R jobs,visualization ( ggplot2, Boxplots, maps, 动画),programming ( RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics ( regression, PCA, time series, trading) and more...

If you got this far,why not subscribe for updates 从这个网站吗?Choose your flavor: 电子邮件, twitter, 1188bet app,or facebook...

Comments are closed.

Search 188bet appR-bloggers


Never miss an update!
Subscribe to 188bet appR-bloggersto receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)