Module 3: Adding Data Science to a Web Application

Module Overview

You have your application, you have your data - now it's time for science! Let's use what we've learned throughout the program to add some useful intelligent functionality to our web application.

Learning Objectives

1. Add a machine learning model to our web server that generates predictions when passed the appropriate inputs

• Implement a trained machine learning model in a Flask application
• Create functions to handle model predictions
• Process input data before passing to the model
• Handle different types of prediction outputs
• Optimize model performance in a web environment
• Manage model dependencies in your application

2. Add routes to our app that will listen for POST HTTP requests (form submissions) and respond accordingly

• Define routes that accept POST requests
• Extract data from form submissions
• Process submitted data for model input
• Return appropriate responses based on predictions
• Implement proper error handling for form submissions
• Create intuitive user interfaces for data input

3. Display appropriate messages on the screen after user actions including error messages when invalid actions are taken

• Create user-friendly success and error messages
• Implement flash messaging in Flask
• Design clear feedback mechanisms for user actions
• Handle edge cases and unexpected inputs gracefully
• Provide contextual information in error messages
• Guide users toward successful interactions

Guided Project

Adding Data Science to a Web Application

Please read the README.md file in the GitHub repository for a complete overview of this module.

Guided Project File:

guided-project.md

Module Assignment

Please read the assignment.md file in the GitHub repository for detailed instructions on completing your assignment tasks.

Assignment File:

assignment.md

Assignment Solution Video

Check for Understanding

Complete the following items to test your understanding:

  • Implement a simple predictive model in a web application
  • Process user input for model predictions
  • Train a machine learning model offline and save it for web use
  • Load and use a serialized model in your Flask application
  • Display model predictions and analysis results in your web interface

Additional Resources