Data science in Node.js

29
Data Science Sean Byrnes http://seanbyrnes.com @sbyrnes in Node.js

Transcript of Data science in Node.js

Page 1: Data science in Node.js

Data Science

Sean Byrnes

http://seanbyrnes.com

@sbyrnes

in

Node.js

Page 2: Data science in Node.js

Who Am I?

f

ATTENDED

FOUNDED

CURRENTLY

from Yahoo!

Page 3: Data science in Node.js

Likely.js Recommendation Engine

Classify.js Naïve Bayes Classifier

Lyric Linear Regression

Logistical.js Logistic Regression (work in progress)

https://github.com/sbyrnes

https://www.npmjs.com/~sbyrnes

Page 4: Data science in Node.js

Data Science in Node.js

• What is Data Science?

• Why Node?

• Example 1: Regression Modeling

• Example 2: Recommender Systems

• Where to go next?

Page 5: Data science in Node.js

What is Data Science?

Software Engineering

+

Statistical Analysis

Page 6: Data science in Node.js

What is Data Science?

1. Question

2. Data Gathering

3. Exploration

4. Modeling

5. Answer

6. Production

Page 7: Data science in Node.js

What is Data Science?

1. Question

2. Data Gathering

3. Exploration

4. Modeling

5. Answer

6. Production

Page 8: Data science in Node.js

Why Node?

Pros

• Functional

• NPM

• Event driven

• D3

Cons

• Binary data

structures

• Speed

Alternatives:

• R

• Python

• Java

• C++

• Go

Page 9: Data science in Node.js

https://github.com/sbyrnes/DataSci

ence_in_Node.js

Page 10: Data science in Node.js

1 // REGRESSION MODELING

Predicting the future is hard

Page 11: Data science in Node.js

Example 1: Regression Modeling

How many users will we have next month?

Page 12: Data science in Node.js

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

Page 13: Data science in Node.js

Example 1: Regression Modeling

Given X(n) = [x1, x2, … xk]

with dependent value y(n)

find f(n) such that

f(x(n)) ~ y(n)

Page 14: Data science in Node.js

Example 1: Regression Modeling

Given X(n) = [x1, x2, … xk]

f(n) = c1x1 + c2x2 + c3x3 + … + cnxn ~ y(n)

Page 15: Data science in Node.js

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

Page 16: Data science in Node.js

Example 1: Regression Modeling

Given X(n) = [x1, x2, … xk]

f(n) = c1x1 + c2x2 + c3x3 + … + cnxn

Or, maybe

f(n) = c1x1 + c2x12 + c3x2 + c4x2

2 + …+ cmxn2

Page 17: Data science in Node.js

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

2nd Degree Polynomial Model

Page 18: Data science in Node.js

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

4th Degree Polynomial Model

Page 19: Data science in Node.js

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

6th Degree Polynomial Model

Page 20: Data science in Node.js

> Code

Page 21: Data science in Node.js

2 // RECOMMENDER SYSTEMS

Predicting people is really hard

Page 22: Data science in Node.js

Example 2: Recommender Systems

What other products might this

customer buy?

Page 23: Data science in Node.js

Example 2: Recommender Systems

Product 1 Product 2 Product 3 … Product N

Customer 1 3.5 4.0 3.0

Customer 2 2.0 3.5

Customer 3 3.0 2.5

Customer

N4.5 4.5

Page 24: Data science in Node.js

Example 2: Recommender Systems

Given customer preference matrix M, find

P x Q ~ M

M

Page 25: Data science in Node.js

Example 2: Recommender Systems

Given customer preference matrix M, find

P x Q ~ M

X =

P Q M

Page 26: Data science in Node.js

Example 2: Recommender Systems

Product 1 Product 2 Product 3 … Product N

Customer 1 3.5 4.0 2.5 3.0

Customer 2 2.0 1.5 3.5 3.0

Customer 3 1.5 3.0 2.5 4.0

Customer

N4.5 3.5 4.0 4.5

Page 27: Data science in Node.js

> Code

Page 28: Data science in Node.js

Where to go next?

• Programming

• Statistics

• Machine learning

• Toolkit

– R

– Hadoop

– D3

Page 29: Data science in Node.js

Sean Byrnes

seanbyrnes.com

@sbyrnes

github.com/sbyrnes