1 of 33

Machine Media

Week 2

2 of 33

Week 2 - Class Overview

Themes & Timeline:

Week 1: Introductions, Chance & Protocol

Week 2: Chatbots and Generative text

Week 3: �Data Labor

Week 4:

Classification, Taxonomies, Computer Vision

Week 5:

Generative Adversarial Networks, Handmade Datasets

Week 6:

GAN review,�Photo tutorial

Week 7:

Facial Recognition,

Identity, Surveillance

Week 8:

Deepfakes

Week 9: The Digital is Physical: Environmental impact

Week 10:

Handmade Dataset mid-way presentations

Week 11:

Data augmentation�Workshop (python)

Week 12:

Writing Images: Text-to

-image

models

Week 13:

Data Augmentation workshop part 2

Week 14:

Training Demo�In-class work day

Week 15: Final Presentations

Thanksgiving Break

Handmade Dataset Project

3 of 33

Week 2 - Agenda

  • 8:45 - 9:30 Review homework & reading
  • 9:30 - 9:50 Lecture: Chatbots & Generative Text
  • 9:50 - 10:00 break
  • 10:00 - 10:45 Technical Demo - Markov Chains
  • 10:45 - 11:00 Homework

4 of 33

Homework review: �Making Kin With Machines

Discussion Questions:

What were your initial thoughts on the reading?

What connections, if any can you make between the reading and the assignment?

How does metaphor serve as a framework for interacting with technology? How does metaphor serve as a framework for creating technology?

5 of 33

Homework review: �Making Kin With Machines

A problematic aspect of the current AI debate is the assumption that AIs would be homogeneous when in fact every AI would be profoundly different, from a military AI designed to operate autonomous killing machines to an AI built to oversee the United States’ electrical grid. �Less obvious influences beyond mission parameters would be the programming language(s) used in development, the coding style of the team, and less visibly, but perhaps more importantly, the cultural values and assumptions of the developers.”

TLDR:

  • A.I. is not one thing, it’s many things.�
  • The motivations, bias, and cultural values of developers and designers of a particular A.I.(ML model) have influence over it

6 of 33

Homework review: �Making Kin With Machines

I am not worried about rogue hyper-intelligences going Skynet to destroy humanity. I am worried about anonymous hyper-intelligences working for governments and corporations, implementing far-reaching social, economic, and military strategies based on the same values that have fostered genocide against Indigenous people worldwide and brought us all to the brink of environmental collapse. In short, I fear the rise of a new class of extremely powerful beings that will make the same mistakes as their creators but with greater consequences and even less public accountability.”

TLDR:

  • Focussing on the threat of the technology itself is missing the forest for the trees

7 of 33

Homework review: �Make a Meme

How do the words/images/metaphors we use to describe Machine Learning affect our relationship with technology?

8 of 33

Chatbots fka Chatterbots and generative text

a computer program designed to simulate conversation with human users, especially over the internet - Oxford Languages

Week 2 - Lecture

9 of 33

ELIZA - Joseph Weizenbaum

Created in 1964. ELIZA is designed to offer stock responses based on certain keywords from the responses of users.

Week 2 - Lecture

10 of 33

Smarterchild

Same idea but on AOL instant messenger…

Week 2 - Lecture

11 of 33

From Princeton, Reads all of your facebook status and uses markov chains to generate new ones

Week 2 - Lecture

12 of 33

Uses Generative Adversarial Networks. More advanced ML technique than markov chains. Chat GPT is based on billions of texts from the internet.

Week 2 - Lecture

13 of 33

Markov Chains

Falls under the umbrella of machine learning. But some do not consider it to be a Machine Learning algorithm. I think of it as a proto-ML algorithm…

It is a statistical model that aims to predict the probability of a certain state following a previous state. In the case of generative text, it may be the probability of a word following another word or a couplet of words following another couplet of words.

Week 2 - Chatbots and Generative Text

For every node, there is an X% chance that you will go to one node or a Y%

14 of 33

Markov Chains

A statistical model that aims to predict the probability of a certain state following a previous state. In the case of generative text, it may be the probability of a word following another word or a couplet of words following another couplet of words.

How

are

is

she?

he?

they?

you?

50%

50%

50%

50%

20%

80%

15 of 33

N-grams

N-grams are collections of sequential items (for our purposes let’s stick with text) in a text document where N is the number of individual items in the chain. So the example on the right is about tri-grams because it looks at patterns of sequential words working with groups of three at a time.

16 of 33

Google’s N-Gram Viewer

Shows the frequency of certain

N-grams over time in books.

Week 2 - Chatbots and Generative Text

17 of 33

Becca Ricks - Algorithmic Poet

self -destructing poems about ecological crises

18 of 33

Next Semester - Allison Parrish

Uses markov chains to generate course descriptions based on courses listed at NYU

Week 2 - Chatbots and Generative Text

19 of 33

Sandy Speaks - American Artist, 2016

"American Artist's online chatbot Sandy Speaks is inspired by the legacy of Sandra Bland, a 28-year-old African American woman who was found dead in a jail cell in Waller, Texas, on July 13, 2015—three days after being pulled over and arrested for a minor traffic violation. While her death was ruled a suicide, a grassroots movement coalesced to cast doubt on the official account. Those involved demanded to know: What happened to Sandra Bland? Users can ask the bot a limited range of questions related to Bland's death and American policing. The work's title is taken from a series of videos Bland posted online in the months preceding her death, which touch on politicized issues such as police brutality and mass incarceration."

20 of 33

Using markov chains, you will develop a browser-based text generator.

21 of 33

Coding Demo: Setup

Language(s):

HTML, CSS, Javascript

*You will only need

to edit the Javascript

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

</head>

<body>

</body>

</html>

HTML

body {

background: blue;

color: black;

Margin:0;

padding:0;

}

CSS

console.log('hello world')

JS

The Skeleton

(the content)

The Style (fonts, colors etc)

The Behavior (interaction)

22 of 33

Coding Demo: Setup

Javascript Libraries:

P5.js & RiTa.js

Javascript libraries are essentially javascript files we can "add" to our

project to extend the functionality of

our javascript in certain ways.

P5.js gives us a bunch of creative coding features.

RiTa.js gives us a bunch of Natural Language Processing features.

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

</head>

<body>

</body>

</html>

HTML

body {

background: blue;

color: black;

Margin:0;

padding:0;

}

CSS

console.log('hello world')

JS

console.log('hello world')

JS

console.log('hello world')

JS

p5.js

RiTa.js

23 of 33

Week 2- Activity

A basic p5.js sketch (code) involves two parts called setup() and draw()

The code inside of the {} brackets of setup runs once at the start of the sketch.

The code inside of the {} brackets of draw runs once every frame of the sketch over and over again. Kind of like a stop motion animation.

24 of 33

Coding Demo: Setup

Environment: online p5.js web editor

The creators of the p5.js library also created an online tool that allows you to quickly prototype websites using HTML, CSS, Javascript and p5.js.

We will use this tool as a coding environment.

25 of 33

Coding Demo: Test the editor

  • Go to https://editor.p5js.org/
  • Make sure you are logged in (or create an account)
  • In this environment, a project is called a "sketch"
  • Add this line of code:� ellipse(50,70,100,80)� under background(200)
  • Hit play
  • You should see an ellipse

26 of 33

Coding Demo: Test the editor continued

  • Hit the arrow under the play button to see all the files that are part of your project.
  • Here you will see the html (index.html), css (style.css), js (sketch.js) files.
  • Practice saving your sketch.

27 of 33

Coding Demo: Open the markov example

  • I have created a template sketch for you to work with today.
  • Click this link: https://editor.p5js.org/AaratiAkkapeddi/sketches/AgAQKSbPm
  • ***Duplicate the sketch to save your own copy to work off of today.

28 of 33

Coding Demo: Code

  • Play the markov template to see how it works
  • Let's look at the files in this markov example. Note the source.txt file
  • Click on source.txt. You will change this text to change the oracle's words. This is the text the markov chain is based on.

29 of 33

Coding Demo: Code Breakdown

  • Let's navigate back to sketch.js
  • You will be editing above the line that says "do not edit below this line"
  • The main javascript concept you need to know today is what a variable is.
  • A variable is a container. It holds a value that can be referenced later in the code.

30 of 33

Coding Demo: Variables

  • In javascript, we define a variable using the keyword "let", the name of the variable that you want to use, and the value you want to set it equal to :

let x = 40; (this line sets the variable called x equal to the number 40).

  • *Note: If a variable is equal to some text (as opposed to a number), we surround that text with quotation marks.
  • x corresponds to the placement of the response on the x axis and y corresponds to the placement of the response on the y axis
  • n is the n-gram size for the markov chain
  • numSentences is the number of sentences you want to generate.

31 of 33

Coding Demo: Source.txt

The main thing you will be doing today is editing the source.txt file.

This is the source text that the markov chain is using. You can copy/paste the text you want to use in here. I recommend at least 1000 words for "good" results.

(the default text in this file is from this article written by Allison Parrish)

32 of 33

Downloading files from the p5 editor

File > Download

Unzip your file and upload the source.txt to discord.

33 of 33

Week 2 - Homework

Build A Text Generator:

  • Talk to two chatbots
  • Finish building your corpus

Fortune Teller Made with random() instead of markov chains: https://editor.p5js.org/AaratiAkkapeddi/sketches/0QsnzOQo4