concept training in category recommender system

appears as: training, training
Practical Recommender Systems

This is an excerpt from Manning's book Practical Recommender Systems.

  • Training— A leftover term from the AI world where you consider machine learning as learning a new skill. In our case, the recommender is training (calculating the model) to find similar items.
  • Figure 9.5. Offline evaluation splits data into training and test sets before testing the recommender algorithm.
    Listing 9.9. Splitting the data into training and test data
    def split_data(self, min_rank, ratings, test_users, train_users):
        train = ratings[ratings['user_id'].isin(train_users)]                  #1
        test_temp = ratings[ratings['user_id'].isin(test_users)]               #2
    
        test_temp['rank'] = test_temp.groupby('user_id')['rating_timestamp'] \
                                   .rank(ascending=False)                    #3
        test = test_temp[test_temp['rank'] > min_rank]                         #4
    
        additional_training_data = test_temp[test_temp['rank'] >= min_rank]    #5
        train = train.append(additional_training_data)                         #6
    
        return test, train                                                     #7
    

    Funk also mentions that he had different ideas of how to calculate the prediction error. You have so many possible combinations of setting the levers, but the best way to go about it is to come up with a hypothesis and then do test runs as shown earlier. Another way to look at the data is to compare the error of the training to the test error. This is shown in figure 11.18. It’s important that the lines have a more or less 45-degree angle such that the test error is proportional to the training error.

    Figure 11.18. Comparing test MSE with training MSE shows if you’re starting to overfit.

    Many advise you to run the test for a certain number of times, such as 50 or 100, while others recommend that you look at the RMSE for each iteration and when the change in RMSE is below a value, stop. If you do plot the MSE as in figure 11.18, it’s a good idea to look for the elbows in the chart. The elbow is often where you stop fitting the algorithm to the known data and start overfitting the algorithm. A line in figure 11.18 shows the training of 75 factors. You can see the test MSE has a little elbow around 400 iterations. Here you should only use 20 factors because the 20 factor test line has a small elbow around 275 iterations, so that may be a good place to stop.