<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Praveen Kumar</title>
    <description>The latest articles on DEV Community by Praveen Kumar (@viratpk18).</description>
    <link>https://dev.to/viratpk18</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3082040%2F10eda794-5b6d-4f94-b421-02dbb9f88925.png</url>
      <title>DEV Community: Praveen Kumar</title>
      <link>https://dev.to/viratpk18</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/viratpk18"/>
    <language>en</language>
    <item>
      <title>🧠 Dockerize and Share Your ML Model: Logistic Regression with Iris Dataset</title>
      <dc:creator>Praveen Kumar</dc:creator>
      <pubDate>Fri, 25 Apr 2025 16:56:32 +0000</pubDate>
      <link>https://dev.to/viratpk18/dockerize-and-share-your-ml-model-logistic-regression-with-iris-dataset-3n64</link>
      <guid>https://dev.to/viratpk18/dockerize-and-share-your-ml-model-logistic-regression-with-iris-dataset-3n64</guid>
      <description>&lt;p&gt;&lt;strong&gt;📦 Project Structure&lt;/strong&gt;&lt;br&gt;
Here’s what our folder looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ml-docker-project/
├── Dockerfile
├── model.py
└── Iris.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🐳 Dockerfile Breakdown&lt;/strong&gt;&lt;br&gt;
Here’s the Dockerfile we’re using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use the official Python image as a base
FROM python:3.12-slim

# Set working directory inside the container
WORKDIR /app

# Copy all files from the local machine to the container
COPY . .

# Install required Python packages
RUN pip install --no-cache-dir pandas scikit-learn matplotlib

# Command to run your Python script
CMD ["python", "model.py"]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use a slim Python base image&lt;/li&gt;
&lt;li&gt;Copy your local files&lt;/li&gt;
&lt;li&gt;Install all dependencies&lt;/li&gt;
&lt;li&gt;Run model.py on container start&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧪 What model.py Does&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pandas import read_csv
from matplotlib import pyplot
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import joblib

# Step 1: Load dataset
filename = "Iris.csv"
data = read_csv(filename)

# Step 2: Display data shape and preview
print("Shape of the dataset:", data.shape)
print("First 20 rows:\n", data.head(20))

# Step 3: Plot and save histograms silently
data.hist()
pyplot.savefig("histograms.png")
pyplot.close()  # Close the plot so it doesn't show up in prompt

# Step 4: Plot and save density plots silently
data.plot(kind='density', subplots=True, layout=(3,3), sharex=False)
pyplot.savefig("density_plots.png")
pyplot.close()

# Step 5: Convert to NumPy array and extract features/labels
array = data.values
X = array[:, 1:5]  # Features: Sepal/Petal measurements
Y = array[:, 5]    # Target: Species

# Step 6: Split data into training (67%) and testing (33%)
test_size = 0.33
seed = 7
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=test_size, random_state=seed)

# Step 7: Create and train logistic regression model
model = LogisticRegression(max_iter=200)
model.fit(X_train, Y_train)

# Step 8: Evaluate and display accuracy
result = model.score(X_test, Y_test)
print("Accuracy: {:.2f}%".format(result * 100))

# Step 9: Save the trained model to a file
joblib.dump(model, "logistic_model.pkl")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visualizes the data (and saves plots)&lt;/p&gt;

&lt;p&gt;Trains a Logistic Regression model&lt;/p&gt;

&lt;p&gt;Evaluates it&lt;/p&gt;

&lt;p&gt;Saves the model as logistic_model.pkl&lt;/p&gt;

&lt;p&gt;It’s a full training pipeline, ready to be reproduced in any environment that runs Docker. 💪&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔨 Step-by-Step: Build, Tag, and Push to DockerHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ Build the Docker Image&lt;br&gt;
From your project directory:&lt;br&gt;
&lt;code&gt;docker build -t viratpk18/24mcr078:latest .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2️⃣ Log in to DockerHub&lt;br&gt;
&lt;code&gt;docker login&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3️⃣ Push the Image&lt;br&gt;
&lt;code&gt;docker push viratpk18/24mcr078:latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4️⃣ Then create the Dockerfile&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67h1cs089inm3sp9j64c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67h1cs089inm3sp9j64c.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📚 Resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;🐳 Docker for ML Projects&lt;br&gt;
 &lt;a href="https://docs.docker.com/language/python/" rel="noopener noreferrer"&gt;https://docs.docker.com/language/python/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🤖 scikit-learn Docs&lt;br&gt;
 &lt;a href="https://scikit-learn.org/stable/" rel="noopener noreferrer"&gt;https://scikit-learn.org/stable/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;📊 matplotlib Gallery&lt;br&gt;
 &lt;a href="https://matplotlib.org/stable/gallery/index.html" rel="noopener noreferrer"&gt;https://matplotlib.org/stable/gallery/index.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Mastering Git : Advanced Commands Every Developer Should Know</title>
      <dc:creator>Praveen Kumar</dc:creator>
      <pubDate>Fri, 25 Apr 2025 16:42:01 +0000</pubDate>
      <link>https://dev.to/viratpk18/mastering-git-advanced-commands-every-developer-should-know-3f8j</link>
      <guid>https://dev.to/viratpk18/mastering-git-advanced-commands-every-developer-should-know-3f8j</guid>
      <description>&lt;p&gt;&lt;strong&gt;🖋 Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Git is the heart of modern development workflows. While most developers are familiar with git add, git commit, and git push, there's a whole world of advanced Git commands that can save time, prevent disasters, and help you debug like a pro. Let’s level up!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 Why Go Beyond the Basics?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Understanding advanced Git operations helps:&lt;/p&gt;

&lt;p&gt;Clean up messy histories&lt;/p&gt;

&lt;p&gt;Fix mistakes without panic&lt;/p&gt;

&lt;p&gt;Navigate and debug efficiently&lt;/p&gt;

&lt;p&gt;Collaborate more effectively&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ Advanced Git Commands&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git reflog&lt;/code&gt; – Your Time Machine&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git reflog&lt;/code&gt;&lt;br&gt;
Shows a log of where your HEAD and branch references have been. Useful for recovering lost commits!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git cherry-pick&lt;/code&gt; – Pick and Choose Commits&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git cherry-pick &amp;lt;commit-hash&amp;gt;&lt;/code&gt;&lt;br&gt;
Apply specific commits from one branch into another. Great for patching bugs without merging entire branches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git bisect&lt;/code&gt; – Debugging Power Tool&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git bisect start&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git bisect bad&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git bisect good &amp;lt;commit&amp;gt;&lt;/code&gt;&lt;br&gt;
Use binary search to find the exact commit that introduced a bug. Super handy in large codebases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git stash&lt;/code&gt; – But Make It Fancy&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git stash save "WIP: fixing navbar"&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git stash list&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git stash pop&lt;/code&gt;&lt;br&gt;
Temporarily shelve your changes. You can even apply them selectively using stash@{n}.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git rebase -i&lt;/code&gt; – Rewrite History Like a Boss&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git rebase -i HEAD~3&lt;/code&gt;&lt;br&gt;
Interactive rebasing lets you squash, edit, or reorder commits. Use it to clean up your commit history before a PR.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git reset&lt;/code&gt; – Know Your Levels&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git reset --soft HEAD~1&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git reset --mixed HEAD~1&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git reset --hard HEAD~1&lt;/code&gt;&lt;br&gt;
Roll back commits with precision. Soft keeps your changes, hard doesn’t.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git clean&lt;/code&gt; – Remove the Untracked&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git clean -fd&lt;/code&gt;&lt;br&gt;
Clears untracked files and directories. Be careful—it’s permanent!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git blame&lt;/code&gt; – Find Who Changed What&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git blame &amp;lt;file&amp;gt;&lt;/code&gt;&lt;br&gt;
Annotates each line in the file with the commit and author. Useful for tracking bugs or changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git log&lt;/code&gt; – But Prettier&lt;br&gt;
bash&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
&lt;code&gt;git log --oneline --graph --decorate --all&lt;/code&gt;&lt;br&gt;
See a visual, colorful graph of your commit history. Great for understanding merges and branches.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;🚀 Pro Tips&lt;/strong&gt;&lt;br&gt;
Use aliases for long commands (git config --global alias.lg "log --oneline --graph --decorate")&lt;/p&gt;

&lt;p&gt;Combine git stash with git checkout to switch branches safely&lt;/p&gt;

&lt;p&gt;Before a pull request, use git rebase -i to squash commits&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📚 Conclusion&lt;/strong&gt;&lt;br&gt;
These commands will give you superpowers in managing Git repositories. Don’t fear the terminal — embrace it. The more fluent you get with Git, the smoother your dev life will be.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔗 Further Reading&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;📘 Pro Git Book&lt;br&gt;
&lt;a href="https://git-scm.com/book/en/v2" rel="noopener noreferrer"&gt;https://git-scm.com/book/en/v2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📝 Git Cheatsheet by GitHub Education&lt;br&gt;
&lt;a href="https://education.github.com/git-cheat-sheet-education.pdf" rel="noopener noreferrer"&gt;https://education.github.com/git-cheat-sheet-education.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🧠 Learn Git Branching (Interactive Visual Tool)&lt;br&gt;
&lt;a href="https://learngitbranching.js.org" rel="noopener noreferrer"&gt;https://learngitbranching.js.org&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Git-Hub Commands</title>
      <dc:creator>Praveen Kumar</dc:creator>
      <pubDate>Thu, 24 Apr 2025 04:53:03 +0000</pubDate>
      <link>https://dev.to/viratpk18/git-hub-commands-4h5i</link>
      <guid>https://dev.to/viratpk18/git-hub-commands-4h5i</guid>
      <description>&lt;p&gt;Initialize a Git repository:&lt;br&gt;
    &lt;code&gt;git init&lt;/code&gt;&lt;br&gt;
Creates a new Git repository in the folder 24MCR078.&lt;/p&gt;

&lt;p&gt;Add a file to staging area:&lt;br&gt;
    &lt;code&gt;git add 24MCR078.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Adds 24MCR078.txt Commit the file:&lt;br&gt;
    &lt;code&gt;git commit -m "Added Personal Details"&lt;/code&gt;&lt;br&gt;
Creates a commit with the message "Added Personal Details".&lt;/p&gt;

&lt;p&gt;Check Git status:&lt;br&gt;
     &lt;code&gt;git status&lt;/code&gt;&lt;br&gt;
Shows that 24MCR078.txt has been modified but not staged.&lt;/p&gt;

&lt;p&gt;View commit log:&lt;br&gt;
     &lt;code&gt;git log&lt;/code&gt;&lt;br&gt;
Displays the commit history (one commit at this point).&lt;/p&gt;

&lt;p&gt;Add remote GitHub repository:&lt;br&gt;
     &lt;code&gt;git remote add origin https://github.com/viratpk18/24MCR078.git&lt;/code&gt;&lt;br&gt;
Links the local repository to a remote GitHub repo.&lt;/p&gt;

&lt;p&gt;Check current branch:&lt;br&gt;
     &lt;code&gt;git branch&lt;/code&gt;&lt;br&gt;
Shows the current branch is master.&lt;/p&gt;

&lt;p&gt;Rename branch from master to main:&lt;br&gt;
     &lt;code&gt;git branch -M main&lt;/code&gt;&lt;br&gt;
Renames the current branch to main.&lt;/p&gt;

&lt;p&gt;Set Git global config for email and username:&lt;br&gt;
    &lt;code&gt;git config --global user.email "praveenkumar2k4.t@gmail.com"&lt;/code&gt;&lt;br&gt;
        &lt;code&gt;git config --global user.name "viratpk18"&lt;/code&gt;&lt;br&gt;
Sets your global Git identity.&lt;/p&gt;

&lt;p&gt;Push code to remote repo for the first time:&lt;br&gt;
    &lt;code&gt;git push -u origin main&lt;/code&gt;&lt;br&gt;
Pushes the main branch to GitHub and sets upstream tracking&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgf3c792xktn2w1ihel0c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgf3c792xktn2w1ihel0c.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwiwoe11u9e23qigt1c68.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwiwoe11u9e23qigt1c68.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zjcp0ypplrt6gy8y9ex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zjcp0ypplrt6gy8y9ex.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then , Again We will Modify or add new file means we need to follow the same steps, like&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m “message”
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
  </channel>
</rss>
