Mercurial > hg > hybrid-music-recommender-using-content-based-and-social-information
comparison Code/eda.py @ 27:ae650489d3a8
Updated report
author | Paulo Chiliguano <p.e.chiilguano@se14.qmul.ac.uk> |
---|---|
date | Sun, 30 Aug 2015 15:49:27 +0100 |
parents | e4bcfe00abf4 |
children |
comparison
equal
deleted
inserted
replaced
26:e4bcfe00abf4 | 27:ae650489d3a8 |
---|---|
217 # fp += 1 | 217 # fp += 1 |
218 # elif score > rating_threshold and sim_value < EDA_treshold: | 218 # elif score > rating_threshold and sim_value < EDA_treshold: |
219 # fn += 1 | 219 # fn += 1 |
220 # elif score <= rating_threshold and sim_value < EDA_treshold: | 220 # elif score <= rating_threshold and sim_value < EDA_treshold: |
221 # tn += 1 | 221 # tn += 1 |
222 print tp, fp, fn, tn | 222 #print tp, fp, fn, tn |
223 if tp != 0: | 223 if tp != 0: |
224 precision = tp / (tp + fp) | 224 precision = tp / (tp + fp) |
225 recall = tp / (tp + fn) | 225 recall = tp / (tp + fn) |
226 F1 = 2 * precision * recall / (precision + recall) | 226 F1 = 2 * precision * recall / (precision + recall) |
227 else: | 227 else: |
261 start_time = time.time() | 261 start_time = time.time() |
262 profile_u, prob, fffitness = eda_train(users_likes_subset(users_train[i])) | 262 profile_u, prob, fffitness = eda_train(users_likes_subset(users_train[i])) |
263 elapsed_time = time.time() - start_time | 263 elapsed_time = time.time() - start_time |
264 print 'Training execution time: %.3f seconds' % elapsed_time | 264 print 'Training execution time: %.3f seconds' % elapsed_time |
265 | 265 |
266 pi, ri, fi, ai = evaluate_eda(profile_u, users_test[i]) | 266 pi, ri, fi, ai = evaluate_eda(profile_u, users_test[i], N=20) |
267 p = np.append(p, pi) | 267 p = np.append(p, pi) |
268 r = np.append(r, ri) | 268 r = np.append(r, ri) |
269 f = np.append(f, fi) | 269 f = np.append(f, fi) |
270 a = np.append(a, ai) | 270 a = np.append(a, ai) |
271 | 271 |