Top Banner

Click here to load reader

Python and Machine Learning - BCN Python Meetup - 25th Sep 2014

Jun 14, 2015

ReportDownload

Technology

Conceptual presentation on Artificial Intelligence (AI) and Machine Learning before BCN Python Meetup group on sep 25th, 2014

  • 1. Python and Machine LearningPresented by Xavier ArrufatBCN Meetup - Python and AIBarcelona, September 25th, 2014

2. AI Artificial Intelligence1. a branch of computer science dealing with the simulation of intelligent behavior in computers2. the capability of a machine to imitate intelligent human behaviorMerriam-Webster dictionary 3. 2010: a supercomputer will have the computational capacity to emulate human intelligence2020: this same capacity will be available for US$1000Mid 2020s: human brain scanning to contribute to an effective model of human intelligence2029: these two elements will culminate in computers that can pass the Turing testEarly 2030s: the amount of non-biological computation will exceed the "capacity of all living biological human intelligence"."I set the date for the Singularityrepresenting a profound and disruptive transformation in human capabilityas 2045"Ray Kurzweil, Director of Engineering, Google (see Wikipedia on his 2005s book The singularity is near )Inventions: OCR, image scanners, text to voice synth, (orchestra) synthesizer, voice recognition, reader for the blind, Predictions on AI 4. Source: Ray Kurzweil and Kurzweil Technologies, Inc. 5. ndiceTuring TestPython for AIBarcelona, September 25th, 2014Turing TestBlade Runner (Ridley Scott, 1982): Deckard and the Voight-Kampff machine in 2019.Inspired on Philip K. Dick's book "Do Android's Dream of Electric Sheep (1968) 6. ndicePassing the Turing Test: capabilitiesPython for AIBarcelona, September 25th, 2014Turing Test(classic Turing Test)Natural Language Processing - communicationKnowledge representation - knowledge storage (KS)Automated reasoning - use KS to answer questionsMachine Learning - detect patterns, adapt (total Turing Test)Computer vision - perceive objectsRobotics - manipulate objects + move aroundSource: Artificial Intelligence, a modern approach by Stuart Russel & Peter Norvig. 7. Basic Concepts: Machine Learning paradigmMachine Learning (ML) and PythonWhat do I need to do ML in Python?ndiceAgendaPython for AIBarcelona, September 25th, 2014Agenda 8. ndiceClassical decision making (explicit instructions)Python for AIBarcelona, September 25th, 2014Classical decision makingInput[0.8][0.2][0.9][0.2][0.0][0.4][0.3][0.1]OutputABCFeatureF0F1F2F3F4F5F6F7Procedure:if F1 > 0.5 and F2 * F3 < 0.3:if (F4 F5) / F6 < 1:do Aelse:if F7 * F0 < 0.3:do Belse:do Celse:do BRequires a priori knowledge 9. ndice(some) ML methodologiesPython for AIBarcelona, September 25th, 2014ML methodologiesLinear RegressionLogistic RegressionSVM: Support Vector MachinesANN: Artificial Neural NetworksAnomaly DetectionNearest NeighborPrincipal Component Analysis (PCA)Supervised LearningUnsupervised Learning 10. ndiceML decision makingPython for AIBarcelona, September 25th, 2014ML decision makingInput[0.8][0.2][0.9][0.2][0.0][0.4][0.3][0.1]Output A B CFeatureF0F1F2F3F4F5F6F7Procedure:Output = MATRIX * Input(Linear Regression)Output = g( M2 * f( M1 * Input) )(Neural Network with one hidden layer)Requires no (or very little) a priori knowledge 11. ndiceML supervised learning: training casesPython for AIBarcelona, September 25th, 2014ML supervised training[0.8] [0.2] [0.9] [0.2] [0.0] [0.4] [0.3] [0.1]CInputTargetCase 0[0.8][0.2][0.9][0.1][0.5][0.6][0.2][0.9]Case 1[0.7][0.1][0.2][0.8][0.2][0.1][0.4][0.0]Case 2ABA[0.9] [0.4] [0.3] [0.3] [0.1] [0.4] [0.2] [0.2]Case 1000[][]LabelsExpected Output 12. ndiceML training(when no exact solution available)Python for AI Barcelona, September 25th, 2014ML trainingGenerate MATRIX0 ( 0, stochastically generated)Output0 = MATRIX0 * InputError0 = Target Output0 => MATRIX1 = MATRIX0 + f(Error0, MATRIX0, )Iterate until: Errori < toleranceOutputi = MATRIXi * InputErrori = Target Outputi => MATRIXi+1 = MATRIXi + f(Errori, MATRIXi, )=> Intensive number crunching may be requiredInitialization(error) Minimization 13. ndiceML and Python [can I do (fast) ML with Python?]Python for AIBarcelona, September 25th, 2014ML and Python 14. ndiceML and Python [can I do (fast) ML with Python?]Python for AIBarcelona, September 25th, 2014ML and PythonYES and Id recommend it in most of the cases 15. ndicePython tools for ML(just a personal recommendation for starters)Python for AIBarcelona, September 25th, 2014Python toolsTake Andrew Ngs course on Coursera (uses Matlab/Octave)Learn some basic linear algebraUse numpyLibraries: Scikit-learn, Theano, PandasUse gnumpy for GPU number crunching (dependency: cudamat) https://twitter.com/xavier_arrufat/status/299810134627086336 (feb 2013)Play, play, playYour brain is a more powerful pattern detector than you think! 16. Some additional (inspiring) info on ML:http://yann.lecun.com/exdb/lenet/http://www.iro.umontreal.ca/~bengioy/yoshua_en/index.htmlhttp://www.cs.toronto.edu/~hinton/: check video links, specially:http://www.youtube.com/watch?v=DleXA5ADG78http://www.youtube.com/watch?v=AyzOUbkUf3Mhttp://www.youtube.com/watch?v=VdIURAu1-aU 17. Q & A