Web App For Border Crossing Wait Time Forecast – Part 2

Keywords: Web App, Flask, AJAX, API, AWS, Virtual Environment

Previously, I built the Flask web app that runs on my local machine for predicting border crossing wait time. This time I’ll show how it gets deployed on AWS and becomes a public available web app.

Here is the link to web app http://35.164.32.109:5000/

There is a small change to my workflow. Instead of using Facebook Prophet, I changed to build an XGBoost model due to Prophet requirement of minimum 4GB memory. AWS free tier EC2 service only has 1GB memory.

Model is rebuilt daily using the new wait time records available from prior day, and makes forecasts for the next 7 days. The last 7 days records are held out for model validation and RMSE is used for model evaluation.

Continue reading “Web App For Border Crossing Wait Time Forecast – Part 2”

Web App For Border Crossing Wait Time Forecast – Part 1

Keywords: Facebook Prophet, Web App, Flask, AJAX, API, AWS

About a year ago I built a predictive model for predicting border crossing wait time. There were a lot of feature manipulation and parameter tweaking. Although results were encouraging, I always wanted to simplify the process and also make the model available for public use.

After spending two weekends researching and coding (as I have no prior knowledge of Prophet or Flask), here is the improved workflow:

  1. Retrieve border crossing wait time from Cascade Gateway API
  2. Build predictive model for future crossing using Python + Facebook Prophet
  3. Develop web app REST API using Flask, HTML, CSS, ajax
  4. Deploy web app on AWS
  5. Refresh data and re-build predictive model daily
Continue reading “Web App For Border Crossing Wait Time Forecast – Part 1”

Credit Card Fraud Detection Using SMOTE Technique

Outlier detection is is an interesting application of machine learning. The goal is to identify those useful data records that can accurately profile abnormal behavior of the system. However, in real life examples, such special data like fraud and spam takes very small percentage of overall data population, which imposes challenges for developing machine learning models.

In this experiment, we will examine Kaggle’s Credit Card Fraud Detection dataset and develop predictive models to detect fraud transactions which accounts for only 0.172% of all transactions. To deal with the unbalanced dateset issue, we will first balance the classes of our training data by a resampling technique (SMOTE), and then build a Logistic Regression model by optimizing the average precision score.

We will build and train our model on Google Colab, a free Jupyter notebook environment that runs on Google cloud and gives free GPU! For more information on Colab, checkĀ Colab official page.

Continue reading “Credit Card Fraud Detection Using SMOTE Technique”