Skip to main content

MLOps - Tweaking Hyperparameters Automatically

 A time consuming task while training the Machine Learning models is to continuously tweak the Hyper-Parameters to reach our desired Accuracy. It is one of the reasons why most of the ML related projects fail. 

This can be resolved upto an extent with  MLOPs = ML+ DevOps

In this blog, I'm explaining my MLOPs project which trains and tweaks a CNN model for Cat and Dog prediction from the dataset. My project uses "Jenkins" as an automation-tool and "GitHub" where the developer pushes the code.

Requirements for setting up the project :

1. Git
2. Jenkins
3. Redhat 8 VM
4. Docker

Project :

Creating Environments :

I've created 3 environments (images) in Docker using Dockerfile for running my programs -
1) env1 - This environment is for running any basic program which uses numpy and pandas.
To run the container of env1 -
docker run -it --name con_Basic env1


2) env2 - This environment is for running Old ML programs which use sklearn.
To run the container of env2 -
docker run -it --name con_ML env2

3) env3 -  This environment is for runnig DL programs which use keras.
To run the container of env3 -
docker run -it --name con_DL env3


Build Pipeline : This is the build pipeline for my chain of jobs. 




Making the model :

I've made a Cat and Dog prediction CNN model which uses the concept of Deep Learning.  This is a Binary Classification model.

Layers which I've used are-

-> Convolutional Layer
-> Max Pooling Layer
-> Flattering Layer
-> Dense Layers

I've uploaded the code on my GitHub.
Here's the link of my GitHub repository :

https://github.com/aayushi1908/Task-3-MLOPs.git

JENKINS JOBS :

I've made 8 jobs for this project-

JOB1 -- Pulling the code from GitHub whenever developer pushes or makes changes in the code.

This job pulls the code from GitHub and copies it to a folder named /Aayushi in Redhat.



JOB2 -- By looking at the program file, Jenkins automatically starts the respective container ( Eg - For CNN code, it should start a container of my "env3")



JOB3 -- Train the model and predict accuracy or metrics.



JOB4 -- This job finds if  the accuracy is > 80 % or not.

In this job, we check whether our obtained accuracy matches our desired accuracy and if  it matches, an email is sent. If doesn't, the code is tweaked.

JOB5 -- Notifies the user about the accuracy obtained by sending an Email.





For EMAIL CONFIGURATION -

For email configuration, set-
1. Set IMAP enable in your gmail account settings.
2. Set Permissions as ON for Less Secure apps.

JOB 6 -- For accuracy < 80 %,  tweak code runs.



JOB 7 -- After the tweak accuracy is obtained, an Email is sent to the Developer.




JOB 8 -- This is an extra job for Monitoring. If the container where code is running fails, this job starts it again automatically.


      

Tweak Code Console Output - 

This is the Console Output of my tweak code. Have a look.












Comments

Popular posts from this blog

SIH 2020 : A kick-start from my not-so techie life

How Smart India Hackathon (SIH) participation has helped me to strengthen my competency and enhance my skill-sets? Hello everyone! In this blog, I'm going to talk about how SIH played an important role in building my passion towards acquiring technical skills. Do read till the end to know about all of my experiences. Do you believe in the concept of “IDEA”? Do you follow the principle of “Smart Work”? Well, my SIH experience directed me towards these!  I’m writing this blog to enlighten these topics and I’ll try to elaborate the importance of the above 2 questions in every engineering student’s life! SIH kick-started my non-technical life to a much focused one.   The concept of “Smart work beats hard work” suits my story! So, I decided to participate in SIH 2020 under the Software Problems domain. This domain asked for a Web app/ Mobile app to be made. I was eager to make a Web app as I knew Web development from basic level. Now a team needed to be made! So I communica...

My IIEC Rise and MLOPs Journey @LinuxWorld India

IIEC Rise and MLOPs- A journey that brought dedication, diligence and self-confidence in me I'm writing this blog to highlight my journey of IIEC Rise and MLOPs and to express my gratitude to the team of LinuxWorld India for every opportunity that they have provided us to learn and grow! So, beginning with a basic introduction of myself, I'm Aayushi and I'm a Computer Science student with great interests in learning different technologies. I'm pursuing my B.Tech from Jaipur, the same city where LinuxWorld Company is situated! Now, I would like tell you about how I got associated with LinuxWorld and what force drove me towards learning from a great mentor and several World Record Holder - Mr. VIMAL DAGA ! Before association with IIEC Rise- It was in mid-January when my friends told me of a FREE Linux+ Python training that was going to be conducted LIVE by a World Record Holder . This news got spread so fast that almost everyone in my college was talkin...