supervised learning algorithms - analysis of different approaches

64
Supervised Learning Algorithms Analysis of Different approaches Evgeniy Marinov ML Consultant Philip Yankov x8academy

Upload: philip-yankov

Post on 15-Apr-2017

72 views

Category:

Science


0 download

TRANSCRIPT

Page 1: Supervised Learning Algorithms - Analysis of different approaches

SupervisedLearningAlgorithms

Analysisof

Differentapproaches

EvgeniyMarinovMLConsultant

PhilipYankovx8academy

Page 2: Supervised Learning Algorithms - Analysis of different approaches

MLDefiniCon

•  ThereareplentyofdefiniCons...•  Informal:Thefieldofstudythatgivescomputerstheabilitytolearnwithoutbeingexplicitlyprogrammed(ArthurSamuel,1959)

•  Formal:AcomputerprogramissaidtolearnfromexperienceE,withrespecttosometaskT,andsomeperformancemeasureP,ifitsperformanceonTasmeasuredbyPimproveswithexperienceE(TomMitchell,1998).

Page 3: Supervised Learning Algorithms - Analysis of different approaches

FromWikipedia

•  Machinelearningis:– asubfieldofcomputersciencethatevolvedfromthestudyofpaRernrecogniConandinAIinthe1980s(MLisaseparatefieldflourishingfromthe1990s,firstbenefitedfromstaCsCcsandthenfromtheincreasingavailabilityofdigiCzedinformaConatthatCme).

Page 4: Supervised Learning Algorithms - Analysis of different approaches

WhyML?

Page 5: Supervised Learning Algorithms - Analysis of different approaches

WhyML?

Page 6: Supervised Learning Algorithms - Analysis of different approaches

KeyfactorsenablingMLgrowthtoday

•  CloudCompu)ng•  InternetofThings•  BigData(+UnstructuredData)

Page 7: Supervised Learning Algorithms - Analysis of different approaches

WhyDataissoimportant?

Page 8: Supervised Learning Algorithms - Analysis of different approaches

WhyDataissoimportant?

•  GooglePhotos– Unlimitedstorage

•  Googlevoice– OK,Google

Page 9: Supervised Learning Algorithms - Analysis of different approaches
Page 10: Supervised Learning Algorithms - Analysis of different approaches

Nowadays

•  ItissoeasytogetdatayouneedandtouseanAPIorserviceofsomecompanytoexperimentwiththem

Page 11: Supervised Learning Algorithms - Analysis of different approaches

MethodsforcollecCngdata

Page 12: Supervised Learning Algorithms - Analysis of different approaches

MethodsforcollecCngdata

•  Download– Spreadsheet– Text

•  API•  Crawling/scraping

Page 13: Supervised Learning Algorithms - Analysis of different approaches

SupervisedLearning

Page 14: Supervised Learning Algorithms - Analysis of different approaches

Task Description

Page 15: Supervised Learning Algorithms - Analysis of different approaches

Pipeline

Page 16: Supervised Learning Algorithms - Analysis of different approaches

IniCalexample

Page 17: Supervised Learning Algorithms - Analysis of different approaches

NotaCon

Page 18: Supervised Learning Algorithms - Analysis of different approaches
Page 19: Supervised Learning Algorithms - Analysis of different approaches

•  Asdasd

•  Asdasd

•  Asdasd

•  Asdasd

TheregressionfuncConf(x)

Page 20: Supervised Learning Algorithms - Analysis of different approaches

•  as•  as

•  as

Page 21: Supervised Learning Algorithms - Analysis of different approaches

Howtoevaluateourmodel?

Page 22: Supervised Learning Algorithms - Analysis of different approaches

Pipeline

Page 23: Supervised Learning Algorithms - Analysis of different approaches

Assessing the Model Accuracy

Page 24: Supervised Learning Algorithms - Analysis of different approaches
Page 25: Supervised Learning Algorithms - Analysis of different approaches

Bias-variancetrade-off

Page 26: Supervised Learning Algorithms - Analysis of different approaches

Bias-variancetrade-off

Page 27: Supervised Learning Algorithms - Analysis of different approaches

Cross-validaCon

Page 28: Supervised Learning Algorithms - Analysis of different approaches

GeneralizaConErrorandOverfi`ng

Page 29: Supervised Learning Algorithms - Analysis of different approaches

ChoosingaModelbydatatypesofresponse

Page 30: Supervised Learning Algorithms - Analysis of different approaches

Pipeline

Page 31: Supervised Learning Algorithms - Analysis of different approaches

DatatypesandGeneralizedLinearmodel

•  SimpleandGenerallinearmodels•  RestricConsofthelinearmodel•  DatatypeoftheresponseY1)  (General)LinearmodelR,Y~Gaussian(µ,σ^2)--conCnuous2)  LogisCcregression{0,1},Y~Bernoulli(p)--binarydata3)Poissonregression{0,1,...},Y~Poisson(µ)--counCngdata

Page 32: Supervised Learning Algorithms - Analysis of different approaches

SimpleandGenerallinearmodels

Simple:General:

Page 33: Supervised Learning Algorithms - Analysis of different approaches

ErroroftheGeneralLinearmodel

ClicktoaddText

Page 34: Supervised Learning Algorithms - Analysis of different approaches

RestricConsofLinearmodels

AlthoughtheGenerallinearmodelisausefulframework,itisnotappropriateinthefollowingcases:•  TherangeofYisrestricted(e.g.binary,count,posiCve/negaCve)

•  Var[Y]dependsonthemeanE[Y](fortheGaussiantheyareindependent)

Name Mean Variance

Bernoulli(p) p p(1 - p)

Binomial(p, n) np np(1 - p)

Poisson(p) p p

Page 35: Supervised Learning Algorithms - Analysis of different approaches

BinaryresponseY–{0,1}•  TheBernoulli(p)isdiscreter.v.withtwopossibleoutcomes:•  pandq=1–p•  TheparameterpdoesnotchangeoverCme•  Bernoulliisbuildingblockforothermorecomplicated

distribuCons

•  Examples:•  Coinflips{Heads,Tails}–ifunbiased•  thenp=0.5•  ClickonAd,Fail/SuccessonExam

Page 36: Supervised Learning Algorithms - Analysis of different approaches

GeneralizedLinearmodel-IntuiCon

Page 37: Supervised Learning Algorithms - Analysis of different approaches

ExponenCalFamily

Page 38: Supervised Learning Algorithms - Analysis of different approaches

Generallinearmodel

Page 39: Supervised Learning Algorithms - Analysis of different approaches

Binary Data

Page 40: Supervised Learning Algorithms - Analysis of different approaches

ModelingCounCng/PoissonData

Page 41: Supervised Learning Algorithms - Analysis of different approaches

MaximizingtheLog-LikelihoodandParametersesCmaCon

Page 42: Supervised Learning Algorithms - Analysis of different approaches

Preprocessing

Page 43: Supervised Learning Algorithms - Analysis of different approaches

Pipeline

Page 44: Supervised Learning Algorithms - Analysis of different approaches

Problemswithfeaturetypes

•  Bignumberoffeatures->DimensionalityreducCon->SVD,PCA– Dimensionalityreduc)on:“compress”thedatafromahigh-dimensionalrepresentaConintoalower-dimensionalone(usefulforvisualizaConorasaninternaltransformaConforotherMLalgorithms)

•  Sparsefeatures->Hashing

Page 45: Supervised Learning Algorithms - Analysis of different approaches

•  Insteadofusingtwocoordinates(𝒙,𝒚)todescribepointlocaCons,let’suseonlyonecoordinate(𝒛)

•  Point’sposiConisitslocaConalongvector𝒗↓𝟏 •  Howtochoose𝒗↓𝟏 ?Minimizereconstruc)onerror

SVD–DimensionalityReducCon

v1

first right singular vector

Movie 1 rating

Mov

ie 2

ratin

g

Page 46: Supervised Learning Algorithms - Analysis of different approaches

SVD-DimensionalityReducCon

Moredetails•  Q:Howexactlyisdim.reduc)ondone?•  A:Setsmallestsingularvaluestozero

46

0.56 0.59 0.56 0.09 0.09 0.12 -0.02 0.12 -0.69 -0.69 0.40 -0.80 0.40 0.09 0.09

x x

1 1 1 0 0 3 3 3 0 0 4 4 4 0 0 5 5 5 0 0 0 2 0 4 4 0 0 0 5 5 0 1 0 2 2

0.13 0.02 -0.01 0.41 0.07 -0.03 0.55 0.09 -0.04 0.68 0.11 -0.05 0.15 -0.59 0.65 0.07 -0.73 -0.67 0.07 -0.29 0.32

12.4 0 0 0 9.5 0 0 0 1.3

Page 47: Supervised Learning Algorithms - Analysis of different approaches

SVD-DimensionalityReducCon

Moredetails•  Q:Howexactlyisdim.reduc)ondone?•  A:Setsmallestsingularvaluestozero

47

x x

1 1 1 0 0 3 3 3 0 0 4 4 4 0 0 5 5 5 0 0 0 2 0 4 4 0 0 0 5 5 0 1 0 2 2

0.13 0.02 -0.01 0.41 0.07 -0.03 0.55 0.09 -0.04 0.68 0.11 -0.05 0.15 -0.59 0.65 0.07 -0.73 -0.67 0.07 -0.29 0.32

12.4 0 0 0 9.5 0 0 0 1.3

0.56 0.59 0.56 0.09 0.09 0.12 -0.02 0.12 -0.69 -0.69 0.40 -0.80 0.40 0.09 0.09

Page 48: Supervised Learning Algorithms - Analysis of different approaches

SVD-DimensionalityReducCon

Moredetails•  Q:Howexactlyisdim.reduc)ondone?•  A:Setsmallestsingularvaluestozero

≈ x x

1 1 1 0 0 3 3 3 0 0 4 4 4 0 0 5 5 5 0 0 0 2 0 4 4 0 0 0 5 5 0 1 0 2 2

0.13 0.02 0.41 0.07 0.55 0.09 0.68 0.11 0.15 -0.59 0.07 -0.73 0.07 -0.29

12.4 0 0 9.5

0.56 0.59 0.56 0.09 0.09 0.12 -0.02 0.12 -0.69 -0.69

Page 49: Supervised Learning Algorithms - Analysis of different approaches

ǁA-BǁF =√Σij (Aij-Bij)2 is“small”

SVD–DimensionalityReducCon(PCAgeneralizaCon)

Moredetails•  Q:Howexactlyisdim.reduc)ondone?•  A:Setsmallestsingularvaluestozero

1 1 1 0 0 3 3 3 0 0 4 4 4 0 0 5 5 5 0 0 0 2 0 4 4 0 0 0 5 5 0 1 0 2 2

0.92 0.95 0.92 0.01 0.01 2.91 3.01 2.91 -0.01 -0.01 3.90 4.04 3.90 0.01 0.01 4.82 5.00 4.82 0.03 0.03 0.70 0.53 0.70 4.11 4.11 -0.69 1.34 -0.69 4.78 4.78 0.32 0.23 0.32 2.01 2.01

Frobeniusnorm:ǁMǁF =√Σij Mij

2

Page 50: Supervised Learning Algorithms - Analysis of different approaches

Feature selection - example

Page 51: Supervised Learning Algorithms - Analysis of different approaches

Dummy Encoding

Page 52: Supervised Learning Algorithms - Analysis of different approaches

(De)MoCvaCon

Page 53: Supervised Learning Algorithms - Analysis of different approaches

SoluContothoseproblemswithfeatures

Page 54: Supervised Learning Algorithms - Analysis of different approaches

Pipeline

Page 55: Supervised Learning Algorithms - Analysis of different approaches

Factorization Machine (degree 2)

Page 56: Supervised Learning Algorithms - Analysis of different approaches

General Applications of FMs

Page 57: Supervised Learning Algorithms - Analysis of different approaches

SummaryPipeline

Page 58: Supervised Learning Algorithms - Analysis of different approaches

Pipeline

Page 59: Supervised Learning Algorithms - Analysis of different approaches

FromprototypetoproducCon

•  PrototypevsProducConCme?–model(pipeline)shouldstaythesame

Page 60: Supervised Learning Algorithms - Analysis of different approaches

Libraries

Page 61: Supervised Learning Algorithms - Analysis of different approaches

QuesCons?

Page 62: Supervised Learning Algorithms - Analysis of different approaches

Thankyou!!!

Page 63: Supervised Learning Algorithms - Analysis of different approaches

References•  hRps://www.coursera.org/learn/machine-learning

•  hRp://www.cs.cmu.edu/~tom/•  hRp://scikit-learn.org/stable/•  hRp://www.scalanlp.org/•  hRp://www.algo.uni-konstanz.de/members/rendle/pdf/Rendle2010FM.pdf

•  hRps://securityintelligence.com/factorizaCon-machines-a-new-way-of-looking-at-machine-learning/

Page 64: Supervised Learning Algorithms - Analysis of different approaches

References

•  AnIntroducContoGeneralizedLinearModels–AnneReDobson,AdrianBarneR

•  ApplyingGeneralizedLinearModels–JamesLindsey

•  hRps://www.codementor.io/jadianes/building-a-recommender-with-apache-spark-python-example-app-part1-du1083qbw

•  hRps://www.chrisstucchio.com/blog/index.html