I'm reading about 7 million lines of data and it takes close to two minutes to load everything up when I restart my application. I'm trying to figure out the best way to speed things up so that it only takes a few seconds at most to restart the application. Here is the code I'm looking to speed up and the amount of time it currently takes:
// Creating data model - this takes about 1.77 minutes
DataModel datamodel = new FileDataModel(new File("datafile"));
// ItemSimilarity object - this takes about 1 millisecond
ItemSimilarity similarity = new TanimotoCoefficientSimilarity(datamodel);
// Recommender - this takes about 3 milliseconds
ItemBasedRecommender irecommender = new GenericBooleanPrefItemBasedRecommender(datamodel, similarity);
// List of Recommendations - this takes about 365 milliseconds
List<RecommendedItem> irecommendations = irecommender.mostSimilarItems(item, amount);
I'm wondering if:
- there is a way to output the
DataModel
to another file so that I could just read it in instead of having to create it every time? - If that is possible then is it possible to output the data from the
ItemSimilarity
to another file and just read that in instead of creating theDataModel
and calculating theItemSimilarity
every time?