Machine learning inside Docker
Machine learning is a method of data analysis that automates analytical model building. It is a branch of artificial intelligence based on the idea that systems can learn from data, identify patterns and make decisions with minimal human intervention.
Here, in this blog I am going to run Machine Learning program inside docker and follow the steps :-
- Pull the Docker container image of CentOS image from Docker Hub and create a new container
- Install the Python software on the top of docker container
- In Container we need to copy/create machine learning model
Step 1.:- To install docker first, as I am running the program inside RedHat as base OS, so in order to install Docker first configure docker repo and the run the command,
yum install docker-ce -y
Next I have to start docker services,
systemctl start docker
systemctl enable docker
Step 2. :- Next step is to pull docker image from docker hub, here I am going to pull centos, run following command
docker pull centos:7
Step 3. :- Now, we will start docker container
docker run -it — name <<container_name>> <<image_name:image_tag>>
A brand new OS will be launched …
Step 4. : We will install Python inside docker,
yum install python3 -y
and then installing python required modules using pip command
pip3 install pandas scikit-learn
Step 5. :- Now, I am going to write Python Program for Simple Linear Regression.
where my dataset is SalaryData.csv which basically number of years experience and salary.
Now, At last Let’s run the program
And we can see that our model with the name “marks.pk1” is created, and our model is successfully created.
That’s all from my side.
Any query & suggestions, most welcome.
Keep Learning, keep growing.
Thank you ;)