Esempio n. 1
0
 def test_dame_gender_features_list_categorical(self):
     g = Gender()
     flc = g.features_list_categorical('files/names/partial.csv')
     self.assertEqual(len(flc[0]), 6)
     self.assertEqual(flc[0], [112, 101, 0, 0, 1, 0])
Esempio n. 2
0
import pandas as pd
import matplotlib.pyplot as plt
from app.dame_gender import Gender
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--csv')
args = parser.parse_args()

g = Gender()

if (args.csv == 'nocategorical'):
    g.features_list_no_categorical("files/names/all.csv")
    g.features_list2csv(csv="nocategorical")
    data = pd.read_csv('files/features_list_no_cat.csv', index_col=0)
elif (args.csv == 'categorical'):
    g.features_list_categorical("files/names/all.csv")
    g.features_list2csv(csv="categorical")
    data = pd.read_csv('files/features_list_cat.csv', index_col=0)
else:
    g.features_list2csv("files/names/all.csv")
    data = pd.read_csv('files/features_list.csv', index_col=0)

#data = pd.read_csv('files/features_list_cat.csv', index_col=0)
#data = pd.read_csv('files/features_list.csv', index_col=0)
corr = data.corr()
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(corr, cmap='coolwarm', vmin=-1, vmax=1)
fig.colorbar(cax)
ticks = np.arange(0, len(data.columns), 1)
ax.set_xticks(ticks)