ML_in_Docker

aman behl
3 min readMay 27, 2021

--

The task is to analyze a dataset by using python and generate the targeted value over a docker container.

The requirement of this fast-moving world is to reduce latency in any case. Running a Machine learning model over a docker container not only saves time but also saves memory.

What is Machine Learning?

Machine learning is the study of computer algorithms that improve automatically through experience and data use. It is seen as a part of artificial intelligence.

In simple words, machine learning is the concept of making your machine learning so that it can predict the desired targetted values. To make this happen a machine is trained by creating models and adding experience to it with the help of the dataset.

What is Docker?

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

Containers allow a developer to package up an application with all of the parts it needs. We can download all the dependencies, required for machine learning.

The given procedure executes the task. I have used RedHat Linux as the base operating system and installed docker over it.

Steps to Follow:

  1. Installing docker
Check that yum is configured and then install docker using the highlighted command.

Start and enable the docker services before preceding ahead :

systemctl start docker ( Starts the docker service)

systemctl enable docker ( Enable docker services)

2. Pulling Docker Image: Pull centos docker image and launch a container named “ABOS” using the centos image

Command to pull and create a docker container.

3. Install Dependencies: Install the required software for performing analysis over the dataset.

Install python3 inside the container
Install python libraries using pip command.
Install git to clone the repository

4. Clone Git repository: Clone the git repository which contains the dataset and the machine-learning code. ( git URL mentioned at the end of the article)

Clone the repository using git-clone
After clone repository, create the file where you will write your code.

Salary-ML contains the machine learning code.

ML code inside Salary-ML.py

The above codes predict the salary and also creates the model of machine learning. The model can be loaded and used to predict the output. Here, I have used the same file.

Final Output :

The salary is predicted.

--

--