Data science in Node.js

Post on 17-Jul-2015

766 views 3 download

Tags:

Transcript of Data science in Node.js

Data Science

Sean Byrnes

http://seanbyrnes.com

@sbyrnes

in

Node.js

Who Am I?

f

ATTENDED

FOUNDED

CURRENTLY

from Yahoo!

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

Data Science in Node.js

• What is Data Science?

• Why Node?

• Example 1: Regression Modeling

• Example 2: Recommender Systems

• Where to go next?

What is Data Science?

Software Engineering

+

Statistical Analysis

What is Data Science?

1. Question

2. Data Gathering

3. Exploration

4. Modeling

5. Answer

6. Production

What is Data Science?

1. Question

2. Data Gathering

3. Exploration

4. Modeling

5. Answer

6. Production

Why Node?

Pros

• Functional

• NPM

• Event driven

• D3

Cons

• Binary data

structures

• Speed

Alternatives:

• R

• Python

• Java

• C++

• Go

https://github.com/sbyrnes/DataSci

ence_in_Node.js

1 // REGRESSION MODELING

Predicting the future is hard

Example 1: Regression Modeling

How many users will we have next month?

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

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)

Example 1: Regression Modeling

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

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

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

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

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

2nd Degree Polynomial Model

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

4th Degree Polynomial Model

Example 1: Regression Modeling

0

50,000

100,000

150,000

200,000

250,000

6th Degree Polynomial Model

> Code

2 // RECOMMENDER SYSTEMS

Predicting people is really hard

Example 2: Recommender Systems

What other products might this

customer buy?

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

Example 2: Recommender Systems

Given customer preference matrix M, find

P x Q ~ M

M

Example 2: Recommender Systems

Given customer preference matrix M, find

P x Q ~ M

X =

P Q M

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

> Code

Where to go next?

• Programming

• Statistics

• Machine learning

• Toolkit

– R

– Hadoop

– D3

Sean Byrnes

seanbyrnes.com

@sbyrnes

github.com/sbyrnes