Deploying Simple Machine Learning Model inside Docker Container

Deploying Simple Machine Learning Model inside Docker Container

Task Description ??

?? Pull the Docker container image of CentOS image from Docker Hub and Create a new container

?? Install the Python software on the top of the docker container

?? In Container you need to copy/create a machine learning model

1. Install docker in base OS:

  • Already installed in my case.
No alt text provided for this image


2. Pulling the Centos image from docker hub

No alt text provided for this image

Pull the image using docker pull centos command.

3. Launching a Docker container using the centos image

No alt text provided for this image

By using docker run -it --name mlindocker centos command we have launched docker container with centos image and container name as mlindocker.

4. Copying the dataset into the container

No alt text provided for this image

5. Installing python3 software inside the docker container

No alt text provided for this image

6. Installing the necessary libraries (numpy, pandas, scikit-learn) using pip3

pip3 install numpy

pip3 install pandas

pip3 install scikit-learn

No alt text provided for this image

7. Writing the ML code

import pandas as pd
dataset = pd.read_csv('salarydata.csv')

X = dataset[['YearsExperience']]
y = dataset['Salary']
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X,y)
import joblib
joblib.dump(model, 'finalsalary2.pk1')

8. Now we are set to run the model file

No alt text provided for this image

As we can see when we enter the number of years of experience the ML model is giving the expected salary.

We have successfully deployed the ML model inside Docker Container



Aniket Khadye

Site Reliability Engineer at Crest data systems

3 年

Great work Well explained

要查看或添加评论,请登录

Shradha Seth的更多文章

  • k-mean clustering in security domain

    k-mean clustering in security domain

    ? Clustering:- Clustering is one of the most common exploratory data analysis technique used to get an intuition about…

    1 条评论
  • Face Detection using python

    Face Detection using python

    Task 06 ??????? Team Task Task Description ?? ?? Create a program that perform below mentioned task upon recognizing a…

    2 条评论
  • Javascript!!

    Javascript!!

    ?? Task 7.2 - ?? Write a blog explaining the usecase of javascript in any of your favorite industries.

  • Confusion Matrix and cyber security

    Confusion Matrix and cyber security

    Confusion matrix is a fairly common term when it comes to machine learning. Today I would be trying to relate the…

  • GUI Application On Docker Container?? ??????

    GUI Application On Docker Container?? ??????

    ?? Task Description?? ?? GUI container on the Docker ?? Launch a container on docker in GUI mode ?? Run any GUI…

  • Creating VPC Infrastucture and NAT gateway using Terraform

    Creating VPC Infrastucture and NAT gateway using Terraform

    The goal is to create a scenario in which we will create our own virtual private cloud (VPC) with a public and a…

    2 条评论
  • Creating VPC Infrastucture: Terraform & Hosting WordPress

    Creating VPC Infrastucture: Terraform & Hosting WordPress

    We have to create a web portal for our company with all the security as much as possible. So, we use Wordpress software…

  • Creating AWS infrastructure with AWS: EFS using Terraform

    Creating AWS infrastructure with AWS: EFS using Terraform

    Task details: Create the key and security group which allow the port 80. Launch EC2 instance.

  • LAUNCH NEXT CLOUD WITH EKS

    LAUNCH NEXT CLOUD WITH EKS

    AWS (Amazon Web Services) is a comprehensive, evolving cloud computing platform provided by Amazon that includes a…

社区洞察

其他会员也浏览了