I have a problem of the form "what is the probability that a user will 'like' a certain movie?" For a bunch of users, I know the movies each has watched historically, and the movies each has liked. Additionally, for each movie I know the name of the director.

I calibrated a logistic regression for each user of the form:

glm(liked_by_user_1 ~ liked_by_user_2 + ... + liked_by_user_k + factor(director), family=binomial, data = subset(MovieWatchings, user_id == 1))

But my problem is: say that in the past, user 1 has watched movies from directors D1 through DM, but next month U1 watches a movie directed by DN? In that case the R predict() function will give an error, because the glm model for user 1 doesn't have an estimated parameter for the case of director = DN. But I must know something about U1's probability of liking the new movie, because I still know which other users have seen and liked this movie, and that has some predictive power.

How can I set up my model so that I can take into account other users' liking behavior, AND user 1's director preferences, but still have sensible predictions when user 1 sees his first movie from a new director? Is logistic regression even the right type of model for this case?


If you know nothing about director N (ie whether they make similar movies to director G) it would seem to me that your best chance would be to substitute for factor(director) in your linear predictor the "average" value of the director coefficients. This would require estimating who the average director is and using them instead of DN.

Alternatively, you could fit the model without the factor(director) as an explanatory variable at all. If the purpose is to predict a value based on a certain set of explanatory variables, there's not good including in the model something that isn't going to be available to the predictor.

A final comment, not really part of the "answer" to your question - it seems likely that the variables liked_by_user_2 ... liked_by_user_k will be highly collinear. Collinearity can play havoc with predictive models; one reason why parsimonious models are generally preferred for predictve purposes. Whether this is a problem for you (and what should be done about it) depends on how big k is compared to your sample size.

  • $\begingroup$ That seems like a reasonable approach. Do you think there's a difference between your proposal of using a weighted mean of the director coefficients, compared to a 2 stage model where first I calibrate a model based only on other users' likes, and then on top of that model calibrating a set of "director multipliers", which would by definition have a mean of 1? Re: collinearity, I'm keeping k small compared to the number of rows by applying some simple heuristics. I've also considered clustering the users into cohorts based on like patterns, where # cohorts << # users $\endgroup$
    – tws
    Feb 21 '12 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.