Machine Learning Model Deployment in Docker Container

WL_Date29–05–2021_task_01

This task is completed by Sandeep Kumar Patel

Summer 2021 — Task 1 Task Description

  • 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/create machine learning model which you have created in Jupyter notebook

This task is upload in Git Hub line

This Task is upload in YouTube below the line

https://www.youtube.com/watch?v=v6wStV9hb-8

What are containers?

Docker is an open source project that makes it easy to create containers and container-based apps. Originally built for Linux, Docker now runs on Windows and MacOS as well. To understand how Docker works, let’s take a look at some of the components you would use to create Docker-containerized applications.

Docker advantages

Docker containers provide a way to build enterprise and line-of-business applications that are easier to assemble, maintain, and move around than their conventional counterparts.

What’s the difference between containers and virtualization?

With virtualization technology, the package that can be passed around is a virtual machine, and it includes an entire operating system as well as the application. A physical server running three virtual machines would have a hypervisor and three separate operating systems running on top of it.

By contrast a server running three containerized applications with Docker runs a single operating system, and each container shares the operating system kernel with the other containers. Shared parts of the operating system are read only, while each container has its own mount (i.e., a way to access the container) for writing. That means the containers are much more lightweight and use far fewer resources than virtual machines.

What are containers and why do you need them?

Containers are a solution to the problem of how to get software to run reliably when moved from one computing environment to another. This could be from a developer’s laptop to a test environment, from a staging environment into production, and perhaps from a physical machine in a data center to a virtual machine in a private or public cloud.

Problems arise when the supporting software environment is not identical, says Docker creator Solomon Hykes. “You’re going to test using Python 2.7, and then it’s going to run on Python 3 in production and something weird will happen. Or you’ll rely on the behavior of a certain version of an SSL library and another one will be installed. You’ll run your tests on Debian and production is on Red Hat and all sorts of weird things happen.”

And it’s not just different software that can cause problems, he added. “The network topology might be different, or the security policies and storage might be different but the software has to run on it.”

Step 1

here is python file and code-

Test.py

print(‘*’*80)
print(‘…………………..Welcome to Sandeep MLOps task o1………………………’)
import pandas as pd
from sklearn.linear_model import LinearRegression
print(‘*’*80)
db=pd.read_csv(‘test_data_set.csv’)
print(‘We have a Data Set Now we are used to and now we are show …’)
print(‘#’*80)
print(db)
print(‘#’*80)
#type(db)
y= db[“mark”]
x= db[“NumberOfStrd”]
x.shape
x=x.values
x = x.reshape(8,1)
x.shape
mind = LinearRegression()
mind.fit(x,y)

a=int(input(‘enter your value : -’))
b=mind.predict([[a]])
print(‘#’*80)
print(‘……………. Your Resut is……………….’)
print(‘#’*80)
print(‘predict data :- ‘,b)
print(‘#’*80)
print(‘…………………….. Thank you for Using App……..’)
print(‘#’*80)

Data set we are using

Step 2

Test_Data_Set.csv

No,name,NumberOfStrd,mark
1,sandeep,8,80
2,sunil,9,90
3,kishan,3,30
4,sai,4,40
5,vamsi,5,50
6,ram,4,40
7,shyam,7,70
8,roy,1,10

Step 3

final output

***************************************************************
…………………..Welcome to Sandeep MLOps task o1……………………
***************************************************************
We have a Data Set Now we are used to and now we are show …
##########################################
No name NumberOfStrd mark
0 1 sandeep 8 80
1 2 sunil 9 90
2 3 kishan 3 30
3 4 sai 4 40
4 5 vamsi 5 50
5 6 ram 4 40
6 7 shyam 7 70
7 8 roy 1 10
##########################################
enter your value : -3
##########################################
……………. Your Resut is……………….
##########################################
predict data :- [30.]
##########################################
…………………….. Thank you for Using App……..
##########################################

Step 4

Exulted the this task and attach all the pic

Thank YOU….!!!!!!!!!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sandeep Kumar Patel

Sandeep Kumar Patel

58 Followers

Enthusiastic, aspirant in artificial intelligence, machine learning Research is formalized curiosity. It is poking and prying with a purpose.