Context-aware and hybrid recommendations

· 6 min read

So far, we have learned about collaborative filtering, content-based, and session-based recommendations. None of these approaches takes the situational context under consideration. Factors such as mood, occasion, location, company, etc., can affect user preferences and needs. Context-aware recommendations take these conditions into account to provide more relevant recommendations.

Hybrid approaches combine two or more classical ones to provide recommendations. Thus they can tackle the drawbacks and issues arising from using single approaches.

In this blog, we’ll walk through:

  • What are context-aware recommendations?
  • Different approaches to providing context-aware recommendations.
  • Three main designs of hybrid recommendations.
  • Parallelized hybridization technique.

Context-based approach to recommendations

User tastes and preferences are context-dependent. Your location, people you are with, or time of day can influence your preferences or needs. Context-aware recommendations use this (environmental) context in the recommendation process.

Traditional recommender systems (e.g., content-based or collaborative filtering approaches) use two-dimensional (2D) datasets. They consider only Users and Items as the input for the recommendation process. Context-aware recommendations also use environmental information to predict user preferences. Thus they are multi-dimensional.

Context-aware recommendation model

Representing contextual information

Interactions in context-aware recommender systems bear more information than in traditional approaches. Thus, you can no longer use a bi-graph to represent them. Users, items, and the context can be represented in an n-partite graph. Here the events are connected to the contextual elements with many relationships.

N-partide graph representing contextual information about events

As the context can include several factors (time, weather, location, etc.), it can be very specific. The more specific the context, the harder it is to find events that happened in the same context. You can solve this problem by introducing hierarchies in the contextual information. Hierarchies/taxonomies broaden the context and thus allow you to find similar contexts.

Example of a hierarchy

Providing recommendations

The contextual information can be used at different phases of the recommendation process. ou can take one of the following approaches based on the amount and type of data and the frequency of new data.

Contextual process

Contextual pre-filtering

Contextual pre-filtering uses context at the very beginning of the recommendation process. The context acts as a filter for selecting the relevant data. After doing so, you can use a traditional (2D) approach to provide recommendations.

This approach builds a local model for each context. When the context is too specific, you can apply hierarchies to generalise it.

Contextual pre-filtering is easy to implement. Its main advantage is that it can use any traditional (2D) recommendation approach. Given that relevant data about context is available, the results are accurate.

The main disadvantage is the data-sparsity problem. While using hierarchies to broaden the context helps, it decreases recommendation accuracy. You also need to pre-build, and keep updated, a large number of models (for different contexts).

It is hard to assess whether the local model performs better than a traditional, global model. Whether pre-filtering or classical 2D approaches perform better depends on many conditions.

Contextual post-filtering

Contextual post-filtering uses a traditional recommender approach first. The context is used afterwards to filter the results. This approach is more straightforward as you build only one general model.

The simplicity of this model also translates to its easy implementation. As in pre-filtering, you can use any traditional approach to provide recommendations.

The downside is that the prediction accuracy is almost independent of the context. Thus the recommendations are not much more accurate than the traditional methods. Data sparsity also poses an issue in this approach.

Contextual modelling

Finally, in contextual modelling, the context is used right away in the model building. The User x Item x Context dataset is represented as a multidimensional matrix. A random walk approach is used to compute the relevance of the nodes in the graph.

Multidimensional matrix

The results here are the most accurate as the context is taken into consideration from the start.

Nevertheless, this approach and its models are complex and hard to implement. The creation of the models also requires a lot of computational power.

Context-aware recommendations are more accurate as they take more factors into account. However, they are complex and face the data sparsity problem.

Context node information

Graphs partially solve these challenges as they can help you:

  • Represent the User x Item x Context data.
  • Speed up the filtering phase.
  • Prevent the data sparsity problem.
  • Store the multi-model results of contextual pre-filtering.
  • Simplify the selection of relevant data based on the current user and context.
  • Store multidimensional matrices (in contextual modelling).

Hybrid recommendation engines

Traditional recommender approaches have different drawbacks.

Hybrid systems combine different approaches to avoid these problems.

There are three main designs of hybrid recommendations:

  • Monolithic design combines several recommendation strategies in one algorithm. Thus there are different kinds of input data available for the recommender systems. This way, there is always enough data to provide relevant recommendations.
  • Parallelized design combines the different recommender systems subsequently. The recommender systems provide their separate lists of recommendations, which are later merged.
  • Pipelined design connects recommender systems in a pipeline architecture. The output of one recommender becomes a part of the input of the next one. The later recommender components may also use parts of the original input data.

Hybridization process

Parallelized hybridization technique

Let’s dig deeper into the parallelized design, which is the easiest to implement and extend, the faster, and in many cases, the more accurate. This design allows multiple recommender systems to run at the same time. Each recommender system produces its own set of recommendations. These are mixed or merged during the recommendation phase.

Hybrid models

Graphs allow you to store and combine the results of different recommender models in a single data source. To do this, you can use three strategies:

  • Mixed. You can take the individual lists of recommendations and show them to the users’ side by side. You might need to adjust the recommendations to avoid too many overlaps.
  • Weighted. You can also provide the final list of recommendations by computing weighted sums. You select criteria based on which you assign the weights and provide the top-scored ones to the end user. This way, you can, e.g., prioritise content-based recommendations when you don’t have enough data for collaborative filtering.
  • Switching. Finally, you can set up rules based on which one of the recommender systems will be used. These rules can be based on the recommendation quality or information about users.

Overall, graphs allow you to store multiple sets of information in a single structure. The resulting models of different recommender systems can also be stored together. This makes it easier and faster to access them during the recommendation phase.

Conclusion

This blog is the final one in the recommendations series. Graph Powered-Machine Learning introduced collaborative filtering, content-based, session-based, and context-aware recommendations. Each of these approaches alone has its own challenges. Hybrid recommender systems combine the traditional approaches to avoid these challenges.

Alexandra Klacanova