-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexp_3_plot.py
84 lines (71 loc) · 2.33 KB
/
exp_3_plot.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 8 15:35:07 2015
@author: thalita
plots for exp 3
"""
from utils import read_results, plot_metric, plot_metrics, pd_select
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import expdb
from itertools import chain
matplotlib.rcParams['ps.useafm'] = True
matplotlib.rcParams['pdf.use14corefonts'] = True
outdir = '/tmp/'
#%%
exp_db = expdb.ExperimentDB()
result = exp_db.db
colors = 'bgrcmyk'
all_metrics = ['P','R','F1','RMSE','MAE']
ir_metrics = ['P','R','F1']
trad_metrics = ['RMSE','MAE']
#%%
select = {'RStype': 'BMFRPrecommender',
'RPtype': 'sparse',
'mincoverage': 1 ,
'threshold': 3 ,
'offlinekNN': 'False',
'neighbortype': 'user',
'algorithm': 'brute',
'metric': 'cosine'}
select_BMF = dict(select)
del select_BMF['RPtype']
select_BMF['RStype'] = 'BMFrecommender'
data = pd_select(result, select_BMF)
data['RStype'] = 'BMFRPrecommender'
data['dimred'] = 1
data['RPtype'] = 'sparse'
tmp = pd.concat((result, data), ignore_index=True)
plot_metrics(all_metrics,
varpar=('dimred', [1, 0.9, 0.8, 0.75, 0.5, 0.25]),
across=('nneighbors', 'num. de vizinhos'),
dataframe=tmp, select=select,
labelfmt='%d%%|D|', labelmul=100,
suptitle='Recomendação BMF+RP esparsa - BMF 100% e limiar 3')
plt.savefig(outdir + 'BMFRP_sparse_dimred_nneighbors.eps')
#%%
select = {'RStype': 'BMFRPrecommender',
'RPtype': 'gaussian',
'mincoverage': 1 ,
'threshold': 3 ,
'offlinekNN': 'False',
'neighbortype': 'user',
'algorithm': 'brute',
'metric': 'cosine'}
select_BMF = dict(select)
del select_BMF['RPtype']
select_BMF['RStype'] = 'BMFrecommender'
data = pd_select(result, select_BMF)
data['RStype'] = 'BMFRPrecommender'
data['dimred'] = 1
data['RPtype'] = 'gaussian'
tmp = pd.concat((result, data), ignore_index=True)
plot_metrics(all_metrics,
varpar=('dimred', [1, 0.9, 0.8, 0.75, 0.5, 0.25]),
across=('nneighbors', 'num. de vizinhos'),
dataframe=tmp, select=select,
labelfmt='%d%%|D|', labelmul=100,
suptitle='Recomendação BMF+RP gaussiana - BMF 100% e limiar 3')
plt.savefig(outdir + 'BMFRP_gaussian_dimred_nneighbors.eps')