Machine Learning: The Ultimate Guide for Beginners and Starters (Artificial Intelligence, Algorithms, Data Science, Machine Learning For Beginners) by Andy Grey

Machine Learning: The Ultimate Guide for Beginners and Starters (Artificial Intelligence, Algorithms, Data Science, Machine Learning For Beginners) by Andy Grey

Author:Andy Grey
Language: eng
Format: azw3, epub
Published: 2017-07-01T07:00:00+00:00


Loading the Data

Now we are set up, it’s time to load the data. For this, we are using the iris dataset, famous for being used as the “Hello World” dataset that everyone starts off on. This dataset has 150 iris flower observations in it with 4 columns containing flower measurements in centimeters. The last column contains the species of iris and all the flowers in the dataset belong to one of the three species listed.

The file is in CSV format.

The first thing to do is load up the libraries that we need so input the following script in the Python interpreter:

# Load libraries

import pandas

from pandas.tools.plotting import scatter_matrix

import matplotlib.pyplot as plt

from sklearn import model_selection

from sklearn.metrics import classification_report

from sklearn.metrics import confusion_matrix

from sklearn.metrics import accuracy_score

from sklearn.linear_model import LogisticRegression

from sklearn.tree import DecisionTreeClassifier

from sklearn.neighbors import KNeighborsClassifier

from sklearn.discriminant_analysis import LinearDiscriminantAnalysis

from sklearn.naive_bayes import Gaussians

from skarns import SVC

If you see any errors, stop and start again. Copy and paste if necessary because you need a fully working SciPy environment before you can go any further

To load the dataset, we are going to use pandas and we will also use pandas to explore this data using data visualization and descriptive statistics. Note that, to do this, we are going to specify the column names – you will find this very helpful later for exploring the data.

Input this script into your interpreter:

# Load dataset

url = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"

names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']

dataset = pandas.read_csv(url, names=names)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.