A computer program product comprising a non-transitory computer-readable storage medium having instructions encoded thereon that, when executed by a processor, cause the processor to perform steps comprising:
- sending a plurality of content items for display to a plurality of devices associated with a plurality of users of an online system;
- detecting one or more actions, associated with one or more content items of the plurality of content items, performed by one or more users of the plurality of users;
- accessing a plurality of machine-learning models trained to predict, for a user of the online system, a plurality of metrics associated with a plurality of objectives, the plurality of objectives associated with the online system or an entity associated with a content item, wherein each machine-learning model of the plurality of machine-learning models is trained by:
- receiving user data associated with the plurality of users,
- receiving, for each of the plurality of users, a label corresponding to a value of a corresponding metric for each of the plurality of users,
- applying each machine-learning model to the user data to generate an output including a second value of the corresponding metric for each of the plurality of users,
- comparing the output to the label, and
- updating, based on comparing the output to the label, a set of parameters of each machine-learning model;
- for each user of a set of users, applying the plurality of machine-learning models to a set of user data associated with each user of the set of users, a set of content item data associated with a set of content items, a frequency of presenting the set of content items to each user of the set of users, and an indication about a future time period for which each metric of the plurality of metrics is to be predicted to generate a plurality of values of the plurality of metrics for the future time period for each user of the set of users and a content item load indicative of a quantity of content items to be potentially presented per page of a user interface of a device associated with each user of the set of users, a different machine-learning model of the plurality of machine-learning models generating a value of the plurality of values of a different metric of the plurality of metrics or the content item load;
- generating a set of optimal values for the set of users based at least in part on the plurality of values of the plurality of metrics for the future time period generated for each user of the set of users, one or more objectives of the plurality of objectives, and a set of constraints, wherein each optimal value of the set of optimal values indicates whether a user of the set of users is eligible to be presented with the set of content items;
- storing the set of optimal values;
- responsive to identifying an opportunity to present the set of content items to a user of the set of users, accessing an optimal value from the set of optimal values that is generated for the user;
- determining, using information about the set of content items and information about the set of users, a set of additional criteria associated with the set of optimal values, each of the set of additional criteria indicating a context in which each user from the set of users is eligible to be presented with the set of content items;
- generating a tensor for the set of users by including into the tensor the set of optimal values and the set of additional criteria, the tensor including, for each user from the set of users, a first dimension storing a respective optimal value from the set of optimal values and a second dimension storing an indication describing the context in which the set of content items is eligible to be presented to each user;
- accessing the optimal value for the user and one of the set of additional criteria for the user by accessing corresponding first and second dimensions of the tensor that are associated with the user;
- determining, using the accessed optimal value and the accessed one of the set of additional criteria, that the user is eligible to be presented with the set of content items;
- and
- responsive to determining that the user is eligible to be presented with the set of content items, sending information about the set of content items and information about the content item load to a device associated with the user, wherein the sending causes a user interface of the device associated with the user to display the set of content items such that each page of the user interface displays the quantity of content items from the set of content items.