Welcome back. In this video, I'm going to introduce the programming assignment for hybrid recommenders and learning to rank. In this assignment, you're going to work with hybridization, building two different hybrids. One of which is a learning to rank recommender, both in LensKit. You'll be running some experiments to tune these hybrids. So there are four components to this assignment. The first is building a hybrid item scorer that blends two scorers. This will be useful for both rating prediction and top end recommendation. You'll run an experiment to tune that hybrid. Then you're going to implement a Simple Learning-to-Rank style algorithm using the logistic regression approach from Xavier Amatrian's video. And then you'll do an experiment to evaluate how well that works compared to individual collaborative filters and to the linear blending hybrid on top-N recommendation task. To implement the LinearBlendItemScorer, we want you to use this formula that takes two scores, left and right and a bias model. That's going to show up in a few different places. And then a blending weight, beta. And what's going to happen with this model is when beta is 0, we're going to get only the left recommender. And when it's 1, we're going to get only the right recommender. When it's somewhere between 0 and 1, we're going to have a blend of these two recommenders. Now we're having you use the bias model, or a bias model to get a baseline score b sub ui. And then we're having you subtract that baseline from each of the scores. And this is going to give us a very natural way to deal with the situation when one of the scorers can't generate a score. Just make this whole term 0. And we can then blend either with one, we take advantage of whatever scoring information is available. We compute this blend between the two different scorers. Once you have that implemented, you're going to run an experiment that compared the effectiveness of this recommenders with different component recommenders such as item, item and SVD or CVF and SVD. And different blending weights to identify the best configurations which you'll then describe in a quiz in Coursera. So the code for this is the LinearBlendItemScorer which we'll need to finish implementing. And you receive a bias model for the baseline, left and right item scores in this blending weight. And what you need to do is you need to compute each of the blended scores for each of the items in the item score API. So that's the first half of the assignment. The second half is implementing a learning-to-rank style recommender. Really more learning to classify using a logistic regression approach. We're going to blend the following component. We're going to blend a bias model. We're going to use the user bias, but we're using the general bias model interface for this. One or more personalized scores such as the output of a matrix factorizer or an output of a nearest neighbor model. And a popularity term, so that we can prefer items that are more popular. We're going to put this into a logistic regression to predict whether or not the user has rated the item and we're going to use the resulting scores to do our recommendations. So, the logistic regression basically looks like this. We have this indicator variable that's 1 if the user's rated the item, -1 if they haven't. In this case, we're looking to just classify, have they rated? And we get the formula that the probability that they've rated it is equal to the sigmoid times a linear model that has an intercept. And it then it has several parameters with coefficients. And the training process is that we want to learn the appropriate parameters. These betas are the parameters and the coefficients or explanatory variables are going to be things such as the bias, the popularity, and the output of the different item scores. This is going to give us a way to combine the different scores into one score that then is oriented toward classification, not just the rating prediction problem. And the sigmoid function, the sigmoid is 1 over 1 + e to the -t. And what that does, is it creates a function that looks like this. Creates an S-shaped function. And then our t, What that does is it's going to be the value that fall somewhere along this line. And, the sigmoid function gives us a way to turn that basically into a probability statement. It's clamped at 0 and 1, and it gives us a way to take this, to have a function that's going to have a wide range of values. And then turn it into something that's going to produce a, basically, a probability that they've rated the item. So with that in hand, you're going to use this to hybridize. So, our different parameters, x1 is going to be the bias from the bias model. X2 is going to be the popularity, specifically the log of the popularity. When we have count data it is often useful to log it because the difference between 1,000 people buying something and 100 people buying something is not ten times as important as the different between 100 people and ten people. So, we oftentimes log counts. So we're going to log the popularity and then we're going to have scores from other item scores. The full details are in the assignment description. You're also going to be normalizing these scores by the bias, like you did in the linear blend. So with this model, you're going to need to implement two things. You're going to need to implement the LogisticItemScorer class that is going to use this model to compute scores. And then you're going to implement the LogiscticModelProvider class that's going to use gradient ascent. Gradient ascent is just the backwards version of the gradient descent that we use to train funk as we did, to learn the intercept beta sub 0. And coefficients beta sub 1, beta sub n, that are going to produce the model that best explains the data. We're going to do something called maximum likelihood estimation. We're maximizing the log of the likelihood that this model would produce the data that we see. In order to do this, we're giving you a few pieces. A RecommenderList class provides a list of item scorers that you can use in your hybrid. This is going to allow us to have one item scorer or two or three in your hybrid recommender. The LogisticTrainingSplit class handles some data splitting. So when we're doing a hybrid like this, we cannot train the subrecommenders that we're hybridizing on all of the data and then train our logistic regression on a piece of that data. What we need to do is split the training data for the recommender into two pieces. A training data for the sub-recommenders and then tuning data, that they don't get to see, that's used to figure out how to blend them to produce the final recommendations. There's a few others supporting classes in there as well that Java doc describes them in more detail. To do the model training, you're going to implement gradient ascent. So our goal is to maximize the likelihood of the data. And then to do that, we're going to use a couple of update rules for us to cast the gradient ascent. The rule for the intercept is just that y value, 1 or minus 1 times the sigmoid. And then the coefficients for the explanatory variables are going to be the explanatory variable times the indicator times the rest of the model. The sigmoid function, as I said before, is this 1 over 1 + e to the negative t. Once you have that done, you're going to run an experiment using different logistic recommender setups, with the individual base recommenders as well as your linear blend recommender. And you're going to compare the performance of these different recommenders and answer a quiz. Your submission for this assignment is going to be a compiled jar file and then answering the quizzes. We hope you find it useful.