-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6_visualise_ml_data.py
More file actions
36 lines (27 loc) · 867 Bytes
/
6_visualise_ml_data.py
File metadata and controls
36 lines (27 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import matplotlib.pyplot as plt
import pandas as pd
import numpy
from pandas.plotting import scatter_matrix
url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.csv"
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
data = pd.read_csv(url, names=names)
# Histogram
data.hist()
# Density Plot
data.plot(kind='density', subplots=True, layout=(3,3), sharex=False)
# Box and Whisker
data.plot(kind='box', subplots=True, layout=(3,3), sharex=False, sharey=False)
# Correlations matrix plot
correlations = data.corr()
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(correlations, vmin=-1, vmax=1)
fig.colorbar(cax)
ticks = numpy.arange(0,9,1)
ax.set_xticks(ticks)
ax.set_yticks(ticks)
ax.set_xticklabels(names)
ax.set_yticklabels(names)
# Scatter Plot
scatter_matrix(data)
plt.show()