You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Generates predictions using fitted_model on respective CV test data
413
+
predictions = fitted_model.transform(ft_pair[1])
414
+
415
+
# Generates and prints a ROEM metric CV test data
416
+
r = ROEM(predictions)
417
+
print ("ROEM: ", r)
418
+
419
+
# Fits model to all of training data and generates preds for test data
420
+
v_fitted_model = model.fit(training)
421
+
v_predictions = v_fitted_model.transform(test)
422
+
v_ROEM = ROEM(v_predictions)
423
+
424
+
# Adds validation ROEM to ROEM list
425
+
ROEMS.append(v_ROEM)
426
+
print ("Validation ROEM: ", v_ROEM)
427
+
428
+
# Import numpy
429
+
import numpy
430
+
431
+
# Find the index of the smallest ROEM
432
+
i = numpy.argmin(ROEMS)
433
+
print("Index of smallest ROEM:", i)
434
+
435
+
# Find ith element of ROEMS
436
+
print("Smallest ROEM: ", ROEMS[i])
437
+
438
+
# Extract the best_model
439
+
best_model = model_list[38]
440
+
441
+
# Extract the Rank
442
+
print ("Rank: ", best_model.getRank())
443
+
444
+
# Extract the MaxIter value
445
+
print ("MaxIter: ", best_model.getMaxIter())
446
+
447
+
# Extract the RegParam value
448
+
print ("RegParam: ", best_model.getRegParam())
449
+
450
+
# Extract the Alpha value
451
+
print ("Alpha: ", best_model.getAlpha())
452
+
```
453
+
454
+
Binary Ratings can use Implicit Ratings as well. In addition we could tweak the weights of users or movies (in ROEM)
263
455
264
456
265
457
266
458
267
459
268
460
### Other Resources
269
461
462
+
[Collaborative Filtering for Implitcit Feedback Datasets by Hu, Koren, Volinsky](http://yifanhu.net/PUB/cf.pdf)
463
+
464
+
270
465
[McKinsey&Company: "How Retailers Can Keep Up With Consumers"](https://www.mckinsey.com/industries/retail/our-insights/how-retailers-can-keep-up-with-consumers)
271
466
272
467
[ALS Data Preparation: Wide to Long Function](https://github.com/jamenlong/ALS_expected_percent_rank_cv/blob/master/wide_to_long_function.py)
0 commit comments