M Machine Learning F# and Accord.net. Alena Dzenisenka Software architect at Luxoft Poland Member of F# Software Foundation Board of Trustees Researcher.

Post on 03-Jan-2016

226 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

Transcript

m

Machine Learning F# and Accord.net

Alena Dzenisenka• Software architect at Luxoft Poland

• Member of F# Software Foundation Board of Trustees

• Researcher in the field of mathematical theoretical possible in modern programming concepts

• Speaker and active software engineering community member

@lenadroid

Machine Learning

• Why machine learning?

• What is the data?

• How?

Questions

Data Questions.

Data reality :\

Path to grasping machine learning and data science…

Contents• Multiple Linear

Regression• Logistic Regression

Classification• Neural Networks

Classification• K Means

Clustering• What’s next?

F# for machine learningand data science!

Linear Regression

MATH

How to predict?1. Make a guess.2. Measure how wrong the guess

is.3. Fix the error.

Make a guess!

Make a guess?What does it mean?...

Hypothesis /guess :

weights

Find out our mistake…

Cost function/ Mistake function:

… and minimize it:

Mistake function looks like…

Global minimums

How to reduce the mistake?Update each slope parameter

until Mistake Functionminimum is reached:

Simultaneously

Alpha Learning rate

Derivative Direction of moving

Fix the error

Multiple Linear RegressionX [ ] – Predictors:Statistical data about bike rentals for previous years or months.

Y – Output:Amount of bike rentals we should expect today or some other day in the future.

* Y is not nominal, here it’s numerical continuous range.

Make a guess!

Fix the error

Multiple linear regression: Bike rentals demand

“Talk is cheap. Show me the code.”

What to remember?1. Simplest regression algorithm

2. Very fast, runs in constant time

3. Good at numerical data with lots of features

4. Output from numerical continuous range

5. Linear hypothesis

6. Uses gradient descent

Linear Regression

Logistic Regression

Hypothesis function

Estimated probability that Y = 1 on input X

Mistake function

Mistake function is the cost for a single training data example

h(x)

Full mistake function

1. Uses the principle of maximum likelihood estimation.

2. We minimize it same way as with Linear Regression

“Talk is cheap. Show me the code.”

Logistic Regression Classification Example

What to remember?

• Classification algorithm

• Output is the binary value, either 1 or 0

• Relatively small number of predictors

• Uses logistics function for hypothesis

• Has the cost function that is convex

• Uses gradient descent for correcting the mistake

Logistic Regression

At this point…

Machine Learning

What society thinks I do…

What other programmers think I do…

What I really do is…

Neural Networks

Neuron

Neural Networks

Layer transitions!Input

Weights

Activation function

Activation unit(value which is computed and outputted by the node)

Elena Droid

Activation function?

Step activation functionUsed in binary classification

Sigmoid activation functionUses logistic function to perform the activation

Forward propagation

x

x

x

x

a

a

a

a

a

a

a

X = X X =

a1X =

a2

Hypothetic Outputs!

Activation Computational Nodes!

Predictors

Multi class?

ORxxx

aaaaa

xxx

aaaaa

Cost function?

xxxLooks difficult? No, it’s really not so complicated…1. Outputs the vector with size == number of

output classes2. Similar to Logistic Regression cost function3. Finds the mistake of our hypothesis and

real outputs

Minimize the error!

x

x

x

x

Error value

And then… recalculate weights!

“Talk is cheap. Show me the code.”

Neural Networks Classification Example.

What to remember?

• Extremely powerful• Slow learning / Fast prediction• Big number of predictors• Complex hierarchical relationships• No need to understand the data• Wide applications

Neural Networks

K-Means

Clustering

Birth-death percentage rates

… with clustering K=2

… with clustering K=3

… with clustering K=4

What’s next?

I’m Lena@lenadroid

Thank you!

top related