Machine Learning model inside Docker  Container

Machine Learning model inside Docker Container

Hola, readers !!

So, in this article I would be providing information on creating a Machine learning model inside a Docker container

First things first we need to install docker in our system

I am using a RHEL 8 virtual machine for it ,so to install docker we would use the following command

# yum install docker-ce

Once it is installed we would pull an image from docker registry

# docker pull centos:latest

Further we would be launch a container with the same image

#docker run -it centos:latest

Then once we are into the terminal we need our csv file containing the dataset

For which I would be using the container id which can be found using

#docker ps -a

No alt text provided for this image

Next we would copy the file to our docker container using

# docker cp <source of the file> containerid:<dest path>

No alt text provided for this image

No we need to install python3 and the import libraries needed for our machine learning inside the container

#yum install python3

#pip3 install pandas

#pip3 install sklearn

Now we would launch the python3 shell >import pandas and LinearRegression

No alt text provided for this image

Now ,we would start working on the model for machine learning basically data pre-processing steps

  • -Read our csv file and assign a variable to it
  • Reshape one of the column from 1D to 2D
  • Assign a variable "y" to our second column
  • Give another variable name "model" and save LinearRegression function into it
No alt text provided for this image

Our model is ready to go , let's fit the x & y variable into our model and then use it.

As our dataset contains 2 columns years of experience and the salary accordingly we can predict the salary based upon the experience of an employee

No alt text provided for this image


So we have successfully used machine learning inside our docker container, isn't it amazing do like and share your valuable comments




Prabhjeet Singh

Software Engineer @ FinSpectra | Platform Developer-1 Certified Salesforce Developer | Salesforce QA Tester

3 年

Great Mubin Brother

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

Mohd Mubin Girach的更多文章

  • Ansible and its Industry use case

    Ansible and its Industry use case

    What is Ansible ? ? Ansible is an open source technology by Red Hat ,it is widely used by the industries for automating…

社区洞察

其他会员也浏览了