MACHINE LEARNING WITH PYTHON - Themistoklis Diamantopoulos

1y ago
4 Views
1 Downloads
960.17 KB
23 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Jenson Heredia
Transcription

MACHINE LEARNING WITH PYTHON Themistoklis Diamantopoulos

Contents Part 1: Introduction to Machine Learning Classification with Decision Trees Classification with Naïve Bayes Classification with SVMs Part 2 Classification and Regression with kNN Linear and Polynomial Regression Feature Selection and Feature Extraction Centroid-based and Connectivity-based Clustering

INTRODUCTION TO MACHINE LEARNING

What is Machine Learning? Subfield of Artificial Intelligence Term coined in 1959 by Arthur Samuel Progressively improve performance on a specific task with data, without being explicitly programmed

Types of Machine Learning tasks Supervised Learning Learn output based on input data Unsupervised Learning Find structure in given data Reinforcement Learning Learn from the environment

Supervised Learning tasks Classification Regression Source: ervised-learning-14f68e32ea8d

Classification Classify data to 1, 2 or more classes Confusion Matrix Predicted Class Actual Class Positive Negative Positive TP FP Negative FN TN P TP FN N FP TN Evaluation Metrics Accuracy (TP TN) / (P N) Precision TP / (TP FP) Recall TP / (TP FN)

Regression Build a model that fits the data Actual (yi) and predicted values (ŷi) Mean Absolute Error 1 n MAE yˆi yi n i 1 Mean Squared Error 1 n 2 ˆ MSE y y ( ) i i n i 1 Coefficient of Determination SSres 2 R 1 SStot SSres where n SStot ( yi yˆi ) and i 1 2 n ( yi y ) i 1 2

Unsupervised Learning tasks Clustering Dimensionality Reduction

Clustering Cluster data according to their features Evaluation Metrics Cohesion (Within Cluster Sum of Squares) Separation (Between Cluster Sum of Squares) Silhouette where a average distance of i to the points in its cluster b min(average distance of i to points in another cluster) Source: https://www-users.cs.umn.edu/ kumar001/dmbook/slides/chap7 basic cluster analysis.pdf

Dimensionality Reduction Transform the data to extract useful information Measure correlation Maximize variance Evaluation Metrics Percentage of Variance Cumulative Percentage of Variance Source: omponent-analysys

MACHINE LEARNING METHODOLOGY

Machine Learning Steps Data cleaning and preprocessing equally important with model selection and training Data Gathering Data Cleaning Data Preprocessing Prediction Evaluation and Tuning Model Training

Data Splitting Use training data to train the model Some data can be used to validate the model validation set Use folds of training data for validation Cross-validation Evaluate the model on test data Test set must not overlap with training data Test Training Training Validation Test

Tribes of Machine Learning Source: -machine-learning-infographic/

A brief history course 1960s: golden age of AI Predictive Statistical Algorithms Linear Regression 1805 KNN 1951 K-Means 1957 Support Vector Machines 1963 Logistic Regression 1958 Bayesian Networks 1985 Adaboost 2003 Decision Trees Random Forest 1963 1995 Source: e-learning-can-save-us-from-cybercriminals/

Machine Learning Applications Source: rning-applications-by-industry/

MACHINE LEARNING WITH PYTHON

Set of Powerful Libraries Source: entific-computing-case

Machine Learning Libraries numpy Arrays: universal point of reference in the python ML world pandas Data manipulation made easy scipy Basis of scientific computing scikit-learn (Almost) all machine learning algorithms you will ever need matplotlib Plot all of the above and all of these are seamlessly connected!

The Scikit-learn Library Almost any model you will ever need Source: http://scikit-learn.org/stable/tutorial/machine learning map/index.html

Scikit-learn Examples Very easy to use from sklearn.svm import SVC model SVC(gamma 0.1) model.fit(x train, y train) y pred model.predict(x test) Create, Train, and Run Model Supports multiple data transformations And multiple evaluation metrics from sklearn import metrics print(metrics.classification report(y test, y pred)) print(metrics.confusion matrix(y test, y pred)) print(metrics.accuracy score(y test, y pred)) Classification Evaluation Metrics Source: uction-to-machine-learning-with-scikitlearn

Time for hands-on!

Introduction to Machine Learning Classification with Decision Trees Classification with Naïve Bayes Classification with SVMs Part 2 Classification and Regression with kNN Linear and Polynomial Regression Feature Selection and Feature Extraction Centroid-based and Connectivity-based Clustering

Related Documents:

Python 2 versus Python 3 - the great debate Installing Python Setting up the Python interpreter About virtualenv Your first virtual environment Your friend, the console How you can run a Python program Running Python scripts Running the Python interactive shell Running Python as a service Running Python as a GUI application How is Python code .

Python Programming for the Absolute Beginner Second Edition. CONTENTS CHAPTER 1 GETTING STARTED: THE GAME OVER PROGRAM 1 Examining the Game Over Program 2 Introducing Python 3 Python Is Easy to Use 3 Python Is Powerful 3 Python Is Object Oriented 4 Python Is a "Glue" Language 4 Python Runs Everywhere 4 Python Has a Strong Community 4 Python Is Free and Open Source 5 Setting Up Python on .

Python is readable 5 Python is complete—"batteries included" 6 Python is cross-platform 6 Python is free 6 1.3 What Python doesn't do as well 7 Python is not the fastest language 7 Python doesn't have the most libraries 8 Python doesn't check variable types at compile time 8 1.4 Why learn Python 3? 8 1.5 Summary 9

site "Python 2.x is legacy, Python 3.x is the present and future of the language". In addition, "Python 3 eliminates many quirks that can unnecessarily trip up beginning programmers". However, note that Python 2 is currently still rather widely used. Python 2 and 3 are about 90% similar. Hence if you learn Python 3, you will likely

There are currently two versions of Python in use; Python 2 and Python 3. Python 3 is not backward compatible with Python 2. A lot of the imported modules were only available in Python 2 for quite some time, leading to a slow adoption of Python 3. However, this not really an issue anymore. Support for Python 2 will end in 2020.

A Python Book A Python Book: Beginning Python, Advanced Python, and Python Exercises Author: Dave Kuhlman Contact: dkuhlman@davekuhlman.org

Mike Driscoll has been programming with Python for more than a decade. He has been writing about Python on his blog, The Mouse vs. The Python, for many years. Mike is the author of several Python books including Python 101, Python Interviews, and ReportLab: PDF Processing with Python. You can find Mike on Twitter or GitHub via his handle .

Launch Eclipse Install Python plug-in for Eclipse Add a Python Interpreter Create a Python Project Create a Python Program Run a Python Program Debug a Python Program 0 Introduction This tutorial is for students who want to develop Python projects using Eclipse. E