Building Attrition Rates Dashboard using Dash

Dash is one of the most Python framework for machine learning or data science web applications. In this post, I will explain the outline for creating simple web application using Dash. I use my previous machine learning model about company’s attrition rate here as the content of the app. Goals of this project is to create a web application that can give an attrition rate’s probability of an employee based on several features that will be input by the user.

Import the Model

As I said before, we will use the previous machine learning model. It can be done using pickle module, so we don’t need to build the model again. Just extract the pickle file :) And notice that not only the model that you should save in pickle file, but also the Scaler. It because the new data still requires Scaler to remain it standardized.

Create the Layout

Layout in Dash is made using html language. I won’t make a complex application. This application designed to receive 19 feature as input from user. I classified them into two input types. The first one is input with certain range that can be deployed using , and the others is like multiple choice input that can be applied using module. On the first input type, some marks is provided to make it easier for user. And the last, I put this two input type in two columns so all input can be given in just one screen only.

Output is given not only to show the final result, but also show what’s value given by user on each input. To make output is out from the screen :o we use and state what's our output and input there.

Connect Model and Layout

I connect both of them in . Don’t forget to pre-processing the input from user to the right format we used on the machine learning model before. After it, our work is almost complete. Save it with .py extension on the same folder with model and scaler pickle file. In my case, I save it as Dash.py

Run!

Run your file.py on your cmd. It will show your localhost. Open it on your browser.

Yeay!

Here is the preview on my Attrition Rates App 👐

Note: All documentation can be found here. And I’m open to any critics and suggestion, just write on the comment section. Thank u and have a nice day!

Reference
[1] Dash Plotly

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store