Mastercard / pages /Help.py
BlendMMM's picture
Update pages/Help.py
22fb4ed verified
raw
history blame contribute delete
No virus
11.4 kB
# Importing necessary libraries
import streamlit as st
st.set_page_config(
page_title="Model Build",
page_icon=":shark:",
layout="wide",
initial_sidebar_state="collapsed",
)
import numpy as np
import pandas as pd
from utilities import set_header, load_local_css, load_authenticator
import pickle
import base64
load_local_css("styles.css")
set_header()
st.header('MASTERCARD MMO TOOL')
st.subheader('Overview')
st.markdown('The tool was developed in accordance with the best practices for building Marketing mix models for different clients and businesses. The tool can be used for building various MMM models, optimize spends and execute various simulations. ')
st.markdown('Last Updated: 3/26/24')
user=st.radio("Select User",['Data Scientist','Media Planner'],horizontal=True,index=1)
if user=='Data Scientist':
with st.expander('**Data Import**'):
st.markdown("""
The Data Import page allows users to bring in any additional data apart from what’s being fetched using APIs and processed by Data Engineering pipelines and standardize both API and non-API data to the desired end granularity. It features options for feature engineering, variable grouping, and data imputation. Additionally, it provides a comprehensive summary of all actions performed on the page, ensuring a transparent and efficient data preparation process.
**Features:**
- **Categorization:** Allows for the categorization of similar variables for streamlined analysis.
- **Feature Engineering:** Enables the creation and grouping of columns to build better models.
- **Data Imputation:** Provides methods to fill in missing or incomplete data values.
""")
with st.expander('**Data Validation**'):
st.markdown("""
This page is designed to enhance data quality and insights, focusing on selected targets and panels. It offers Response Metric Analysis, Univariate and Bivariate Report, alongside Media and Non-Media Variables Analysis. Correlation is explored to ensure a thorough validation process.
**Features:**
- **Response Metric Analysis:** Evaluates the performance metrics and trends relevant to the selected target and panel.
- **Univariate and Bivariate Report:** Offers a detailed univariate and bivariate report.
- **Variables Analysis:** Evaluates the significance of media and non-media variables for the chosen target/panel and validates the variables to be considered for the next steps.
- **Correlation Analysis:** Utilizes correlation plots to reveal the relationships between variables.
""")
with st.expander('**Transformation**'):
st.markdown("""
Transformation capabilities include Media and Exogenous Transformations such as lag, lead, moving average, power, saturation, and adstock adjustments. This page not only applies these transformations but also summarizes the process and the order of operations, providing clarity on the data's manipulation.
**Features:**
- **Transformations:** Applies specific alterations (lag, lead, moving average, power, saturation, and adstock) to media and exogenous variables to enhance model performance.
- **Summarization of Transformation:** Provides a detailed overview of all transformations applied, including their sequence.
""")
with st.expander('**Build Model**'):
st.markdown("""
This feature integrates transformation creation with model building for both panel and non-panel levels. It streamlines the process, making it easier for users to construct and refine their models based on the transformed data. After building models, this page assists in selecting the best fit and provides a detailed summary. It includes comparisons of Actual vs. Predicted outcomes, Residual Analysis, and Variance Inflation Factor (VIF) for both test and train datasets.
**Features:**
- **Diverse Models:** Constructs models for various metrics using OLS and mixed effect models.
- **Model Selection:** Chooses the most significant model utilizing metrics such as coefficients, P-value, R Square, Adjusted R Square, and MAPE.
""")
with st.expander('**Model Tuning**'):
st.markdown("""
###
Model Tuning offers advanced options like Event Flags, addition of Trends, Cyclical Pattern, sine and cosine waves. These features help in refining the model by accounting for specific events, trends, and seasonal patterns.
**Features:**
- **Event Flags:** Incorporates the effect of specific events on the target.
- **Trends:** Incorporates long-term trends and seasonality.
- **Cyclical Pattern:** Utilizes sine and cosine waves to capture and adjust for seasonal variations.
- **Contributions Analysis: Calculates contributions from the tuned model for each media channel
""")
with st.expander("**Save Model Results**"):
st.markdown("""
This page saves the model's outcomes, including channel contributions, an EDA report, and a thorough Analysis of Model Results. It's designed to document and preserve the work done for future reference.
**Features:**
- **Channel Contribution:** Details the impact of each media channel on outcomes.
- **EDA Report:** Provides an exploratory data analysis summary.
- **Analysis of Model Results:** Offers a comprehensive review of the model's performance.
""")
with st.expander('**Model Results Overview**'):
st.markdown("""
This section provides a comprehensive overview of historical spending, including channel-wise spends, revenue, ROI, and weekly contributions. It also details channel spends and revenue on a week-by-week basis, offering a granular look at financial performance.
**Features:**
- **Spends Analysis:** Breaks down channel-wise spend and revenue.
- **ROI and Contributions:** Evaluates return on investment and weekly/aggregated channel performance.
""")
with st.expander('**Build Response Curves**'):
st.markdown("""
This page updates response curves and allows for testing and saving these fits. It's essential for understanding how different levels of spending affect outcomes and for refining marketing strategies.
**Features:**
- **Response Curve Update:** Allows for the modification and refinement of response curves.
- **Curve Testing and Saving:** Facilitates the evaluation of curve fits and preserves/download curve parameters.
""")
with st.expander('**Scenario Planner**'):
st.markdown("""
The Scenario Planner page enables forward and reverse optimization, allowing users to either maximize targets given certain spends or minimize spends given a target revenue. It includes responsive S curves for multiple channels and optimizes them accordingly.
**Features:**
- **Optimization:** Supports both forward and reverse financial planning, with adjustments based on percentage or actual spend values.
- **Channel Focused:** Enables optimization based on specific media channels for focused strategies.
- **Responsive S Curves:** Showcases real-time, responsive S curves that highlight regions indicating underinvestment, optimal spending, and areas of potential overinvestment.
- **Dynamic Visualization:** Provides ROI/MROI for in-depth analysis and immediate scenario feedback.
""")
with st.expander("**Saved Scenarios**"):
st.markdown("""
Users can save, load, download, and delete scenarios involving spends, ROI, and MROI for both actual and simulated cases. This feature offers flexibility in scenario management and comparison.
**Features:**
- **Optimized Results Visualization:** Displays the outcomes of optimization, highlighting effectiveness and efficiency in scenario planning.
- **Effectiveness and Efficiency Analysis:** Provides detailed visual insights into how optimization impacts campaign performance and resource utilization.
""")
with st.expander("**Optimized Result Analysis**"):
st.markdown("""
This analysis page gives an overview of optimized spends (actual, planned, and delta), budget allocation (% split and planned spends), and forecasts on response and return by media channel. It's designed to provide insights into the efficiency and effectiveness of optimized media spending strategies.
**Features:**
- **Optimized Spends Overview:** Compares actual, planned, and delta spends.
- **Budget Allocation Analysis:** Breaks down the percentage split and planned expenditures.
""")
if user=='Media Planner':
with st.expander('**Scenario Planner**'):
st.markdown("""
The Scenario Planner page enables forward and reverse optimization, allowing users to either maximize targets given certain spends or minimize spends given a target revenue. It includes responsive S curves for multiple channels and optimizes them accordingly.
**Features:**
- **Optimization:** Supports both forward and reverse financial planning, with adjustments based on percentage or actual spend values.
- **Channel Focused:** Enables optimization based on specific media channels for focused strategies.
- **Responsive S Curves:** Showcases real-time, responsive S curves that highlight regions indicating underinvestment, optimal spending, and areas of potential overinvestment.
- **Dynamic Visualization:** Provides ROI/MROI for in-depth analysis and immediate scenario feedback.
""")
with st.expander("**Saved Scenario**"):
st.markdown("""
Users can save, load, download, and delete scenarios involving spends, ROI, and MROI for both actual and simulated cases. This feature offers flexibility in scenario management and comparison.
**Features:**
- **Optimized Results Visualization:** Displays the outcomes of optimization, highlighting effectiveness and efficiency in scenario planning.
- **Effectiveness and Efficiency Analysis:** Provides detailed visual insights into how optimization impacts campaign performance and resource utilization.
""")
with st.expander("**Optimized Result Analysis**"):
st.markdown("""
This analysis page gives an overview of optimized spends (actual, planned, and delta), budget allocation (% split and planned spends), and forecasts on response and return by media channel. It's designed to provide insights into the efficiency and effectiveness of optimized media spending strategies.
**Features:**
- **Optimized Spends Overview:** Compares actual, planned, and delta spends.
- **Budget Allocation Analysis:** Breaks down the percentage split and planned expenditures.
""")
with open("MMM Tool Description.docx", "rb") as file:
word_content = file.read()
b64 = base64.b64encode(word_content).decode()
href = f'<a href="data:application/octet-stream;base64,{b64}" download="document.docx">Download Document</a>'
st.markdown(href, unsafe_allow_html=True)