---
format:
    revealjs:
        theme: simple
        chalkboard: true
        auto-stretch: false
---

## Feature Engineering Demos

Keith VanderLinden<br>
Calvin University

## Demo

- Feature Engineering
- Data Leakage
- Feature Store

::: {.notes}
1. Review the feature engineering elements of the TagIfAI notebook:
    - Data - Loaded the two CSV datasets (provided).
    - Wrangling - Joined the datasets.
    - Pre-processing - Engineered the title/description feature-cross. 
        - SLO used a similar tweet text X tweet author bio feature-cross.
2. G. Mohandas mostly assumes that the processes implemented in the TagIfAI notebook avoid data leakage.
    - He doesn't view TagIfAI Web documents as being time-sequenced (thus, there's no random sampling of time-series data).
        - SLO made a similar assumption about the tweets, which may be less valid.
    - He avoids the other no-no's of data leakage:
        - Removing empty values
            - TagIfAI only dropped untagged documents, which we'll assume is truly MCAR.
            - SLO dropped tweets from unknown authors - potential leak (MAR or even MNAR).
        - Aggregation before splitting
            - TagIfAI did only text pre-processing.
            - SLO was ok here as well.
        - SLO did "peek" at test data in that we did many rounds of model training and testing, sometimes remodeling based on the test results.
3. Implement feature store capabilities (management/computation/consistency) by:
    - Following MwML's Data preprocessing [best practices](https://madewithml.com/courses/mlops/preprocessing/#best-practices) by scripting the pre-processing. We'll then use the same script for off-line training and for on-line inference.
    - Pushing the resulting dataset to a database (MongoDB) for later use.
:::

## Snapshot

*See the live demo.*

![](images/feature-store-demo.png)

::: {.notes}
Give snapshot of "feature store" in MongoDB/Atlas.
:::
