Collaborative filtering algorithms recommend items to users based on the preferences of similar users. They work by building a model from user preference data on many items. The model can then be used to predict item preferences for new users based on similarities to other users with similar preferences. Alternating least squares (ALS) is an iterative collaborative filtering algorithm that approximates the user-item rating matrix as the product of two dense matrices to discover latent features of users and items.