In [1]:
import pickle
from copy import copy, deepcopy
import numpy as np
import pandas as pd
from sklearn import neighbors, svm
import matplotlib as mpl

# Import Asterion modules
import read_database as rdb
import learn_data as ld
import asterion_learn as al
import visualize_data as vd

# Plotting settings for the current notebook
%matplotlib inline
font = {'size': 20}
mpl.rc('font', **font)
plotgrid = np.array([[0.0, 0.0], [1.0, 1.0]])

Load generated and real NEAs from the domain #4


In [2]:
dirpath = './asteroid_data/'
real_datasets = ['haz_real', 'nohaz_real']
gen_datasets = ['haz_gen', 'nohaz_gen']
genu_datasets = ['haz_gen', 'nohaz_gen']
name_suffixes = ['_dom4.p', '_dom4_rest.p']

In [3]:
dumps_real = [dirpath + ds + ns for ns in name_suffixes for ds in real_datasets]
dumps_gen = [dirpath + ds + ns for ns in name_suffixes for ds in gen_datasets]
dumps_genu = [dirpath + ds + ns for ns in name_suffixes for ds in genu_datasets]

haz_real, nohaz_real, haz_real_rest, nohaz_real_rest = map(rdb.loadObject, dumps_real)
haz_gen, nohaz_gen, haz_gen_rest, nohaz_gen_rest = map(rdb.loadObject, dumps_gen)
haz_genu, nohaz_genu, haz_genu_rest, nohaz_genu_rest = map(rdb.loadObject, dumps_genu)

In [4]:
gen_num = sum(map(len, [haz_gen, nohaz_gen]))
real_num = sum(map(len, [haz_real, nohaz_real]))

print "Number of virtual asteroids in the domain:", gen_num
print "Number of real asteroids in the domain:", real_num


Number of virtual asteroids in the domain: 50765
Number of real asteroids in the domain: 3561

Count down cummulative purity of the domain

Virtual asteroids


In [5]:
vd.print_summary([haz_gen], [nohaz_gen], haz_gen, nohaz_gen, 'virtual')


Number of correctly classified virtual PHAs 45450
Number of trapped virtual NHAs: 5315

Mass fraction of correctly classified virtual PHAs: 1.0
Mass fraction of trapped virtual NHAs: 1.0

Cummulative purity of the outlined PHA regions: 0.895301881217

Real asteroids


In [6]:
vd.print_summary([haz_real], [nohaz_real], haz_real, nohaz_real, 'real')


Number of correctly classified real PHAs 3321
Number of trapped real NHAs: 240

Mass fraction of correctly classified real PHAs: 1.0
Mass fraction of trapped real NHAs: 1.0

Cummulative purity of the outlined PHA regions: 0.932603201348

In [ ]: