recommenders / rival

RiVal recommender system evaluation toolkit
rival.recommenders.net
Apache License 2.0
150 stars 40 forks source link

Added Iterative Splitter to minimize memory usage when creating folds. #123

Closed afcarvalho1991 closed 7 years ago

afcarvalho1991 commented 7 years ago

Implemented CrossValidationSplitterIterative<U, I> Created a test to assess if the modifications are valid CrossValidatedIterativeMahoutKNNRecommenderEvaluator In CrossValidationSplitter, the visibility of the following variables was change to protected: 1 - nFolds; 2 - perUser; 3 - rdn. Modified TemporalDataModel constructor userItemTimestamps was not initialized. For this reason, there are commented sections in CrossValidationSplitterIterative<U, I> to allow the execution of the testing. Results from CrossValidatedIterativeMahoutKNNRecommenderEvaluator: NDCG@10: 0.02932215503411596 RMSE: 1.1055677436810647 P@10: 0.04110286320254521

BUG from previous version (master) -> Need to be fixed-> CrossValidatedMahoutKNNRecommenderEvaluator not working, see Log below.

----------------------------- LOG --------------------------------------

5 [main] INFO org.apache.mahout.cf.taste.impl.model.file.FileDataModel - Creating FileDataModel for file data/ml-100k/model/train_0.csv 52 [main] INFO org.apache.mahout.cf.taste.impl.model.file.FileDataModel

Reading file info... Exception in thread "main" java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:601) at java.lang.Long.parseLong(Long.java:631) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.readTimestampFromString(FileDataModel.java:632) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.addTimestamp(FileDataModel.java:595) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processLine(FileDataModel.java:512) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processFile(FileDataModel.java:340) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.buildModel(FileDataModel.java:236) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.reload(FileDataModel.java:208) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:194) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:149) at net.recommenders.rival.examples.movielens100k.CrossValidatedMahoutKNNRecommenderEvaluator.recommend(CrossValidatedMahoutKNNRecommenderEvaluator.java:160) at net.recommenders.rival.examples.movielens100k.CrossValidatedMahoutKNNRecommenderEvaluator.main(CrossValidatedMahoutKNNRecommenderEvaluator.java:93) ------------------------------- end-LOG --------------------------------

André Carvalho

abellogin commented 7 years ago

Hi,

regarding the error in CrossValidatedMahoutKNNRecommenderEvaluator, it seems it was generated in commit e9f996f, where a "-1" was deleted after the last delimiter in DataModelUtils.

I will create an issue now.

Thanks, Alex

afcarvalho1991 commented 7 years ago

@alansaid I will revise the code and remove those commented sections when the CrossValidatedMahoutKNNRecommenderEvaluator is fixed. Those commented sections avoid a runtime error when executing CrossValidatedIterativeMahoutKNNRecommenderEvaluator.

Tomorrow I will have a look and provide an updated version with your requests.

André.

abellogin commented 7 years ago

Hi André,

as you may already know, that class is fixed (see #124 ), so, please, update your code accordingly and the pull request (I am not sure how the reviews work, tho) whenever you have the time.

alansaid commented 7 years ago

Thanks @afcarvalho1991!

afcarvalho1991 commented 7 years ago

Glad that I could help!