I would like to use the time a user spends viewing an article as an implicit rating of how much the user likes the article.

My question is how do I normalize this information across all users.

At the moment, I'm subtracting the time spent by the user-specific mean, and dividing by the standard deviation.

Is this the right way to go about it? It doesn't seem so, as the ratings can still take any values.

Maybe I should scale the ratings into some interval (like [$1$-$10$]) after?


3 Answers 3


If you are going to populate the entire userxarticle matrix with dwell-times, you are going to run in to sparsity issues very quickly.

Also, a simple average of dwell-times is prone to many problems, for example, what if you have very few records, or if one user left her browser open for a month ?

Step #1: Filling in the blanks

From my experience dealing with user dwell time, The amount of users that spend $t$ seconds viewing a site, decreases greatly as $t$ increases.

I found out that modelling user dwell-time as an Exponential curve, is a good approximation.

Using the Bayesian approach, and using the Gamma distribution as the prior distribution on the mean of each site's dwell-time, we get a familiar formula:

Harmonic mean:


Where $t_i$ is the time spent on site $i$, $b$ is the bias you introduce and $m$ is its strength.

For example, setting $b=3,m=2$ is like assuming two fictional users viewed a site for 3 seconds when we have no data for that userxarticle combination.

And note that this formula is much more immuned to outliers, since it assumes the exponential distribution (and not the Gaussian distribution like the arithmetic mean)

Step #2: Populating the matrix

Times are positive, and they have a certain bounds that make sense (for example, maximum of one day).

However, after the matrix factorization, any numeric value can appear in the matrix cells, including negative terms.

The common practice is to populate the userxarticle matrix with $$logit(t)$$ Where logit is the inverse of the sigmoid function.

And then when interpolating the dwell time for a user $i$ and article $j$, we use:


Instead of only using the dot product.

This way we can be certain that the end result would be bounded to a certain range that makes sense.

  • $\begingroup$ logit can only be computed on values between 0 and 1. Do you mean here by t time divided by the user-specific average time? $\endgroup$
    – silentser
    May 16, 2017 at 15:52

Hu, Koren, and Volinsky faced a similar problem, for which they proposed the solution in Collaborative Filtering for Implicit Feedback Datasets. The example that they used was for time spent watching TV shows, but I will put in terms of time reading articles.

Their basic idea was that the most important aspect was whether or not a user looked at an article or not. Therefore, they created a matrix with binary entries, where each $(u,i)$ of the matrix represent whether or not the user $u$ looked at article $i$. The goal is to estimate this binary entry as well as possible. Feeling that there is also some value in the length of time reading, they weighted each entry of the matrix. All the $0$ entries got a weight of $1$. Letting $r_{ui}$ be the amount of time spent reading the article, they proposed a few weighting schemes for the non-zero entries:

  1. $w_{ui} = 1 + \alpha r_{ui}$
  2. $w_{ui} = 1 + \alpha \log (1 + r_{ui} / \epsilon)$

where $\alpha$ and $\epsilon$ are tuning parameters.

Finally, they used matrix factorization techniques to estimate the binary entries using squared error loss and the weights given above. I have a simple implementation of Hu et al.'s algorithm in R at https://github.com/andland/implicitcf.

More recently, Johnson proposed to extend this technique in Logistic Matrix Factorization for Implicit Feedback Data. The idea is basically the same but uses a logistic transformation and the negative weighted Bernoulli log likelihood as a loss function.

  • $\begingroup$ Well the Rui matrix defines how much user u prefers item i. If you simply input the dwell time values, I think this will lead to long article recommendations where dwell time will be significantly higher. You need a proper way to normalize for item length and user reading speed. $\endgroup$ Mar 1, 2019 at 11:44

There is also a different less sophisticated method to handle this. However, I recon Uri Goren's proposed methods probably work better.

I used a different method to normalize the time spent on a article page. I divided the time by the amount of words of the article.

Also, I set a maximum of time spent on page by looking at the average reading time. By dividing the lenght of an article by the maximum time someone would need to read that article, an upper bound was set. In that way outliers were handled.

I would also recommended utilising more implicit feedback variables such as scroll lenght. This variable can be used to enforce the time spent on a page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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