<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by James Foley on Medium]]></title>
        <description><![CDATA[Stories by James Foley on Medium]]></description>
        <link>https://medium.com/@jcfoley?source=rss-262814c0266e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*w4BIR2vGUBVTeeqBGDwLiw.jpeg</url>
            <title>Stories by James Foley on Medium</title>
            <link>https://medium.com/@jcfoley?source=rss-262814c0266e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:10:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jcfoley/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Better, smaller, faster features with word2vec]]></title>
            <link>https://medium.com/building-ibotta/ibottaml-better-faster-smaller-features-with-word2vec-c8bd72404ba6?source=rss-262814c0266e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8bd72404ba6</guid>
            <category><![CDATA[word2vec]]></category>
            <category><![CDATA[blazingtext]]></category>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[amazon-sagemaker]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[James Foley]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 15:54:09 GMT</pubDate>
            <atom:updated>2019-09-13T15:56:28.897Z</atom:updated>
            <content:encoded><![CDATA[<h3>Better, faster, smaller features with word2vec</h3><h3>Motivation</h3><p>IbottaML is moving towards a <a href="https://labs.spotify.com/2016/08/07/commodity-music-ml-services/">service oriented architecture</a>, where we deliver ML services to stakeholders as opposed to features to our data lake. The feature requirements of these models are different from those of our batch prediction modeling frameworks; unlike our traditional large, sparse feature spaces these new features need to be compressed for portability, while maintaining predictability. To meet these needs, we designed a next generation feature engineering framework to incorporate more sophisticated methods that produce smaller, better features.</p><p>Our original feature store consists of both dense (aggregated features, e.g., total number of clicks) and <a href="https://scikit-learn.org/0.15/auto_examples/document_classification_20newsgroups.html">sparse features</a> (lower level features, e.g., number of clicks by category). Both feature types are interpretable, analytics-ready, and can be read into an encoder pipeline as-is. The sparse features, which are easily consumable by a <a href="https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.DictVectorizer.html">DictVectorizer</a>, are stored in the data lake as <a href="https://spark.apache.org/docs/latest/sql-reference.html#data-types">Spark MapTypes</a>:</p><p><em>{“apparel_clicks”: 2, “produce_clicks”: 6, “electronics_clicks”: 1, …}</em></p><p>But when we encode these sparse features across our user base and each key becomes a column, the dimensionality can explode in the wide direction to tens of thousands. This isn’t a problem for our models that predict in batch, as minimizing preprocessing time isn’t essential so we can include a <a href="https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html">dimensionality reduction</a> step in the preprocessing pipeline. But performing that preprocessing step is more challenging for our real time models, which need to be able to pick up features and deliver predictions as quickly as possible. We needed to build user level features offline so that they’re off-the-shelf ready for model input with little to no processing, and ideally, they hold more predictive power than a simple dimensionality reduction transformation.</p><h3>The Framework</h3><p>The framework we built learns how to represent a user given their action history. Take for example product purchases: the model takes as input the ordered sequence of user purchases and learns how products relate to one another simply with regard to adjacent items in the user’s “shopping basket”. Once these “latent product embeddings” are learned, we can aggregate those purchased by a given user to represent that user’s purchase history in the latent vector space. We build these latent aggregate features across various customer level contexts including transactions, in-app behavior, and search terms, which make up the LatentAF product suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*iIFaYjCofHNZZKCm4cmWww.png" /></figure><p>The LatentAF framework uses Amazon SageMaker’s <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/blazingtext.html">BlazingText</a> algorithm, an optimized implementation of <a href="https://www.tensorflow.org/tutorials/representation/word2vec">word2vec</a> (see <a href="https://medium.com/building-ibotta/heating-up-word2vec-blazingtext-for-real-time-search-c2121bd1396">this</a> IbottaML article for more details on how we use BlazingText). With all training jobs, transform jobs, and model artifacts managed by AWS, we’ve significantly simplified the portion of the production pipeline we need to maintain. We use word2vec’s <a href="http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/">skip-gram</a> model, but instead of training the model to learn word embeddings, we feed the model sequences of generic tokens, e.g. a sequence of product ID purchases that represent a user’s “recent shopping trip(s)” where the learned embeddings represent products. These product embeddings are similar to word embeddings, in that similar and complementary products will be closer to one another in the latent vector space, giving us a way to represent more dimensions of a product than just its metadata. Aggregating these embeddings up to the user level allows us to capture a time component as well as complementary product level relationships which don’t exist in our old sparse feature space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5kqrhEuxJrO7vlxiyZLs5g.png" /></figure><h3>Evaluation</h3><p>We did a thorough evaluation of these new features comparing them to our old feature space, training dozens of models that estimate a user’s propensity to buy certain products. <strong>The new latent features outperformed the old with an average AUC lift of 8%</strong>. In addition to being more predictive, the <strong>LatentAF vector dimensionality is 1/100th of the old sparse feature space</strong>, making these features more portable and faster for models to read. We also did some tuning around latent vector size (see table below) and word2vec performs highly effectively even when condensing a feature space of ~10,000 down to as small as 25:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*m-sEEG4z8fumuTaqRfvm-w.png" /><figcaption>Average model performance across various embedding sizes.</figcaption></figure><p>A by-product of these customer level features are the product level latent embeddings themselves, which are fun to play with and a good way to prove that word2vec is learning effective product representations. Focusing on the product category embedding space (representing the categories of products that users purchase, e.g., hair care, snack bars, pasta, etc.), we calculate the <a href="https://en.wikipedia.org/wiki/Cosine_similarity">cosine similarity</a> between each product category embedding pair in our vocabulary to represent how “close” each product category embedding is to another in the latent vector space. Given a particular product category of interest we can see the most similar product categories according to cosine similarity. Lets take for example the category “ketchup”; the five most similar category vectors are:</p><ol><li>mayonnaise</li><li>mustard</li><li>sauces</li><li>hot dogs</li><li>frozen potatoes</li></ol><p>The interesting thing about these “similar” categories is that they’re not necessarily similar, but highly complementary. For example, “hot dogs” and “frozen potatoes” aren’t as similar to “ketchup” as categories like “mayonnaise” or “mustard”, but they’re very complementary to “ketchup” because people often put ketchup on hot dogs and potatoes/hash browns. This strong association between complementary categories makes sense when we consider how these embeddings are learned, which is solely with regard to adjacent products purchased on users’ “shopping trips”. In other words, people tend to buy mayonnaise, mustard, sauces, hot dogs, and frozen potatoes alongside ketchup.</p><p>The plot below visualizes a variety of product category embeddings in 2-dimensional space (actual embeddings, not fake data). The distance between data points are relative to the closeness of their embeddings in the latent vector space and the color groupings represent distinct clusters of products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*RztVhEmHLyH-3fD4eXW07Q.png" /><figcaption>t-SNE plot of various product embeddings represented in 2-dimensional space.</figcaption></figure><p>As seen above, <em>grape</em>, <em>banana</em>, and <em>apple</em> are very similar as they’re all fruits. While tomatoes and avocados<em> </em>are technically fruits, they fall within the vegetable realm in most people’s minds and apparently according to people’s buying behavior too, as <em>tomato</em>, <em>avocado</em>, and <em>carrot</em> are close to the fruit cluster but seemingly distinct. The third cluster of products, <em>pizza</em>, <em>cookie</em>, and <em>cereal</em>, are clearly different from the fruit/vegetable clusters and seem to represent a variety of dry goods/less healthy food. Again, it’s very cool to see the model learn sensible relative representations of products given only ordered product IDs of users’ shopping trips.</p><h3>Conclusion</h3><p>With latent embeddings learned across various contexts, we’re able to fully represent a user’s purchasing behavior, app usage, etc. in a dense vector. We write these features to our on-demand feature store so our realtime models have easy access to them, and because these LatentAF features are significantly compressed our models can quickly consume complete user level information to make realtime predictions with minimal feature processing. Easy portability, high predictability, and a lighter weight production pipeline make for a feature engineering service that enables IbottaML to build next generation models to make a smarter, more efficient mobile app.</p><h3>We’re Hiring</h3><p>Ibotta is hiring <a href="https://ibotta.ruutly.com/job/1497795">Machine Learning Engineers</a>, so if you’re interested in working on challenging machine learning problems like the one described in this article then give us a shout. Ibotta’s career page <a href="https://home.ibotta.com/careers/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*MPoH9hhc7bL9XH3c8LucaQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8bd72404ba6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/building-ibotta/ibottaml-better-faster-smaller-features-with-word2vec-c8bd72404ba6">Better, smaller, faster features with word2vec</a> was originally published in <a href="https://medium.com/building-ibotta">Building Ibotta</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ibotta’s Recommender System]]></title>
            <link>https://medium.com/building-ibotta/ibottas-recommender-system-7a4034773bf9?source=rss-262814c0266e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a4034773bf9</guid>
            <category><![CDATA[ibotta]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[ibottaml]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[sklearn]]></category>
            <dc:creator><![CDATA[James Foley]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 22:46:48 GMT</pubDate>
            <atom:updated>2019-03-28T22:46:48.372Z</atom:updated>
            <content:encoded><![CDATA[<p><em>written by </em><a href="https://medium.com/@rjohnson0186"><em>Matt Johnson</em></a><em> and </em><a href="https://medium.com/@jcfoley"><em>James Foley</em></a></p><p>Our users are presented with a plethora of savings opportunities when they open the Ibotta app and the variety of available content is constantly growing. This leads to the interesting challenge of how to organize all that content. Is there an optimal arrangement of content for each user? Do we have enough signal in our data to model users’ shopping preferences? How do we scale a solution across millions of users? Product recommendations is one of many challenges addressed by IbottaML and in this piece we discuss the development of our latest recommender system.</p><h3>Evolution of recommendations at Ibotta</h3><p>Our goal as a Machine Learning team is to develop production quality features and scalable, high impact ML solutions across the organization. The Recommender system we’ve developed to serve personalized content to users is an ensemble of feature engineering and modeling components that embodies the standards we set for production quality, fully managed, large scale machine learning frameworks. This blog post outlines how IbottaML developed the Recommender pipeline used today, both from technical and product perspectives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*UFjHXDtaFwHXGYolr3cKSg.png" /><figcaption>Image from thedatascientist.com</figcaption></figure><p>Presenting users with content most relevant to them results in a more rewarding app experience; we save people time when users launch the app and can immediately see offers/products they like without having to search for them. We also have the opportunity to surface novel offers to users, encouraging them to try new things they will likely enjoy. In our situation though, effectively predicting what offers users will like is tricky:</p><ul><li>Not all offers are available to all users;</li><li>New offers are being introduced into the app each week so we have limited information on those offers;</li><li>New users are constantly joining the app so we have limited information on their preferences.</li><li>Scaling these predictions is also a major challenge when we commit to delivering daily recommendations to millions of users.</li></ul><p>Over time we’ve developed better ways of addressing these challenges, as we learn from each iteration of the recommender product.</p><p>The initial approach by the Analytics team to recommend content to users was tested through email communications. <a href="https://en.wikipedia.org/wiki/Cluster_analysis">Clustering</a> and <a href="https://en.wikipedia.org/wiki/Principal_component_analysis">PCA</a> were used to identify which types of items interest users, which determined the set of curated items to be surfaced in an email to users. The test yielded immediate positive results, proving to the team there’s value in building out personalized offer recommendations, so the Analytics team moved on to developing a system to power offer recommendations in the app. The first version of the Recommender system to be productionized blended various recommendation scores based on user purchase histories, overall offer popularity, and brand similarity mappings to create a set of recommended offers that were personalized for the user. These recommendations were calculated in batch, written to a database, then picked up by a service that served the content to a specific module/offer gallery in the app. A major milestone that came from this work, in addition to the incremental lift generated by the new recommender engine, was the development of the production pipeline that allowed us to directly insert offers into a user’s app experience. This pipeline allowed for quick iteration and testing of Recommender system variants.</p><p>Our second iteration of the Recommender was set up as a <a href="https://en.wikipedia.org/wiki/Supervised_learning">supervised learning</a> problem where we predict the propensity a user will purchase a given offer. We engineered features at the user and offer levels and combined those with output from collaborative filtering methods, feeding all features into a final supervised model. From this model we generated predictions for all user/offer pairs (representing a user’s propensity to interact with that offer), which lets us easily pick the top-ranked offers for every user. This machine learning based approach utilized more user- and offer level metadata, allowing for a deeper level of personalization as well as better recommendations for offers not previously purchased.</p><p>The evolution of the Recommender highlights an effective approach taken to develop and improve upon a product. We didn’t start by applying machine learning and developing a complex feature engineering pipeline, we instead built a simpler POC, tested it, and then pursued more sophisticated solutions after proven lift.</p><h3><strong>The Pipeline</strong></h3><p>Training a recommender model requires features that are predictive of a user engaging with an offer. Ibotta fortunately has a large feature bank that allows us to reuse features instead of having to start from scratch for each project (for more on Ibotta Feature Engineering, see <a href="https://medium.com/building-ibotta/feature-engineering-at-ibotta-9a0454ce2961">here</a>.). For the Recommender system we used hundreds of features, some of which were already available in our feature bank. In addition to these already available features, we constructed new ones that were hypothesized to be relevant to recommendations. These new features are now available for others at Ibotta to consume (available in a Hive metastore). Some of these new features include:</p><ul><li>ALS features (more on what this feature is in a moment)</li><li>Ratio of redemptions to impressions of an offer</li><li>Percent through lifecycle</li><li>Purchase Cadence</li></ul><p>Some of these features are hypothesized to interact. For example, suppose a user just purchased trash bags three days ago. Interacting with this feature of <em>days_since_last_purchase</em>, we have a feature that calculates the expected purchase cycle of this item. Given that the days since last purchase is a low number and the item has a low purchase frequency, these features will interact to adjust the probability of the relevancy of this offer.</p><p>The ALS features have the most power in predicting user engagements with offers. ALS (Alternating Least Squares) is a matrix factorization technique (for a deep dive into how ALS works, see <a href="https://mattshomepage.com/articles/2018/Jul/01/als/">here</a>) which, at a high level, constructs a matrix where each row represents a user, each column an item, and the cell value depends on the item context and the level of engagement. (An item can be the offer’s brand, the offer’s category, or the offer itself. <em>Engagements are </em><strong><em>unlocks</em></strong><em> and </em><strong><em>redemptions</em></strong><em>; a user will </em><strong><em>unlock</em></strong><em> an offer showing intent to purchase, and </em><strong><em>redeem</em></strong><em> an offer once purchased.</em>) For example, with a brand level context we calculate how many times a user purchased that brand in a given time period, whereas for the offer level context we determine how many times a user purchased that specific offer. We construct four such matrices:</p><p><strong>Row</strong>: User Id, <strong>Column</strong>: Offer Id, <strong>Cell Value</strong>: Redemptions</p><p><strong>Row</strong>: User Id, <strong>Column</strong>: Offer Id, <strong>Cell Value</strong>: Unlocks</p><p><strong>Row</strong>: User Id, <strong>Column</strong>: Brand Id, <strong>Cell Value</strong>: Unlocks</p><p><strong>Row</strong>: User Id, <strong>Column</strong>: Category Id, <strong>Cell Value</strong>: Unlocks</p><p>Now a lot of these entries will be missing since a user typically doesn’t interact with all items. When there’s a lot of missing entries, we refer to this as a <em>sparse</em> matrix. These matrices are factored into a product of two other matrices — this is known as matrix factorization. When this occurs, the machine learning model is able to automatically learn what values to fill in the missing cells. These inferred values are useful approximations for how we would expect users to interact with items they haven’t actually interacted with. We then use all these imputed values as features in their own right to the user-offer combination in context.</p><p>All of these features are then inputted into a <a href="https://en.wikipedia.org/wiki/Gradient_boosting#Gradient_tree_boosting">gradient boosted tree</a> machine learning model that predicts the propensity of a strong engagement for the user, where a strong engagement is defined as an offer unlock or redemption.</p><h3>Evaluation</h3><p>A natural question to ask after building a recommender model is: how well does this model perform? There are two common approaches to evaluation: offline and online metrics.</p><p><strong>Offline Metrics</strong></p><p>This technique is <em>observational</em>, in that we look at already collected data (e.g., which offers users have historically engaged with) and we “hide” this data from the model and see if we can predict it. This is an easy way to “grade” the performance of your model. A problem however, is that these offline metrics are often not well correlated with how your model will perform in the real world! So while it’s a rough tool to help drive early development, it’s not a rigorous technique on which one should report business metrics.</p><p><strong>Online Metrics</strong></p><p>This technique is <em>interventional</em>. An intervention is powerful in data science. In an intervention, you often have a treatment and a control (known as an A/B test). The control is the baseline — the offer recommender algorithm which produces content that Ibotta users are currently exposed to. The treatment is the new recommender algorithm — the content arrangement from which users have not yet been exposed. Then, a random proportion of users are assigned the new recommender output. The other users will continue getting the current recommender output. We let this experiment run over a few weeks and then we calculate several metrics using a technique developed <a href="https://medium.com/building-ibotta/multiple-responses-in-a-b-testing-1f7db3346c66">here</a> at Ibotta.</p><p>We actually tested several different recommender models (12 in total) against the control. Some of these model variants included modifying the time windows we look over, how we aggregate redemptions and unlocks, etc. The model that was selected maximized metrics across several different outcomes (e.g. increased user activity, highest revenue, etc.). As an example, our internal MVT framework (Multivariate Testing Framework, which generalizes an A/B test to A/B/C/D/…) automatically published the graphic below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kcrq1F6fA0u572JH" /><figcaption>For each treatment, probability that treatment is best</figcaption></figure><p>This bar chart reports the probability that each treatment is the highest for the given metric (in this example, unlocks). The tallest bar seen here (around 60%) corresponds to the model we ended up selecting.</p><h3><strong>Productionization</strong></h3><p>Delivering over one billion offer recommendations daily is no small feat; building feature sets, training models, making predictions, and loading recommendations into the app, all while considering computation efficiency requires a robust, monitored production pipeline. This pipeline executes every day because we want to ensure we’re making fresh offer recommendations for our users. So as new offers are introduced, as new users join the app, and as ongoing users’ purchase histories and app behaviors update, we can incorporate this new information to generate the most up-to-date recommendations each day.</p><p>Retraining the model daily requires amalgamating various features from our data lake and defining target values, for which we use Spark. Joining together dozens of tables to create a final set of offer level and customer level features is not a simple process. Some challenges we dealt with were data skew, optimal file sizing, Spark application parameter tuning, and generally munging and shipping hundreds of gigabytes of features each day. Training data is passed to the model, which is also fit via Spark where grid searching is executed in parallel, model performance metrics are logged, and the model is saved to S3.</p><p>Once the new model is trained we’ll pass it the most recent set of features to make predictions, which we distribute and parallelize using Spark. At this point we have a table comprising the propensity a user will engage with a offer, for every eligible user:offer combination. We then take the top <em>n</em> offers for each user and ship that data to a production data store that feeds data to the app, so that when any user opens the app a lookup is made to surface their recommended offers, what we call the For You gallery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gjb6FhQwHA6dn09YG6nlhg.png" /></figure><p>Our latest Recommender had a significant impact to the business. It’s an example of how machine learning is not only interesting, but highly practical. It has helped move key metrics for our business, which means our users are having more efficient and personalized experiences within the app.</p><h3>We’re Hiring</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*xiy6lIxBzMFAKz3Eb7fFRg.png" /></figure><p>IbottaML is hiring <a href="https://boards.greenhouse.io/ibotta/jobs/1459084">Machine Learning Engineers</a>, so if you’re interested in working on challenging machine learning problems like the one described in this article then give us a shout. Ibotta’s career page <a href="https://ibotta.com/careers">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a4034773bf9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/building-ibotta/ibottas-recommender-system-7a4034773bf9">Ibotta’s Recommender System</a> was originally published in <a href="https://medium.com/building-ibotta">Building Ibotta</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature Engineering at Ibotta]]></title>
            <link>https://medium.com/building-ibotta/feature-engineering-at-ibotta-9a0454ce2961?source=rss-262814c0266e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a0454ce2961</guid>
            <category><![CDATA[predictive-analytics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[app-development]]></category>
            <dc:creator><![CDATA[James Foley]]></dc:creator>
            <pubDate>Mon, 30 Apr 2018 20:28:52 GMT</pubDate>
            <atom:updated>2018-04-30T20:28:52.201Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Predicting the Availability of Products</strong></p><p>Feature Engineering at Ibotta is part of the larger Data Science team. This is our mission:</p><blockquote>“To enhance our underlying data asset by leveraging scalable machine learning models to extract valuable information from raw data sources.”</blockquote><p>We build and maintain our own production processes, which typically deliver updated data features to stakeholders on a daily basis. The work associated with building and maintaining our production tables involves training statistical models, applying model predictions to billions of data points each week, leveraging Spark to scale these jobs, and utilizing Apache Airflow to coordinate the daily execution of these jobs.</p><p>Some examples of these features and uses are:</p><ul><li>Predicted behavioral shopper segments — used by Marketing to personalize messaging to our user base.</li><li>Product metadata generating framework — used by Analytics and Data Science for more detail into what Ibotta users are buying.</li><li>Brand propensity scores — used by Recommendation Systems to recommend relevant content to users in the app.</li></ul><p>The remainder of this piece will focus on the finer details of one Feature Engineering project in particular; predicting the availability of products at stores.</p><p>The Ibotta mobile app presents to users a variety of products at a range of retailers; we call these “offers” within a “retailer module”, as seen in the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*HnT5S6lqX0NaIv6-Nkmv9A.png" /><figcaption>Offers in the Ibotta Gallery</figcaption></figure><p>Within the Ibotta app there exist some offers presented within retailer modules where the product advertised isn’t sold at that retailer store, or at that retailer at all; one example is the “Mobile 1 Motor Oil” offer that was presented within the Whole Foods module, the other classic example is alcohol offers presented at Colorado grocery stores that don’t sell alcohol.</p><p>This problem is inevitable given the way in which offers are set up and associated with retailer categories, but the current state is unacceptable because these incompatible offer/retailer combinations are filling up valuable gallery space in the app and misleading customers resulting in a poor user experience. While likely unsolvable, like many problems the FE team addresses, we had some ideas for methods to mitigate the issue.</p><p>The plan is to treat this problem with a supervised learning solution, meaning we build a dataset to train a model to predict the likelihood a given product is available at a particular store. In addition to product and store metadata and other engineered features likely indicative of availability status, the training dataset requires target labels (“available”/”unavailable”) representing truly (or likely truly) available and unavailable product/store combinations. We have many instances of products being purchased across many stores (the positive availability class), but it’s trickier to find certain instances of the negative class (unavailable) because a lack of purchase history of a product doesn’t necessarily imply unavailability.</p><p>It’s challenging enough to build a model to predict the availability of a product at a particular retailer. However, we want to personalize content down to the store level and we want the model to predict the availability of a product at <em>any</em> given store. This is more challenging for a couple reasons;</p><ul><li>There are a hundred thousand stores and hundreds of thousands of products which makes for a lot of predictions, and</li><li>The landscape of product/store purchases is sparse across all product/store combinations.</li></ul><p>The data sources used for this project are clean_txns and customer_offer_not_founds, both tables in the data lake.</p><ul><li>clean_txns: a cleaned record of all submitted receipt item purchases on our customers with added metadata such as product brand and categories, store zip code and dma, etc.</li><li>customer_offer_not_founds: a collection of all products that users have reported as being unavailable at particular stores.</li></ul><p>The latter is a potentially useful source for identifying more-likely-unavailable product/store pairs, but the data is sparse and the presence/absence of a product in the table should not absolutely determine unavailability/availability. The data in clean_txns is also sparse at the product/store level, therefore we’ll need to engineer some “features” to give the model more information to work with.</p><ul><li>“feature”: an individual measurable property/characteristic of a phenomenon being observed.</li><li>“feature engineering”: the process of creating features which enable machine learning algorithms to work in practice (hence our team name).</li></ul><p>For the model that predicts the availability of products at stores, examples of simple features are category_1 of the product (e.g., the category_1 for a gallon of milk would be “dairy”), brand of the product, zipcode of the store, retailer of the store, etc. An example of an engineered feature is a score representing the likelihood the brand of a product is available at a particular retailer.</p><p>In order to get engineered features such as the aforementioned brand/retailer score we need to train a model to predict the likelihood a brand is available at a retailer. This is an easier model to train because rolling transaction data up to the brand/retailer level (as opposed to the most granular product/store level) is not nearly as sparse, yielding a more robust training set.</p><p>We built twenty-five of these models, each trained to predict the availability of a “thing” at a “place”, where “things” are product-level attributes (global product, brand, category1, category2, category3) and “places” are store-level attributes (store, zip code, DMA, retailer, DMA/retailer nested). We store the availability predictions for all possible “thing”/”place” combinations for each of the twenty-five models in tables which will be referenced when building out the full feature space for the final product/store model.</p><p>Below is an example of what the brand/retailer score table might look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67lmW5ZzFUs1jbReslHhHg.png" /></figure><p>When we apply the final product/store model to predict the likelihood “Ben &amp; Jerry’s Vanilla Ice Cream, 16 oz” (product) is available at “King Soopers 1950 Chestnut Pl Denver CO” (store), the brand/retailer score feature would be 0.9486 according to the example above.</p><p>Below is a list containing other input features when predicting availability of the above example:</p><ul><li>Observed # purchases</li><li>Days since the last purchase</li><li>Observed # offer-not-found reports</li><li>Days since the last offer-not-found report</li><li>% of observations that are purchases (as opposed to not-founds)</li><li>(Days since last purchase) — (days since last not-found)</li><li>Prob.(frozen foods (cat1) available in Denver, CO (DMA))</li><li>Prob.(frozen novelties (cat2) available in 80202 (zip))</li><li>Prob.(Ben &amp; Jerry’s (brand) available at King Soopers (retailer))</li><li>…</li></ul><p>This stacked ensemble of models (the method of building a model that uses features generated by other models) provides additional signal for the final model we build. Since we don’t have dense enough data at the product/store level to build a good training set to train a product/store level model, engineering the additional score features at higher levels (e.g., brand, category, DMA, retailer, etc.) provides a richer feature set and therefore more signal for the product/store model to interpret.</p><p>The following diagram depicts the design and interaction of models in the stacked ensemble.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*11TcFwuNcu7eBo9kNAP7wg.png" /></figure><p>The next step is testing this availability feature in the app, which involves removing offers that are likely unavailable at particular retailer locations. It’s difficult to evaluate the performance of this model across the full product/store spectrum because there is no source of truth for what is available at any given time. So testing/evaluating various thresholds of availability predictions will allow us to optimize the set of offers we determine to be available at a given retailer in a given region.</p><p>Relating the execution of this project back to the FE team mission, it can be seen that we’re enhancing the underlying data asset by building a feature that enables accurate in-app offer filtering, which we accomplish by developing a framework to train and apply machine learning models that extract valuable information from data sources in the data lake.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a0454ce2961" width="1" height="1" alt=""><hr><p><a href="https://medium.com/building-ibotta/feature-engineering-at-ibotta-9a0454ce2961">Feature Engineering at Ibotta</a> was originally published in <a href="https://medium.com/building-ibotta">Building Ibotta</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>