15
Machine Learning Live Clojure Conj 2012 Mike Anderson @mikera [email protected]

Machine Learning Live

Embed Size (px)

Citation preview

Page 1: Machine Learning Live

Machine Learning Live

Clojure Conj 2012 Mike Anderson

@mikera [email protected]

Page 2: Machine Learning Live

Machine Learning – A definition

"Field of study that gives computers

the ability to learn without being

explicitly programmed.“

Arthur Samuel, 1959

Source: Good Old Wikipedia 2

Page 3: Machine Learning Live

Learning = Building functions from experience

3

Task Input Output

Simple mathematical

function

x y = sin(x)

Spam filtering Text of an email

message

Probability of email being

spam (%)

Stockmarket

prediction

Historical data on

- Stock prices

- Economic indicators

Expected price

movements

Remembering

names

Thought:

“Who was that guy

who liked windsurfing?

Thought:

“Oh yes – that was Bob”

Page 4: Machine Learning Live

The state of machine learning

4

“It works! sort of…. sometimes…. on a good day….”

Page 5: Machine Learning Live

nuroko.com

We’re building a toolkit for machine learning that is:

• General purpose – works on any data

• Powerful – advanced algorithms to detect complex patterns

• Scalable – handle unlimited data at internet scale

• Realtime – suitable for online use in real applications

• Pragmatic – designed for solving real problems

5

Page 6: Machine Learning Live

Why Clojure?

Productivity and fun!

Good parts of the JVM

Interactive experiments

Functional programming

DSLs with composable abstractions

6

REPL

Page 7: Machine Learning Live

Some Key Abstractions

7

Module

Algorithm

Coder

Vector 1 0 1 1 0 Efficiently represents information as a

vector of double values

Converts arbitrary data into vectors (and

back again!)

Represents a function

- (e.g. a Neural Network)

Adjusts parameters in a module to learn a

function from experience / data

- (e.g. back-propagation)

Task Represents a problem to solve – typically

via provision of training examples

𝑜𝑢𝑡𝑝𝑢𝑡 = 𝑓 𝑖𝑛𝑝𝑢𝑡

1 0 1 1 0 “Cat”

Page 8: Machine Learning Live

Neural Networks

8

Output layer

Input layer

Hidden layer

Weighted connections

Direction of

calculation

Each node’s value is

computed as a function

of the weighted sum of its

inputs:

𝑦𝑖 = 𝑓 𝑤𝑖𝑗 . 𝑥𝑗

Page 9: Machine Learning Live

How to train a neural network

9

(BASIC version)

10 Initialise network with some random weights

20 Choose a random training example as input

30 Compute the output

40 Determine error (difference vs. expected output)

50 Adjust the weights very slightly to reduce the error

60 GOTO 20

Page 10: Machine Learning Live

Live Demo – Part 1

10

Page 11: Machine Learning Live

A harder problem….

11

Page 12: Machine Learning Live

A trick – compression of data

12

784 inputs

784 outputs

150 units (“bottleneck”)

compressor

decompressor

Page 13: Machine Learning Live

Putting it together

13

compressor

2

784 inputs

150 units (compressed data)

10 outputs (one for each digit)

Page 14: Machine Learning Live

Live Demo – Part 2

14

Page 15: Machine Learning Live

Questions?

15