Predicting Salary Using Linear Regression Model On Top of Docker Container

Uvinayakkumar
2 min readMay 27, 2021

Actually Today I am Going to predict The Salary On the Basic of Year of Experience

πŸ‘‰ 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 you need to copy machine learning model which you have created in jupyter notebook

Linear Regression

It is Basic model of Supervised Learning(Regression) . It is Used when we want to predict the value of a variable based on the value of another variable. The variable we want to predict is called the dependent variable

Now we Have to Save Model and Put in Docker Container so we can Create Image and Push It in Docker Hub . So we Can Pull that Image Again And Again So we can use it In future.

Docker Hub : β€” It is A Centralized Repository where we Keep all the Image so anyone Can Download from there And use it.

Docker Provide us Container Which we Provision the OS within the second

Docker Container :- Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

# Step to save the Model

filename = 'final_model'
final = pickle.dump(model, open(filename, 'wb'))

Now we have to Launch Docker Container first we have to pull the centos image :-

docker pull centos:7

After Launching Docker Container We have to install Python3 and keras library in the Docker container.

yum install python3 -y
pip install --upgrade pip
pip3 install keras
pip3 install sklearn

Now we Have to upload our model into Docker Container from our Base OS

docker cp  model_name container_id:/folder 
docker cp ./final_model 12f5ecf40757:/model

Now we can check the whether our model is working fine of not

Here we get the Desired result

--

--