<?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 Nevin Selby on Medium]]></title>
        <description><![CDATA[Stories by Nevin Selby on Medium]]></description>
        <link>https://medium.com/@nevinselby?source=rss-19985dd7d1e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OhMwiHbR7Vc2vkRmBt1huA.png</url>
            <title>Stories by Nevin Selby on Medium</title>
            <link>https://medium.com/@nevinselby?source=rss-19985dd7d1e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:11:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nevinselby/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[MLOps in the Cranberry Fields: How I Turned Data into Actionable Insights]]></title>
            <link>https://medium.com/@nevinselby/mlops-in-the-cranberry-fields-how-i-turned-data-into-actionable-insights-6a239ea82bb5?source=rss-19985dd7d1e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a239ea82bb5</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agriculture]]></category>
            <dc:creator><![CDATA[Nevin Selby]]></dc:creator>
            <pubDate>Tue, 25 Mar 2025 23:16:12 GMT</pubDate>
            <atom:updated>2025-03-25T23:16:12.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*onuoEjI_uoVHD77EDN6atQ.jpeg" /></figure><p>Picture this: Cranberry fields, cutting-edge AI, and a mission to revolutionize fruit selection. Sounds like the plot of a tech rom-com, right? Except this is a true story of how MLOps can transform even the most traditional industries.</p><h3>The Data Wilderness Beneath the Surface</h3><p>When I joined the UW College of Agricultural &amp; Life Sciences, I wasn’t just another grad student with a laptop. I was a data detective on a mission to help cranberry growers make smarter decisions. But here’s the reality check most people miss: Machine learning isn’t just about creating a sexy algorithm. It’s a grueling expedition through data that would make a statistician weep.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UfRzgy39lDesSNLM6xcjcg.jpeg" /><figcaption>Harvested Cranberries</figcaption></figure><p>Facing 700 gigabytes of raw agricultural images was like trying to find a specific grain of sand on a beach — except this beach was filled with potential cranberry images, each with its own complex background, lighting challenges, and hidden nuances.</p><h3>The Data Preparation Gauntlet</h3><p>My workflow became a multi-stage battle:</p><ul><li><strong>Data Filtering</strong>: Culling 700 GB of images to extract meaningful training data</li><li><strong>Data Augmentation</strong>: Transforming existing images to create synthetic training data</li><li><strong>Intelligent Labeling</strong>: Developing a semi-automated labeling strategy</li></ul><p>The process wasn’t just technical — it was an art of understanding agricultural imagery at its most fundamental level.</p><h3>From Pixels to Precision</h3><p>My first weapon of choice? YOLOv8, an object detection model that could identify cranberries with laser-like precision. By implementing custom data augmentation techniques with Albumentations, I boosted the model’s accuracy by 15%. Translation: We could now spot the perfect cranberries faster and more accurately than ever before.</p><p>Developing a classification model for cranberries wasn’t a simple task. Imagine trying to identify a specific fruit in nature’s most complex camouflage — tangled leaves, uneven lighting, shadows that play tricks on your perception. This wasn’t a clean, curated dataset. This was raw, unfiltered agricultural reality.</p><h3>The MLOps Playground</h3><p>Using AWS services like S3 and SageMaker, combined with MLflow for model versioning, I created a robust ecosystem that could:</p><ul><li>Version models automatically</li><li>Deploy updates seamlessly</li><li>Track performance in real-time</li></ul><p>Using the CLIP model for auto-labeling, I could process over 12,000 images with minimal human intervention. The ResNet50 model I developed improved classification accuracy by 25% over baseline CNN models, implementing semi-supervised learning that dramatically reduced manual effort.</p><h3>The Human Touch</h3><p>The most important part? Collaboration. I didn’t just build models in isolation. I worked directly with cranberry growers, ensuring our AI solutions solved real problems, not just looked good on a slide deck.</p><p>The result? Cranberry growers went from guesswork to data-driven decisions. We could now predict the best fertilization timing and select the most promising fruits with unprecedented accuracy.</p><h3>The Philosophical Mic Drop</h3><p>In the world of AI, it’s not about creating the most complex model. It’s about creating models that work — models that transform industries, one cranberry at a time.</p><p><em>Iteration is not just a technical process. It’s a mindset.</em></p><p>To get more insightful content like this, follow me on Medium, and subscribe to <a href="https://iterai.beehiiv.com/subscribe">iterai.beehiiv.com/subscribe</a> for weekly articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a239ea82bb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL: The Ultimate One-Stop Guide (Common Mistakes & Best Practices) — Part 1]]></title>
            <link>https://medium.com/@nevinselby/sql-the-ultimate-one-stop-guide-common-mistakes-best-practices-part-1-579aba2f6994?source=rss-19985dd7d1e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/579aba2f6994</guid>
            <category><![CDATA[basics]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[hackerrank]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Nevin Selby]]></dc:creator>
            <pubDate>Sat, 15 Mar 2025 13:02:33 GMT</pubDate>
            <atom:updated>2025-03-15T13:02:33.629Z</atom:updated>
            <content:encoded><![CDATA[<h3>SQL: The Ultimate One-Stop Guide (Common Mistakes &amp; Best Practices) — Part 1</h3><p>As someone actively searching for data-related jobs, one requirement that I see in almost every job posting is <strong>SQL proficiency</strong>. Whether it’s a <strong>Data Analyst, Data Engineer, or Data Scientist</strong> role, SQL is an essential skill.</p><p>So, I started solving <strong>LeetCode SQL questions</strong>, then moved to <strong>HackerRank SQL challenges</strong> to improve my skills. Along the way, I discovered that SQL is <strong>not just about SELECT, JOIN, and WHERE</strong> — there’s a whole world of powerful techniques like <strong>Common Table Expressions (CTEs), Window Functions, Recursive Queries, and more</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_b2GqLHEv2DnBilPNlTnJQ.png" /><figcaption>I Completed all Medium and Hard Level Questions from the SQL 50 on LeetCode</figcaption></figure><p>In this guide, I’ll break down these concepts in-depth, explain common mistakes, and clarify <strong>when to use what</strong> with examples.</p><h3>1. SELECT: When &amp; How to Use It</h3><h4>What is SELECT?</h4><p>SELECT is used to retrieve <strong>specific columns</strong> from a table.</p><pre>SELECT name, age FROM employees;</pre><p>This will return only the name and age columns from the employees table.</p><h4>❌ Common Mistakes with SELECT</h4><p>Using SELECT * Unnecessarily</p><pre>SELECT * FROM employees;</pre><p>This retrieves all columns, which is inefficient if you only need a few columns. Instead, be specific ✅:</p><pre>SELECT name, age FROM employees;  -- ✅ Good Practice</pre><h3>2. WHERE: Filtering Data (Before Aggregation)</h3><h4>What is WHERE?</h4><p>WHERE is used to <strong>filter rows before any grouping or aggregation happens</strong>.</p><pre>SELECT name, age FROM employees WHERE age &gt; 30;</pre><p>This returns only employees older than 30.</p><h4>❌ Common Mistakes with WHERE</h4><p>Using WHERE with Aggregated Columns</p><p>The following <strong>will not work</strong>:</p><pre>SELECT department, COUNT(*) FROM employees WHERE COUNT(*) &gt; 10 GROUP BY department;  -- ❌ Error!</pre><p>Why? Because <strong>COUNT(*) is an aggregation, and WHERE cannot be used with aggregated results</strong>. Instead, use <strong>HAVING</strong> (explained later).</p><p>✅ <strong>Correct Way Using HAVING:</strong></p><pre>SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) &gt; 10;</pre><h3>3. ORDER BY: Sorting Data</h3><h4>What is ORDER BY?</h4><p>ORDER BY is used to <strong>sort the result set</strong>.</p><pre>SELECT name, salary FROM employees ORDER BY salary DESC;</pre><p>This sorts employees by <strong>salary in descending order</strong> (highest to lowest).</p><h4>❌ Common Mistakes with ORDER BY</h4><p>Using ORDER BY on a Column That’s Not in SELECT</p><pre>SELECT name FROM employees ORDER BY salary DESC;  -- ✅ Works in SQL, but not all databases allow this</pre><p>Most databases <strong>allow this</strong>, but some require all columns in ORDER BY to be in SELECT.</p><p>✅ <strong>Fix by including the column:</strong></p><pre>SELECT name, salary FROM employees ORDER BY salary DESC;</pre><h3>4. GROUP BY: Aggregation (When to Use It)</h3><h4>What is GROUP BY?</h4><p>GROUP BY is used to <strong>aggregate data based on unique values of a column</strong>.</p><pre>SELECT department, COUNT(*) FROM employees GROUP BY department;</pre><p>This counts the number of employees <strong>in each department</strong>.</p><h4>❌ Common Mistakes with GROUP BY</h4><p>Selecting Columns That Are Not in GROUP BY or Aggregated</p><pre>SELECT department, name, COUNT(*) FROM employees GROUP BY department;  -- ❌ Error!</pre><p>Why? Because name is neither <strong>aggregated (COUNT, SUM, etc.)</strong> nor in GROUP BY.</p><p>✅ <strong>Fix: Either aggregate the column or include it in GROUP BY</strong></p><pre>SELECT department, COUNT(*) FROM employees GROUP BY department;  -- ✅ Correct</pre><p>OR</p><pre>SELECT department, name, COUNT(*) FROM employees GROUP BY department, name;  -- ✅ Correct</pre><h3>5. HAVING: Filtering Aggregated Results</h3><h4>What is HAVING?</h4><p>HAVING is used to <strong>filter results after aggregation</strong>.</p><pre>SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) &gt; 10;</pre><p>This <strong>groups employees by department and only keeps those with more than 10 employees</strong>.</p><h3>❌ Common Mistakes with HAVING</h3><p>Using HAVING Without GROUP BY</p><p>This will <strong>work in some databases</strong> but is not standard SQL:</p><pre>SELECT name, salary FROM employees HAVING salary &gt; 50000;  -- ❌ Not Standard SQL</pre><p>✅ Fix: Use WHERE Instead</p><pre>SELECT name, salary FROM employees WHERE salary &gt; 50000;</pre><p>HAVING should <strong>only be used with GROUP BY</strong> to filter aggregated results.</p><h3>6. Can You Use WHERE and GROUP BY Together?</h3><h4>✅ Yes, But Use WHERE Before GROUP BY</h4><pre>SELECT department, COUNT(*) FROM employees <br>WHERE age &gt; 30  -- ✅ Filter first<br>GROUP BY department;</pre><ul><li>WHERE filters data <strong>before aggregation</strong>.</li><li>GROUP BY groups the <strong>filtered data</strong>.</li></ul><p>🚫 If you try to put WHERE after GROUP BY, it <strong>will not work</strong>.</p><h3>7. DISTINCT: Removing Duplicates</h3><h4>What is DISTINCT?</h4><p>DISTINCT removes duplicate rows from the result.</p><pre>SELECT DISTINCT department FROM employees;</pre><p>This returns <strong>only unique department names</strong>.</p><h3>❌ Common Mistakes with DISTINCT</h3><p>Using DISTINCT on Only One Column When You Want Multiple Unique Values</p><p>This will return <strong>unique department values, but not unique (department, name) pairs</strong>:</p><pre>SELECT DISTINCT department, name FROM employees;  -- ❌ Might not behave as expected</pre><p>✅ Fix: Use GROUP BY if you want unique groups</p><pre>SELECT department, name FROM employees GROUP BY department, name;</pre><h3>8. LIMIT and OFFSET: Pagination</h3><h4>What is LIMIT?</h4><p>LIMIT restricts the number of rows returned.</p><pre>SELECT name FROM employees LIMIT 5;</pre><p>This returns only the <strong>first 5 rows</strong>.</p><h4>What is OFFSET?</h4><p>OFFSET skips a certain number of rows.</p><pre>SELECT name FROM employees ORDER BY salary DESC LIMIT 5 OFFSET 10;</pre><p>This <strong>skips the first 10 rows</strong> and then returns the next <strong>5 rows</strong>.</p><h3>❌ Common Mistakes with LIMIT &amp; OFFSET</h3><p>Using OFFSET Without ORDER BY</p><pre>SELECT name FROM employees OFFSET 10 LIMIT 5;  -- ❌ Might return unpredictable results!</pre><p>✅ Always use ORDER BY to ensure predictable ordering</p><pre>SELECT name FROM employees ORDER BY salary DESC LIMIT 5 OFFSET 10;</pre><h3>Final Thoughts</h3><p>SQL is powerful, but <strong>small mistakes</strong> can lead to wrong results or errors. Here’s what to remember:</p><p>✔ Use WHERE for <strong>filtering before aggregation</strong>.<br>✔ Use HAVING for <strong>filtering after aggregation</strong>.<br>✔ Use GROUP BY when applying <strong>aggregations like COUNT, SUM, AVG</strong>.<br>✔ Always use ORDER BY when using LIMIT or OFFSET.<br>✔ Avoid SELECT * unless necessary.</p><p>If you’re preparing for <strong>SQL interviews</strong>, <strong>practice on LeetCode &amp; HackerRank</strong>, and keep improving! 🚀</p><p>What SQL topic do you find the hardest? Let me know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=579aba2f6994" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AutoML-ify: Automating Machine Learning from Start to End]]></title>
            <link>https://medium.com/@nevinselby/automl-ify-automating-machine-learning-from-start-to-end-05fc2d95f238?source=rss-19985dd7d1e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/05fc2d95f238</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[eda]]></category>
            <category><![CDATA[automl]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nevin Selby]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 13:02:29 GMT</pubDate>
            <atom:updated>2025-03-11T13:02:29.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nZ4SBzWA9TovajUjfLitGg.png" /></figure><h4>Introduction</h4><p>Machine Learning (ML) is powerful but often requires tedious preprocessing, feature engineering, model selection, and hyperparameter tuning. <strong>AutoML-ify</strong> is designed to automate these steps, making ML <strong>accessible</strong>, <strong>efficient</strong>, and <strong>fast</strong>.</p><p>Built with <strong>Streamlit</strong>, <strong>Scikit-learn</strong>, and <strong>XGBoost</strong>, AutoML-ify simplifies ML workflows into an easy-to-use pipeline where you only need to <strong>upload a dataset</strong>, and it takes care of everything — from <strong>data cleaning to model training and visualization</strong>.</p><p>🚀 Whether you’re a <strong>data scientist</strong>, <strong>business analyst</strong>, or <strong>ML enthusiast</strong>, AutoML-ify speeds up the ML process while ensuring robust model performance.</p><h4>The Inspiration Behind AutoML-ify</h4><p>The idea for AutoML-ify came from a common frustration: <strong>ML workflows are repetitive</strong>. Every ML project typically involves:<br>✅ <strong>Data Cleaning</strong> — Handling missing values, duplicates, and outliers.<br>✅ <strong>Feature Engineering</strong> — Encoding categorical variables, scaling numerical features.<br>✅ <strong>Model Selection</strong> — Choosing the right model (Classification or Regression).<br>✅ <strong>Hyperparameter Optimization</strong> — Finding the best model settings for performance.<br>✅ <strong>Visualization &amp; Interpretation</strong> — Understanding model results.</p><h4>Why not automate it all? 🤔</h4><p>Instead of spending <strong>hours</strong> on these steps, AutoML-ify was built to make it as simple as:<br>1️⃣ Uploading a dataset.<br>2️⃣ Letting the tool analyze, clean, and process the data.<br>3️⃣ AutoML-ify picks the best model and trains it.<br>4️⃣ You get performance insights, reports, and visualizations!</p><h4>How AutoML-ify Works</h4><ol><li>Upload a Dataset<br>AutoML-ify starts by accepting a CSV file and loading it into a Pandas DataFrame.</li></ol><pre>import pandas as pd<br><br># Load dataset<br>file = &quot;data.csv&quot;  # User-uploaded file<br>df = pd.read_csv(file)<br><br># Display first few rows<br>df.head()</pre><p>The tool then automatically detects:<br>✔ <strong>Numerical vs. Categorical features</strong><br>✔ <strong>Missing values</strong><br>✔ <strong>Duplicates and inconsistencies</strong></p><h4>2. Automated Data Cleaning</h4><p>Messy data leads to poor model performance. AutoML-ify handles:<br>🔹 <strong>Missing Values</strong> — Uses mean/mode imputation for numerical and categorical data.<br>🔹 <strong>Outliers</strong> — Detects and replaces extreme values.<br>🔹 <strong>Duplicates</strong> — Removes redundant records.</p><pre># Handle missing values<br>df.fillna(df.mean(), inplace=True)  # For numerical columns<br>df.fillna(df.mode().iloc[0], inplace=True)  # For categorical columns<br><br># Remove duplicates<br>df.drop_duplicates(inplace=True)</pre><h4>3. Exploratory Data Analysis (EDA)</h4><p>Understanding data is crucial. AutoML-ify generates <strong>statistical summaries and visualizations</strong> automatically.</p><pre>import seaborn as sns<br>import matplotlib.pyplot as plt<br><br># Correlation Heatmap<br>plt.figure(figsize=(10,6))<br>sns.heatmap(df.corr(), annot=True, cmap=&quot;coolwarm&quot;)<br>plt.show()</pre><p>📊 <strong>Key EDA Insights:</strong><br>✅ Feature distributions<br>✅ Correlations<br>✅ Outliers &amp; Trends</p><h4>4. Feature Preprocessing &amp; Encoding</h4><p>Before training models, features must be <strong>scaled and encoded</strong> properly. AutoML-ify automatically:<br>🔹 <strong>Encodes categorical features</strong> using One-Hot Encoding.<br>🔹 <strong>Scales numerical features</strong> using Standardization/Normalization.</p><pre>from sklearn.preprocessing import StandardScaler, OneHotEncoder<br>from sklearn.compose import ColumnTransformer<br><br># Identify categorical and numerical columns<br>categorical_features = df.select_dtypes(include=[&quot;object&quot;]).columns<br>numerical_features = df.select_dtypes(include=[&quot;int64&quot;, &quot;float64&quot;]).columns<br><br># Preprocessing Pipeline<br>preprocessor = ColumnTransformer([<br>    (&quot;num&quot;, StandardScaler(), numerical_features),<br>    (&quot;cat&quot;, OneHotEncoder(handle_unknown=&quot;ignore&quot;), categorical_features)<br>])</pre><h4>5. Model Selection &amp; Training</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q3kNnjx5miCGWnf3NhAmZw.png" /></figure><p>AutoML-ify automatically selects the <strong>best model</strong> for:<br>✅ <strong>Classification Tasks</strong> (Logistic Regression, Random Forest, XGBoost, etc.)<br>✅ <strong>Regression Tasks</strong> (Linear Regression, Decision Trees, SVR, etc.)</p><p><strong>Classification Example</strong></p><pre>from sklearn.ensemble import RandomForestClassifier<br>from sklearn.model_selection import train_test_split<br><br># Split Data<br>X = df.drop(&quot;target&quot;, axis=1)<br>y = df[&quot;target&quot;]<br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<br><br># Train Model<br>model = RandomForestClassifier(n_estimators=100, random_state=42)<br>model.fit(X_train, y_train)</pre><p><strong>Regression Example</strong></p><pre>from sklearn.linear_model import LinearRegression<br><br># Train Regression Model<br>reg_model = LinearRegression()<br>reg_model.fit(X_train, y_train)</pre><p>AutoML-ify evaluates models using metrics like:</p><ul><li>Accuracy, Precision, Recall (for Classification)</li><li>R² Score, RMSE (for Regression)</li></ul><h4>6. Hyperparameter Optimization</h4><p>Finding the best model settings is crucial. AutoML-ify uses <strong>RandomizedSearchCV</strong> for automatic tuning.</p><pre>from sklearn.model_selection import RandomizedSearchCV<br><br># Define Hyperparameter Grid<br>param_grid = {<br>    &quot;n_estimators&quot;: [50, 100, 200],<br>    &quot;max_depth&quot;: [None, 10, 20],<br>    &quot;min_samples_split&quot;: [2, 5, 10]<br>}<br><br># Hyperparameter Optimization<br>search = RandomizedSearchCV(RandomForestClassifier(), param_grid, n_iter=10, cv=5, random_state=42)<br>search.fit(X_train, y_train)<br><br># Best Parameters<br>print(search.best_params_)</pre><h4>7. Results &amp; Visualizations</h4><p>AutoML-ify provides <strong>detailed reports and performance visualizations</strong> using Plotly and Seaborn.</p><p>Confusion Matrix for Classification</p><pre>from sklearn.metrics import confusion_matrix<br>import seaborn as sns<br><br># Generate Predictions<br>y_pred = model.predict(X_test)<br><br># Plot Confusion Matrix<br>cm = confusion_matrix(y_test, y_pred)<br>sns.heatmap(cm, annot=True, cmap=&quot;Blues&quot;)<br>plt.xlabel(&quot;Predicted&quot;)<br>plt.ylabel(&quot;Actual&quot;)<br>plt.show()</pre><p>Feature Importance for Decision Trees</p><pre>importances = model.feature_importances_<br>sns.barplot(x=importances, y=X.columns)<br>plt.title(&quot;Feature Importance&quot;)<br>plt.show()</pre><h4>What Makes AutoML-ify Special?</h4><p>✅ <strong>No Coding Required</strong> — Just upload your dataset.<br>✅ <strong>Saves Time</strong> — Automates tedious tasks.<br>✅ <strong>Handles Any Dataset</strong> — Works for both classification &amp; regression.<br>✅ <strong>Open-Source &amp; Customizable</strong> — Modify it for your own needs!</p><h4>Conclusion</h4><p>AutoML-ify bridges the gap between <strong>raw data</strong> and <strong>machine learning insights</strong>. Whether you’re new to ML or a seasoned expert, this tool makes training models effortless.</p><p>🚀 <strong>Try it now:</strong> <a href="https://starttoendml.streamlit.app/">AutoML-ify Web App</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05fc2d95f238" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Personalized Chatbot for My Portfolio: A DIY Approach Without LLM APIs]]></title>
            <link>https://medium.com/@nevinselby/building-a-personalized-chatbot-for-my-portfolio-a-diy-approach-without-llm-apis-007e8ca1ec18?source=rss-19985dd7d1e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/007e8ca1ec18</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[natural-language-process]]></category>
            <category><![CDATA[personal-portfolio]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Nevin Selby]]></dc:creator>
            <pubDate>Thu, 06 Mar 2025 02:44:25 GMT</pubDate>
            <atom:updated>2025-03-12T04:13:43.009Z</atom:updated>
            <content:encoded><![CDATA[<p>When I launched my portfolio website, I wanted to create something unique — a chatbot that could answer questions about my professional background, skills, and projects. While Large Language Models (LLMs) like ChatGPT are powerful, I decided to build a custom solution from scratch. This article explains the technical journey behind creating this chatbot, focusing on the NLP techniques and design decisions that made it work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zHLuQJ56yrrZkIC7fLO3Pw.png" /><figcaption>Portfolio Screenshot</figcaption></figure><h3>Why I Built This Chatbot</h3><p>The motivation for this project came from a desire to showcase my technical skills while solving a real-world problem. Instead of relying on pre-built LLMs, I wanted to:</p><ol><li><strong>Avoid API Costs</strong>: LLM APIs can be expensive, especially for high traffic.</li><li><strong>Ensure Accuracy</strong>: LLMs sometimes “hallucinate” or provide incorrect information. I needed a system that would only provide verified, factual responses.</li><li><strong>Demonstrate Skills</strong>: Building a chatbot from scratch allowed me to showcase my understanding of NLP fundamentals, vector matching, and system design.</li></ol><p>After sharing my portfolio on LinkedIn, many friends and colleagues reached out to ask how I built the chatbot. This article is my attempt to explain the process in detail.</p><h3>How It Works — Technical Core</h3><p>The chatbot is built around a <strong>knowledge-based system</strong> that uses <strong>vector matching</strong> to find the most relevant response to user queries. Here’s a breakdown of the key components:</p><h3>1. Knowledge Base Design</h3><pre>const knowledgeBase = [<br>  {<br>    question: &quot;What are Nevin&#39;s technical skills?&quot;,<br>    answer: &quot;Nevin is proficient in Python, PyTorch, TensorFlow, SQL, AWS, and more.&quot;<br>  },<br>  {<br>    question: &quot;what are nevins educational qualifications&quot;, <br>    answer: &quot;Nevin has a Master&#39;s in Data Science from University of Wisconsin-Madison (2023-2025) with a 3.70/4.0 GPA and a Bachelor&#39;s in Computer Science from Indian Institute of Information Technology, Kottayam (2019-2023) with a 9.15/10.0 GPA.&quot;<br>  }<br> ]</pre><p>The knowledge base contains over 350 entries (amplified using ChatGPT), covering topics like:</p><ul><li>Education</li><li>Work experience</li><li>Technical skills</li><li>Projects</li><li>Personal interests</li></ul><h3>2. Text Preprocessing Pipeline</h3><p>Before matching user queries to the knowledge base, the input text is cleaned and normalized. This involves:</p><ol><li><strong>Lowercasing</strong>: Ensuring case insensitivity.</li><li><strong>Punctuation Removal</strong>: Stripping out special characters.</li><li><strong>Tokenization</strong>: Splitting the text into individual words.</li></ol><p>Here’s the JavaScript implementation:</p><pre>function preprocessText(text) {<br>  return text.toLowerCase()<br>    .replace(/[.,\/#!$%\^&amp;\*;:?{}=\-_`~()]/g, &quot;&quot;)<br>    .trim();<br>}</pre><h3>3. Vector Representation</h3><p>Each query and knowledge base question is converted into a <strong>vector</strong> using a <strong>Bag-of-Words (BoW)</strong> approach. This involves counting the frequency of each word in the text:</p><pre>function textToVector(text) {<br>  const processedText = preprocessText(text);<br>  const words = processedText.split(/\s+/).filter(word =&gt; word.length &gt; 1);<br>  <br>  const vector = {};<br>  words.forEach(word =&gt; {<br>    vector[word] = (vector[word] || 0) + 1;<br>  });<br>  <br>  return vector;<br>}</pre><h3>4. Weighted Cosine Similarity</h3><p>To improve matching accuracy, I implemented a <strong>custom weighting system</strong> that prioritizes important keywords. For example, terms like “education” and “skills” are given higher weights:</p><pre>const keywordWeights = {<br>  &#39;education&#39;: 1.5, &#39;degree&#39;: 1.5, <br>  &#39;masters&#39;: 1.5, &#39;bachelors&#39;: 1.5<br>};</pre><p>The cosine similarity between two vectors is calculated as follows:</p><pre>function enhancedCosineSimilarity(userVector, knowledgeVector) {<br>  const allWords = new Set([...Object.keys(userVector), ...Object.keys(knowledgeVector)]);<br>  <br>  let dotProduct = 0;<br>  let magnitudeA = 0;<br>  let magnitudeB = 0;<br>  <br>  allWords.forEach(word =&gt; {<br>    const weightFactor = keywordWeights[word] || 1.0;<br>    const a = (userVector[word] || 0) * weightFactor;<br>    const b = (knowledgeVector[word] || 0) * weightFactor;<br>    <br>    dotProduct += a * b;<br>    magnitudeA += a * a;<br>    magnitudeB += b * b;<br>  });<br>  <br>  return dotProduct / (Math.sqrt(magnitudeA) * Math.sqrt(magnitudeB));<br>}</pre><h3>5. Tiered Matching System</h3><p>The chatbot uses a <strong>three-tier matching system</strong> to find the best response:</p><ol><li><strong>Primary Match</strong>: If the similarity score is above 0.6, the top match is returned.</li><li><strong>Secondary Check</strong>: If the similarity is between 0.4 and 0.6, the system checks for overlapping keywords in the answers.</li><li><strong>Fallback</strong>: If no strong match is found, the system performs a keyword-based search.</li></ol><p>Here’s the core logic:</p><pre>function findBestMatch(userInput) {<br>  const userVector = textToVector(userInput);<br>  let matches = [];<br>  <br>  knowledgeBase.forEach(item =&gt; {<br>    const questionVector = textToVector(item.question);<br>    const similarity = enhancedCosineSimilarity(userVector, questionVector);<br>    matches.push({ ...item, similarity });<br>  });<br>  <br>  matches.sort((a, b) =&gt; b.similarity - a.similarity);<br>  <br>  if (matches[0].similarity &gt; 0.6) {<br>    return matches[0].answer;<br>  } else if (matches[0].similarity &gt; 0.4 &amp;&amp; matches[1].similarity &gt; 0.3) {<br>    // Check for overlapping keywords in answers<br>    const answer1Words = new Set(preprocessText(matches[0].answer).split(/\s+/));<br>    const answer2Words = new Set(preprocessText(matches[1].answer).split(/\s+/));<br>    let commonWords = 0;<br>    answer1Words.forEach(word =&gt; {<br>      if (answer2Words.has(word)) commonWords++;<br>    });<br>    return matches[0].answer;<br>  } else {<br>    // Fallback to keyword-based search<br>    const keywords = preprocessText(userInput).split(/\s+/);<br>    const keywordMatches = [];<br>    knowledgeBase.forEach(item =&gt; {<br>      const questionWords = new Set(preprocessText(item.question).split(/\s+/));<br>      let matchCount = 0;<br>      keywords.forEach(keyword =&gt; {<br>        if (questionWords.has(keyword)) matchCount++;<br>      });<br>      if (matchCount &gt; 0) keywordMatches.push({ ...item, matchCount });<br>    });<br>    if (keywordMatches.length &gt; 0) {<br>      keywordMatches.sort((a, b) =&gt; b.matchCount - a.matchCount);<br>      return keywordMatches[0].answer;<br>    }<br>    return &quot;I don&#39;t have specific information about that. Could you try rephrasing your question?&quot;;<br>  }<br>}</pre><h3>6. User Interaction</h3><p>The chatbot provides a smooth user experience with:</p><ul><li><strong>Typing Indicators</strong>: Simulates “thinking” before responding.</li><li><strong>Scrollable Interface</strong>: Automatically scrolls to the latest message.</li><li><strong>Responsive Design</strong>: Works seamlessly on both desktop and mobile.</li></ul><h3>Why Not Use LLMs?</h3><p>While LLMs like GPT-4 are powerful, they weren’t the right fit for this project because:</p><ol><li><strong>Cost</strong>: API usage can become expensive.</li><li><strong>Accuracy</strong>: LLMs may generate incorrect or irrelevant responses.</li><li><strong>Control</strong>: I wanted full control over the responses to ensure they aligned with my professional narrative.</li></ol><h3>Future Enhancements</h3><p>While the chatbot works well, there’s always room for improvement:</p><ol><li><strong>Synonym Handling</strong>: Expand the system to recognize equivalent terms (e.g., “ML” and “machine learning”).</li><li><strong>Contextual Memory</strong>: Enable follow-up questions by maintaining conversation context.</li><li><strong>Dynamic Learning</strong>: Allow the chatbot to learn from user interactions over time.</li></ol><h3>Try It Yourself</h3><p>You can interact with the chatbot on my portfolio: <a href="https://nevinselby.github.io/">Portfolio</a><br>The full code is available on GitHub: <a href="https://github.com/NevinSelby/nevinselby.github.io">GitHub Repository</a></p><h3>Conclusion</h3><p>Building this chatbot was a rewarding experience that allowed me to apply NLP concepts in a practical, real-world scenario. It’s a testament to the power of <strong>rule-based systems</strong> and <strong>vector matching</strong> for specialized applications. If you’re interested in collaborating or discussing this project further, feel free to reach out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=007e8ca1ec18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Convolutional Neural Network For Beginners]]></title>
            <link>https://medium.com/@nevinselby/convolutional-neural-network-for-beginners-83c10e0af182?source=rss-19985dd7d1e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/83c10e0af182</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nevin Selby]]></dc:creator>
            <pubDate>Thu, 18 Aug 2022 19:41:18 GMT</pubDate>
            <atom:updated>2022-08-18T19:41:18.549Z</atom:updated>
            <content:encoded><![CDATA[<p>Artificial neural networks do incredibly well in machine learning. Artificial neural networks are used to classify words, audio, and images among other things. Different neural network types are employed for various applications.</p><p>Similar to how we use recurrent neural networks to anticipate the order of words, convolutional neural networks are typically used to classify images.</p><p>The neural networks that are best to solve the same kinds of problems as the human visual system can solve are called <strong>Convolutional Neural Networks</strong> (Sometimes we say <strong>convnet</strong> or <strong>CNN</strong> instead.)</p><h3>The Convolutional Classifier</h3><p>A convnet used for image classification consists of two parts:</p><ul><li><strong>Convolutional base</strong></li><li><strong>Dense head</strong>.</li></ul><p>To extract features from an image, we utilize the base. Although other types of layers are frequently present, the layers that conduct the convolution process make up the majority of the structure.</p><p>The head is used to identify the image’s class. It is typically composed of dense layers, yet it may also contain layers like dropout.</p><p>The two most important types of layers which is usually found in the base are the Convolution layer with ReLU activation and the Maximum Pooling layer.</p><h3>Feature Extraction</h3><p>The <strong>feature extraction</strong> performed by the base consists of <strong>three basic operations</strong>:</p><ol><li><strong>Filter</strong> an image for a particular feature (convolution)</li><li><strong>Detect</strong> that feature within the filtered image (ReLU)</li><li><strong>Condense</strong> the image to enhance the features (maximum pooling)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*Rcy1zLfuhwdbRl26_p69ZQ.png" /><figcaption>Src: <a href="https://www.kaggle.com/code/ryanholbrook/convolution-and-relu">https://www.kaggle.com/code/ryanholbrook/convolution-and-relu</a></figcaption></figure><p>References:</p><ul><li><a href="https://www.geeksforgeeks.org/introduction-convolution-neural-network/">https://www.geeksforgeeks.org/introduction-convolution-neural-network/</a></li><li><a href="https://www.kaggle.com/code/ryanholbrook/the-convolutional-classifier">https://www.kaggle.com/code/ryanholbrook/the-convolutional-classifier</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83c10e0af182" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>