Quiz 2

Learning Objectives

322 words
2 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Learning Objectives - Deploy analytics product - Set up monitoring - Plan for maintenance ## Deploy Dashboard to Cloud > **Q1: What is MLOps and why is it important?** > > Practice of deploying, monitoring, and maintaining ML models in production. Ensures model reliability, reproducibility, and continuous improvem...

Learning Objectives

  • Deploy analytics product
  • Set up monitoring
  • Plan for maintenance

Deploy Dashboard to Cloud

python
# app.py (Streamlit dashboard for deployment)
import streamlit as st
import pandas as pd
import plotly.express as px
st.set_page_config(layout='wide')
st.title('Business Analytics Dashboard')
# Load data
df = pd.read_csv('data/processed/analytics_data.csv')
# Filters in sidebar
region = st.sidebar.selectbox('Region', df['region'].unique())
filtered_df = df[df['region'] == region]
# Key metrics
col1, col2, col3, col4 = st.columns(4)
col1.metric("Revenue", f"${filtered_df['revenue'].sum():,.0f}")
col2.metric("Customers", f"{filtered_df['customers'].sum():,}")
col3.metric("AOV", f"${filtered_df['revenue'].mean() / filtered_df['orders'].mean():.2f}")
col4.metric("Conversion", f"{filtered_df['conversion_rate'].mean():.1%}")
# Charts
fig = px.line(filtered_df, x='date', y='revenue', title='Revenue Trend')
st.plotly_chart(fig, use_container_width=True)
Q1: What is MLOps and why is it important?
Practice of deploying, monitoring, and maintaining ML models in production. Ensures model reliability, reproducibility, and continuous improvement. Critical for production systems. Q2: How to monitor model performance in production?
Track: prediction distribution, feature drift (data changes), target drift (concept drift), accuracy (when labels arrive), response time, error rate. Set alert thresholds. Q3: What is model drift?
Model performance degrades over time. Data drift: input distribution changes. Concept drift: relationship between features and target changes. Retrain when drift detected. Q4: How to handle model retraining?
Scheduled (weekly/monthly), performance-triggered (accuracy drops below threshold), or event-driven (new data available). Use CI/CD pipeline for automated retraining. Q5: Cloud deployment options?
Streamlit Sharing (simple dashboards), Heroku (Flask APIs), AWS Elastic Beanstalk, Google Cloud Run, Azure App Service, Docker + any cloud. Q6: Procfile for Heroku deployment:
makefile
web: streamlit run app.py --server.port $PORT
Q7: Monitoring dashboard:
python
# metrics.py - Monitor model health
def check_drift(reference_data, current_data, threshold=0.05):
    from scipy.stats import ks_2samp
    for col in reference_data.columns:
        stat, pval = ks_2samp(reference_data[col], current_data[col])
        if pval < threshold:
            print(f"Drift detected in {col}: p={pval:.4f}")
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.