chyikwei / recommend

recommendation system with python
310 stars 118 forks source link

BMF and PMF parameters #12

Closed kristosh closed 7 years ago

kristosh commented 7 years ago

Hi there, I am trying to figure out about the parameters of BMF and PMF algoriths that you are using to tune the equation of the optimization function. Could you please elaborate bit about the parameters needed tuning?

chyikwei commented 7 years ago

For PMF, you could change n_feature for latent variable size, reg for regularization, and batch_size, epsilon, momentum for rate of convergence.

For BPMF, n_feature is the same as PMF, and beta, beta_user, df_user, beta_item, df_item are hyper parameters in MCMC sampling.

All details are in this paper.

kristosh commented 7 years ago

Is it the case that PMF make use EM algorithm for optimize the equation function while BMF MCMC and the standard MF SVD?

chyikwei commented 7 years ago

PMF just use SGD, and BPMF use MCMC. (No SVD)

xuChenSJTU commented 7 years ago

Hi, I have a question here in you pmf model class code. The grads updating rule in your code are: image My question is that the grads of u is: image so, the ui and vj are not the same, why in your code are: image both multiply item_feature??? Could you please give me your inference procedure? Thank you very much!

chyikwei commented 7 years ago

@xuChenSJTU you are right!

It should be u_grads = i_features * err_mat + self.reg * u_features Thanks for finding the error. I will fix it.

xuChenSJTU commented 7 years ago

No thanks, in fact, there is still a question in your code I couldn't understand. Form the gradients inference equation, we got that, for every ui, even though the cij=0, it will be updated with the other item 2lambdaui. But in your code, you only use the train data, which means, when cij=0, you don't update the corresponding ui. Is this just a trick?

chyikwei commented 7 years ago

I think it depends on how you want to handle u_i when there is no records correspond to it.

In my current implementation, I keep u_i unchanged as 0.1 * rand_value. If you include regularization for it, then the value will just shrink toward 0. (I think both cases are fine though.)

xuChenSJTU commented 7 years ago

Hello, I studied the BPMF code. I found in my dataset, when the iterations=5 or 10, the rmse is similar to PMF method(test rmse=0.38), and the precision and recall are reasonable too(Recall@20: 0.83). When I set the iteration=50 or more, the test rmse will decrease too(test rmse=0.24), but the precision and recall value is non-sense(Recall@20:0.005). I don't know why, could you please tell me is there any special problem I need to pay attention to in BPMF. Thank you very much~~~

chyikwei commented 7 years ago

Hi, I am not sure what's the problem, but my guess is some item features become very large and cause the recall issue. You can try print out top predictions for each user and check why recall is so low.

chyikwei commented 7 years ago

close this now