-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetadata_visualization.py
34 lines (29 loc) · 1.09 KB
/
metadata_visualization.py
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
import numpy as np
import matplotlib.pyplot as plt
def load_data():
data = np.load('clean2.npy')
return data
def plot_histogram(data, xlabel, ylabel):
n, bins, patches = plt.hist(data,bins='fd',range=(0,2000000))
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.grid(True)
plt.show()
#plt.savefig(xlabel+'-'+ylabel+'-Histogram',format='svg')
def plot_scatter(x, y, xlabel, ylabel):
plt.scatter(x,y,marker='+')
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.show()
#plt.savefig(xlabel+'-'+ylabel+'-ScatterPlot',format='svg')
data = load_data()
#plot_histogram(data[:,2],'Sold Prices','Frequency')
a = np.fabs(data[:,2] - data[:,3])
print(np.mean(a))
b = np.divide(a, data[:,2])
print('Percentage of data where list price is within 3% of sold price', np.mean(b <= 0.03))
print('Percentage of data where list price is within 10% of sold price', np.mean(b <= 0.1))
print('Percentage of data where list price is within 20% of sold price', np.mean(b <= 0.20))
print(100*np.mean(b))
#plot_scatter(data[:,3], data[:,2], 'List Price', 'Sold Price')
#plot_scatter(data[:,6], data[:,2], 'Square footage', 'Sold Price')