Salary Predictor App Using Machine Learning and Docker

Yash Dwivedi
3 min readMay 31, 2021

--

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.

--

--

Yash Dwivedi
Yash Dwivedi

Written by Yash Dwivedi

Technical Person, Open for Every Technology.

No responses yet