Lecture 6 - Model deployment
Lecture 6 - Model deployment
Deployment Workflow
Deployment Strategies
Best Practices
Develop and train the Choose the Serialize the trained Select a deployment Monitor model
machine learning best-performing model model to save its state framework or platform performance and
model using historical based on evaluation for future use. suitable for the update as needed to
data. results. application maintain effectiveness
requirements. over time.
Techniques:
Common serialization formats include pickle (for Python objects), joblib, and
HDF5 (for large numerical arrays).
Monitoring Metrics:
Key performance indicators (KPIs) such as prediction accuracy, latency, throughput, and error rates.
Monitoring tools and dashboards can help visualize and analyze these metrics to detect anomalies or
degradation in performance.
Maintenance Tasks:
● Periodically retraining the model with new data to adapt to changing patterns and trends.
● Updating the model to incorporate new features, improve algorithms, or address performance issues
identified during monitoring.
● Implementing version control to track changes and roll back to previous versions if necessary.
Deployment Strategies
Containerization
Use containerization technologies like Docker to package the model and its
dependencies for easy deployment across different environments.
Serverless Computing
Expose the model as a RESTful API endpoint, allowing other applications to send
requests and receive predictions.
Edge Computing
Deploy models directly on edge devices (e.g., IoT devices or mobile devices) to
make predictions locally without relying on a centralized server.
Best Practices
Version Control
Use version control systems (e.g., Git) to track changes to the model code and configurations.
Documentation
Document the deployment process, including dependencies, environment setup, and deployment instructions.
Security
Implement security measures to protect sensitive data and prevent unauthorized access to the deployed
model.
Testing
Conduct thorough testing of the deployed model to ensure reliability and accuracy in real-world scenarios (A/B
testing)
Building Interactive Web Applications with Streamlit
What is Streamlit?
https://docs.streamlit.io/get-started/installation
- Command line
- Anaconda
We'll define a sidebar for user input (e.g., selecting input features), and display the
model predictions in the main area.
Find some alternative solution for ML demo application rather than Streamlit