Salary Predictor App Using Machine Learning and Docker

Task Overview

👉 Pull the Docker container image of CentOS image from DockerHub and create a new container

👉 Install the Python software on the top of docker container

👉 In Container, Create machine learning model

Machine learning (ML) is the study of computer algorithms that improve automatically through experience and by the use of data. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as “training data”, in order to make predictions or decisions without being explicitly programmed to do so. Machine learning algorithms are used in a wide variety of applications, such as in medicine, email filtering, and computer vision, where it is difficult or unfeasible to develop conventional algorithms to perform the needed tasks.

Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. Because all of the containers share the services of a single operating system kernel, they use fewer resources than virtual machines.

Now, let’s start the task !!

First of all it is always good practice to create a separate Work-Space so that we can easily manage the things. I am going to put all the code in this directory only.

About the dataset

To train this model I used a dataset of 30 employees that contains two information, first their Years of Experience and second Salary.

Using this dataset, we have to create a Machine Learning Model that will predict salary on the basis of year of experience of the employee.

Now the interesting point is, here I am going to train this model inside a Docker Container.

So, here I will use Dockerfile to launch the container.

Here is my Dockerfile that I will use

Now, Build the image with Dockerfile so that we can use that image to launch a container.

docker build -t <image_name> <Path_of_Dockerfile>

Now, we just need to run a container using custom image and train the model and predict the salary in just 2–3 seconds.

here we can see after training model come up in same workspace.

Now we can predict using new app

Hope you find this article Helpful !!

Thanks for Reading.



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