<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aagama AR on Medium]]></title>
        <description><![CDATA[Stories by Aagama AR on Medium]]></description>
        <link>https://medium.com/@aagamaar01?source=rss-771247f3de01------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*691svlJ4VPjiOkE01mOLoQ.jpeg</url>
            <title>Stories by Aagama AR on Medium</title>
            <link>https://medium.com/@aagamaar01?source=rss-771247f3de01------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:18:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aagamaar01/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build a Diabetes Prediction Web App Using Machine Learning — A Beginner-Friendly Project Guide]]></title>
            <link>https://medium.com/@aagamaar01/build-a-diabetes-prediction-web-app-using-machine-learning-a-beginner-friendly-project-guide-0e2745b9f0bd?source=rss-771247f3de01------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e2745b9f0bd</guid>
            <dc:creator><![CDATA[Aagama AR]]></dc:creator>
            <pubDate>Wed, 02 Jul 2025 19:37:29 GMT</pubDate>
            <atom:updated>2025-07-02T19:37:29.349Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a Diabetes Prediction Web App Using Machine Learning — A Beginner-Friendly Project Guide</h3><p><strong>By Aagama AR</strong></p><p>Hey, have you ever wondered how machine learning can be used to predict diseases? In this beginner-friendly guide, I’ll show you a <strong>step-by-step</strong> how to build a real ML model to <strong>predict diabetes</strong> using medical data — and then deploy it as a <strong>web app</strong> using <strong>Streamlit</strong>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jpbim3OqAum9fuNGBXI84Q.png" /></figure><p>No prior experience with ML? No worries. I’ll break down everything into simple terms. By the end, you’ll not only understand the key concepts but will have built and deployed your own working project.</p><p>🔗 <strong>GitHub Repo (Full Code):</strong><br> 👉<em> </em><a href="https://github.com/aagamaar/DIABETIC_PREDICTION"><em>diabetes-prediction</em></a></p><h3>🧠 What You’ll Learn</h3><p>✅ How to use a real-world dataset for training a model<br> ✅ What a <strong>classifier</strong> is and why we use it<br> ✅ What it means to “train” a model<br> ✅ How to save the model and use it to make predictions<br> ✅ How to build an interactive <strong>web app</strong> (with no HTML or JS!)<br> ✅ How to deploy your project online</p><h3>📊 The Dataset — Explained Simply</h3><p>We’re using the <strong>PIMA Indians Diabetes Dataset</strong> from Kaggle. It contains medical records of women aged 21+, with features like:</p><ul><li><strong>Pregnancies</strong>: Number of times pregnant</li><li><strong>Glucose</strong>: Blood sugar levels</li><li><strong>Blood Pressure</strong></li><li><strong>Skin Thickness</strong>: Body fat measure</li><li><strong>Insulin</strong>: Insulin level in blood</li><li><strong>BMI</strong>: Body Mass Index</li><li><strong>Diabetes Pedigree Function</strong>: Family history of diabetes</li><li><strong>Age</strong></li></ul><p>The last column is <strong>Outcome</strong>:</p><ul><li>0 = not diabetic</li><li>1 = diabetic</li></ul><p>👉 Our goal: train a machine to predict this <strong>Outcome</strong> using the other inputs.</p><p>📥 Get it here: <a href="https://www.kaggle.com/datasets/uciml/pima-indians-diabetes-database?resource=download">PIMA Dataset on Kaggle</a></p><h3>🛠️ Step 1: Project Setup</h3><p>Make a folder like this:</p><pre>diabetes-prediction/<br>│<br>├── diabetes.csv            # Your dataset<br>├── train_model.py          # Trains your model<br>├── trained_model.sav       # Output file (saved model)<br>└── diabetes_app.py         # Streamlit web app</pre><h3>✅ Use a Virtual Environment</h3><p>This keeps your project clean and avoids dependency issues.</p><pre>python -m venv venv<br>source venv/bin/activate      # Windows: venv\Scripts\activate</pre><h3>✅ Install Required Libraries</h3><pre>pip install pandas numpy scikit-learn streamlit</pre><p>Or if you have a requirements.txt:</p><pre>pip install -r requirements.txt</pre><h3>🤖 Step 2: Train the Machine Learning Model</h3><p>Let’s break this part down 👇</p><h3>💡 What is a Machine Learning Model?</h3><p>A model is a mathematical formula that learns <strong>patterns</strong> from data and then uses those patterns to make <strong>predictions</strong>. Just like how we learn from examples, the model “learns” from the dataset.</p><p>We’ll use a model called a <strong>Support Vector Machine (SVM)</strong>. Don’t worry about the name — just think of it as a smart classifier that tries to <strong>separate diabetic vs. non-diabetic</strong> patients.</p><h3>🧪 Inside train_model.py</h3><pre># Load the data<br>df = pd.read_csv(&#39;diabetes.csv&#39;)</pre><pre># Split into input (X) and output (Y)<br>X = df.drop(&#39;Outcome&#39;, axis=1)<br>Y = df[&#39;Outcome&#39;]</pre><p>We use <strong>80% for training</strong>, 20% for testing — so we can see how well our model performs on unseen data.</p><pre>from sklearn.model_selection import train_test_split<br>X_train, X_test, Y_train, Y_test = train_test_split(X, Y, stratify=Y, test_size=0.2)</pre><p>Train the model using a <strong>linear classifier</strong> (fast and accurate for this type of data):</p><pre>from sklearn.svm import SVC<br>model = SVC(kernel=&#39;linear&#39;)<br>model.fit(X_train, Y_train)</pre><p>Check the accuracy:</p><pre>from sklearn.metrics import accuracy_score<br>print(&quot;Training Accuracy:&quot;, accuracy_score(Y_train, model.predict(X_train)))<br>print(&quot;Test Accuracy:&quot;, accuracy_score(Y_test, model.predict(X_test)))</pre><p>Save the model:</p><pre>import pickle<br>pickle.dump(model, open(&#39;trained_model.sav&#39;, &#39;wb&#39;))</pre><p>Run the script:</p><pre>python train_model.py</pre><h3>🌐 Step 3: Build the Streamlit Web App</h3><h3>💡 What is Streamlit?</h3><p>Streamlit is like magic 🪄 — it turns Python scripts into beautiful web apps without writing any frontend code.</p><h3>Inside diabetes_app.py</h3><ol><li><strong>Load the saved model</strong></li></ol><pre>model = pickle.load(open(&#39;trained_model.sav&#39;, &#39;rb&#39;))</pre><p><strong>2. Create a function to make predictions</strong></p><pre>def predict(input_data):<br>    input_np = np.asarray(input_data).reshape(1, -1)<br>    result = model.predict(input_np)<br>    return &#39;Diabetic&#39; if result[0] == 1 else &#39;Not Diabetic&#39;</pre><p><strong>3. Design the app UI using Streamlit</strong></p><pre>import streamlit as st</pre><pre>st.title(&quot;🩺 Diabetes Prediction Web App&quot;)</pre><pre>preg = st.number_input(&quot;Pregnancies&quot;, 0)<br>glu = st.number_input(&quot;Glucose&quot;, 0)<br>bp = st.number_input(&quot;Blood Pressure&quot;, 0)<br>skin = st.number_input(&quot;Skin Thickness&quot;, 0)<br>insulin = st.number_input(&quot;Insulin&quot;, 0)<br>bmi = st.number_input(&quot;BMI&quot;, 0.0)<br>dpf = st.number_input(&quot;Diabetes Pedigree Function&quot;, 0.0)<br>age = st.number_input(&quot;Age&quot;, 0)</pre><pre>if st.button(&quot;Predict&quot;):<br>    result = predict([preg, glu, bp, skin, insulin, bmi, dpf, age])<br>    st.success(f&quot;The person is {result}&quot;)</pre><h3>▶️ Step 4: Run the App</h3><p>Run this in your terminal:</p><pre>streamlit run diabetes_app.py</pre><p>🎉 You’ll get an interactive web page where you can input values and see results instantly.</p><h3>🧠 Common Questions (for Beginners)</h3><h3>❓ What’s the difference between training and testing?</h3><p>Training = Teaching the model<br> Testing = Checking if it learned well</p><h3>❓ What does “saving the model” mean?</h3><p>It’s like saving a recipe so we don’t have to re-cook from scratch each time.</p><h3>❓ Why use Streamlit?</h3><p>It’s beginner-friendly and avoids the complexity of HTML/JS/CSS. Perfect for data projects!</p><h3>☁️ Optional: Deploy on Streamlit Cloud</h3><p>Want to share your app with others?</p><ol><li>Push your code to GitHub</li><li>Go to streamlit.io/cloud</li><li>Click <strong>New App</strong> and select diabetes_app.py</li><li>Done! 🌍 Your app is now live</li></ol><h3>📦 GitHub Repo</h3><p>All code is available here:<br> 👉<a href="https://github.com/aagamaar/DIABETIC_PREDICTION">diabetes-prediction</a></p><h3>💬 Final Thoughts</h3><p>Building your first ML project doesn’t have to be hard. This project covers the <strong>full cycle</strong>:</p><p>✅ Load real data<br> ✅ Train a model<br> ✅ Save and reuse it<br> ✅ Build a web app<br> ✅ Share it with the world</p><p>Give it a try, fork the repo, tweak the code — and most importantly, have fun learning! 😄</p><p><strong>CONNECT WITH ME:</strong></p><p><a href="http://www.linkedin.com/in/aagamaar"><em>Linkedin</em></a></p><p><a href="https://github.com/aagamaar"><em>Github</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e2745b9f0bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>