Where do you get data for building and testing a real-time analytics system for a conference? Simulate it!
Assume that customers are given badges with RFID tags so that their movements can be tracked, recorded, and analyzed in real time. We want to simulate their movement through a conference floor as they visit company booths. I propose a model combining physics and machine learning models.
First, we want to quantify the interactions between individuals booths and individual customers. We can do this by reverse engineering a factor analysis model with latent factors. A factor analysis model assumes that the relationship between customers and products can be modeled using a lower dimensional space (i.e., customers represent combinations of a few basic profiles.) A factor model can be written like so:
where is a x matrix giving the interaction strengths (preferences) for customers and products. The x matrix gives the latent factors with weights for each of products. The x matrix gives the customers’ weights for each of the latent factors. Note that . The part of the customers’ interactions that cannot be accounted for by the latent factors is modeled as error () and usually assumed to be Gaussian distributed.
We model customer preferences for booths by randomly generating the matrices and and computing . (The error is optional.) Generating the latent factors instead of directly generating is preferable since it ensures that the behavior of groups of customers will be driven by the same set of patterns.
Once the preferences for each customer are known, we model the customer movement as particles in a 2D space with booths as attractive sources. We can describe the attractive effect of the booths using an inverted, scaled Gaussian:
where is a 2D vector of the position of the customer , is a 2D vector of the position of the booth , and is the interaction strength between customer and booth . The values come from the matrix . (Note that the interactions may need to be scaled to get the desired “residence times.”) The function B represents a force acting as a boundary condition (e.g., the shape of the room) so that particles don’t float off into oblivion. (Note that there are no interactions between the particles themselves – we could add some if desired.)
The positions of the particles in time is found by numerically integrating the Langevin Equation:
The Langevin equation is the standard plus a damping term and a random term. The damping and random term are related by the variable . The Langevin equation provides us with a few advantages including injecting randomness into the customers’ paths and allowing the velocities of the customers to vary so they can “escape” the pull of the magnets. (The distribution of the velocities is controlled by the temperature – we can choose so that the velocities are inline with walking speed.)
The customers’ preferences for certain booths can be inferred by measuring the residence time, or basically, the elapsed time between a customer entering and leaving the radius of a booth.
Implementation and Evaluation
In future posts, I’ll describe my implementation and evaluation of the model.