\(n\)-D

AI 101

What is \(n\)-D?

  • Or longer, \(n\)-dimensional

Having an arbitrary number of dimensions.

Why do we care?

Recall Star Wars over which I claimed:

  • Linear regression can be cool.
  • But it is not intelligent, probably.
    • Perhaps, if it appears intelligence the site of the intelligence is actually the human user, not the computer.

We are intelligent. Let’s try again.

Recall Release Dates

Episode Year
4 1977
5 1980
6 1983
Episode Year
1 1999
2 2002
3 2005
Episode Year
7 2015
8 2017
9 2019

Thinking Model

  • Perhaps instead of thinking of films (1 dimension) vs year (1 dimension)…
  • Consider “trilogy-wise”
    • In which trilogy is some film (a dimension)
    • Which film within a trilogy is some film (another dimension)
Episode Trilogy # # in Trilogy
1 2 1
2 2 2
3 2 3
4 1 1
5 1 2
6 1 3
7 3 1
8 3 2
9 3 3
Episode Trilogy Year Year in Trilogy
1 1999 0
2 1999 3
3 1999 6
4 1977 0
5 1977 3
6 1977 6
7 2015 0
8 2015 2
9 2015 4

Set up

  • We will visually examine the Star Wars releases in \(n\)-D.
  • We will make some informed estimate of the release date of next trilogy
  • In the post-lab, you will comment on the comparative merits of an \(n\)-D approach to the naive linear approach.

Plotting in \(n\)-D

  • There is one difficulty.
  • Computer monitors have only two dimensions, right?

Wrong!

  • Just because something is represented in a dimension like up, down, or… out?
  • We can also use shape, color, size, or more subtle manners.

Citations

  • I am stealing my slides from my scientific computing course
  • I needed one more dimension so I found Star Wars “in-universe” years expressed as (B)BY
    • It’s from Reddit… just regard that as accurate I guess.

Extended example

  • You can copy paste this data, as is, into a Colab code cell.
  • And try things out!

Data

In order these are:

  1. Episode Number (eps)
  2. Trilogy Number (tri)
  3. Number in Trilogy (num)
  4. In-universe year (bby)
eps = [4,5,6,1,2,3,7,8,9]
tri = [2,2,2,1,1,1,3,3,3]
num = [1,2,3,1,2,3,1,2,3]
bby = [0,3,4,-32,-22,-19,34,34,35]

Matplotlib

  • We quickly recall how to include matplotlib to see charts!
import matplotlib.pyplot as plt
  • Or you can just ask Gemini!

2D

  • Try out a few 2D plots, here is one example.
    • We can specify these as the x and y dimension.
    • A la grade school mathematics
plt.scatter(x=tri,y=num)

  • Wow - that is not that exciting.
  • What is this showing?

3D

  • Third dimension via s= for size.
  • Also, I start putting things on their own lines - you may find this easier to read.
plt.scatter(
    x=tri,
    y=num,
    s=num
)

4D

  • For the fourth dimension, we can use color.
plt.scatter(
    x=tri,
    y=num,
    s=num,
    c=bby
)

  • Often we using colors we also include a legend as a “color bar”.
plt.scatter(
    x=tri,
    y=num,
    s=num,
    c=bby
)
plt.colorbar()

Other values

  • We can also include release year, year within trilogy (ywt), and box office in millions.
yrs = [1977, 1980, 1983, 1999, 2002, 2005, 2015, 2017, 2019]
ywt = [0, 3, 6, 0, 3, 6, 0, 2, 4]
box = [461, 293, 317, 488, 311, 414, 937, 620, 515]

Your Task

  • Take some time and effort plotting the Star Wars films in different ways.
  • Look for patterns.
  • Take notes.
  • Perform your work in a Lab03 Colab notebook in your AI folder.

After some time exploring, answer some questions. Before introducing the questions, I would like you to answer them as follows:

  • Add a text cell (NOT a code cell) with 2-3 sentences of explanation.
    • Think of around 100 words.
    • If you can’t think of 100 words, you didn’t think hard enough about your explanation.
  • Add a code cell of a 4-dimensional (or higher) plot supporting your explanation.
  • Add a text cell after the code block explaining how you choose what values to make within your plot.
Note

I am specifying a precise way I expect to receive see these questions. Think about why I am doing that and why it may be helpful to following these instructions!

  1. What year do you expect Episode 10 to be released?
  2. What year do you expect Episode 0 to be released?
  3. How much profit do you expect Episode 10 to make at the box office?
  4. How much profit do you expect Episode 0 to make at the box office?
  5. Do relationships between Star Wars films appear linear in two dimensions?
  6. Do relationships between Star Wars films make more or less sense when considering additional dimensions?
  7. Does selecting dimensions when predicting future events require intelligence?