<?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: Gacheri-Mutua</title>
    <description>The latest articles on DEV Community by Gacheri-Mutua (@gacherimutua).</description>
    <link>https://dev.to/gacherimutua</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%2F3258576%2Fd67f8d6a-eed9-470e-a877-7ae2fbc8c16a.png</url>
      <title>DEV Community: Gacheri-Mutua</title>
      <link>https://dev.to/gacherimutua</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gacherimutua"/>
    <language>en</language>
    <item>
      <title>## Supervised learning — focus on classification</title>
      <dc:creator>Gacheri-Mutua</dc:creator>
      <pubDate>Mon, 29 Sep 2025 19:48:34 +0000</pubDate>
      <link>https://dev.to/gacherimutua/-supervised-learning-focus-on-classification-8pj</link>
      <guid>https://dev.to/gacherimutua/-supervised-learning-focus-on-classification-8pj</guid>
      <description>&lt;p&gt;Supervised learning is a family of machine learning methods where models learn a mapping from inputs to known outputs using labeled examples. You train a model on a dataset of input features paired with target labels so it can predict labels for new, unseen inputs. The supervision (labels) guides the model to discover patterns, relationships, or decision boundaries that connect features to outcomes.&lt;/p&gt;

&lt;h3&gt;
  
  
  How classification works
&lt;/h3&gt;

&lt;p&gt;Classification is the branch of supervised learning where the target is categorical (discrete classes). At a high level classification proceeds in these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data collection and labeling — gather feature vectors and assign class labels.&lt;/li&gt;
&lt;li&gt;Preprocessing — clean data, handle missing values, encode categorical variables, scale numeric features, and split into train/validation/test sets.&lt;/li&gt;
&lt;li&gt;Model selection and training — pick a classifier and fit it to the training data by minimizing a suitable loss (e.g., cross-entropy, hinge loss) using optimization methods.&lt;/li&gt;
&lt;li&gt;Evaluation — measure performance with metrics appropriate for the task (accuracy, precision, recall, F1, ROC AUC, confusion matrix), using validation/test data and possibly cross-validation.&lt;/li&gt;
&lt;li&gt;Calibration and thresholding — for probabilistic classifiers, convert scores to calibrated probabilities or choose decision thresholds to trade off precision vs recall.&lt;/li&gt;
&lt;li&gt;Deployment and monitoring — deploy the model and monitor drift, performance degradation, and data quality.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Common classification models
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Logistic Regression: simple, interpretable, probabilistic linear classifier; effective when classes are linearly separable or after appropriate feature transforms.&lt;/li&gt;
&lt;li&gt;Support Vector Machine (SVM): maximizes margin; kernel SVM handles nonlinearity; effective on medium-sized datasets.&lt;/li&gt;
&lt;li&gt;Decision Tree: interpretable rules, handles mixed data types, prone to overfitting unless pruned.&lt;/li&gt;
&lt;li&gt;Random Forest: ensemble of trees; strong baseline, robust to overfitting, handles missing values and categorical features well.&lt;/li&gt;
&lt;li&gt;Gradient Boosting Machines (XGBoost, LightGBM, CatBoost): high-performance tree ensembles, excellent for tabular data.&lt;/li&gt;
&lt;li&gt;k-Nearest Neighbors (knn): simple, nonparametric, effective for low-dimensional data but costly at inference for large datasets.&lt;/li&gt;
&lt;li&gt;Naive Bayes: fast, works well with high-dimensional sparse data (e.g., text), assumes feature independence.&lt;/li&gt;
&lt;li&gt;Neural Networks / Deep Learning: from shallow MLPs to CNNs/RNNs/Transformers; state-of-the-art on images, text, speech, and complex structured data when large labeled datasets are available.&lt;/li&gt;
&lt;li&gt;Calibrated and probabilistic variants: Platt scaling, isotonic regression, Bayesian classifiers, and more for uncertainty estimates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Model selection considerations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Data size and dimensionality: simple models (logistic regression, naive Bayes) often suffice for small datasets; tree ensembles or deep nets require more data.&lt;/li&gt;
&lt;li&gt;Feature types: trees handle mixed types and missingness; linear models require careful encoding/scaling.&lt;/li&gt;
&lt;li&gt;Interpretability: logistic regression and shallow trees are easier to explain; deep models and ensembles are less transparent.&lt;/li&gt;
&lt;li&gt;Latency and resource constraints: k-NN and large ensembles can be slow at inference; model compression or simpler models may be needed.&lt;/li&gt;
&lt;li&gt;Imbalanced classes: prefer metrics beyond accuracy (precision/recall, F1, ROC-AUC) and use resampling, class-weighting, focal loss, or one-vs-rest schemes as appropriate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  My views and insights
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start simple and iterate: I find starting with a well-regularized logistic regression or a small decision tree gives a quick baseline, reveals data issues, and informs feature engineering. Only escalate to complex models when simpler baselines plateau.&lt;/li&gt;
&lt;li&gt;Feature engineering often matters more than model choice for tabular data: creating informative features, careful encoding, handling missing values, and employing domain knowledge frequently produce larger gains than swapping classifiers.&lt;/li&gt;
&lt;li&gt;Ensembles are powerful but come with cost: random forests and gradient boosting reliably boost performance, but they reduce interpretability and increase inference cost; use them when the performance gain justifies complexity.&lt;/li&gt;
&lt;li&gt;Probabilities and calibration are underappreciated: in many applications (medical, finance), well-calibrated probabilities matter more than raw accuracy. Calibration methods and evaluating with proper scoring rules (Brier score, log loss) should be standard practice.&lt;/li&gt;
&lt;li&gt;Evaluation must align with the real objective: optimize and validate against business or safety-relevant metrics (e.g., cost-sensitive measures, recall at fixed precision) rather than generic accuracy.&lt;/li&gt;
&lt;li&gt;Reproducible pipelines win long-term: automated preprocessing, clear train/validation splits (time-based when applicable), and versioned datasets/models reduce surprises when models are deployed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Challenges I’ve faced with classification
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;High-dimensional sparse data: in text or categorical-heavy datasets, feature explosion makes some models slow or prone to overfitting; dimensionality reduction or regularization is required.&lt;/li&gt;
&lt;li&gt;Overfitting and generalization: tuning complex models without robust validation induces overfitting. Cross-validation, nested CV for hyperparameter tuning, and simple baselines mitigate this.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Practical checklist for a classification project
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Split data respecting temporal or group structure if present.&lt;/li&gt;
&lt;li&gt;Baseline with simple models (e.g logistic regression).&lt;/li&gt;
&lt;li&gt;Engineer and validate features; encode categorical data sensibly.&lt;/li&gt;
&lt;li&gt;Choose evaluation metrics that reflect business needs; use cross-validation.&lt;/li&gt;
&lt;li&gt;Try robust models (random forest, gradient boosting) and calibrate probabilities.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Rags for dummies</title>
      <dc:creator>Gacheri-Mutua</dc:creator>
      <pubDate>Mon, 29 Sep 2025 19:12:25 +0000</pubDate>
      <link>https://dev.to/gacherimutua/rags-for-dummies-5790</link>
      <guid>https://dev.to/gacherimutua/rags-for-dummies-5790</guid>
      <description>&lt;p&gt;Retrieval augmented generation (RAG) is an artificial intelligence (AI) architecture that incorporates external knowledge sources to enhance the capabilities of large language models (LLMs).  RAG pulls in relevant information from outside databases and amplifies input from LLM so that the output can include more relevant, accurate, and contextually appropriate responses. This in turn makes LLMs more powerful by combining them with the ability to retrieve real-time data.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do rags work?
&lt;/h3&gt;

&lt;p&gt;The process begins with an input query or prompt. This could be a question, a statement, or any text that requires a response. The model first analyzes this input to understand its context and intent.&lt;br&gt;
When prompted, the system searches a large set of documents (such as PDFs, FAQs, web pages, or databases) using a retriever model, often based on semantic similarity or keyword matching and selects the most relevant pieces of content.&lt;/p&gt;

&lt;p&gt;RAG integrates this information and original input query and the embeddings of the retrieved documents are combined to form a comprehensive context for the generative model.&lt;/p&gt;

&lt;p&gt;The retrieved documents are passed to a generator model which uses them to craft a coherent, contextually accurate response. In this way, the responses are plausible and grounded in real data. &lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Unsupervised Learning: A Focus on Clustering</title>
      <dc:creator>Gacheri-Mutua</dc:creator>
      <pubDate>Sat, 27 Sep 2025 19:21:22 +0000</pubDate>
      <link>https://dev.to/gacherimutua/unsupervised-learning-a-focus-on-clustering-4i0d</link>
      <guid>https://dev.to/gacherimutua/unsupervised-learning-a-focus-on-clustering-4i0d</guid>
      <description>&lt;p&gt;Unsupervised learning is a type of machine learning that deals with data that does not have labeled responses. Unlike supervised learning, where the model is trained on a dataset with known outputs, unsupervised learning aims to find hidden patterns or intrinsic structures in the input data.&lt;/p&gt;

&lt;p&gt;In unsupervised learning, the algorithm analyzes the input data to identify patterns or groupings without any prior knowledge of the outcomes. The process typically involves the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Data Input&lt;/strong&gt;: The algorithm receives a dataset containing multiple features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pattern Recognition&lt;/strong&gt;: The model processes the data to identify similarities and differences among the data points.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clustering&lt;/strong&gt;: Based on the identified patterns, the algorithm groups the data points into clusters, where points in the same cluster are more similar to each other than to those in other clusters.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The primary goal is to explore the data and uncover its structure, which can lead to insights that inform further analysis or decision-making.&lt;br&gt;
Several models are commonly used in clustering within unsupervised learning:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;K-Means Clustering&lt;/strong&gt;: This algorithm partitions the dataset into K distinct clusters based on feature similarity. It iteratively assigns data points to the nearest cluster centroid and updates the centroids until convergence.&lt;/li&gt;
&lt;/ol&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%2Fmniqbfkyy64wraa746bn.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%2Fmniqbfkyy64wraa746bn.png" alt="before &amp;amp; after k-means" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchical Clustering&lt;/strong&gt;: This method builds a hierarchy of clusters through either agglomerative (bottom-up) or divisive (top-down) approaches. It creates a dendrogram that visually represents the relationships between clusters.&lt;/li&gt;
&lt;/ol&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%2Fa21zifcbxqa5bb7bzjyh.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%2Fa21zifcbxqa5bb7bzjyh.png" alt="Agglomerative vs divisive hierarchial clustering" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most compelling aspects of unsupervised learning is it allows for the exploration of data without preconceived notions. This can lead to surprising insights that might not have been considered initially. For instance, clustering algorithms can reveal natural groupings in customer data, enabling businesses to tailor their marketing strategies more effectively.&lt;/p&gt;

&lt;p&gt;This can serve as a powerful complement to supervised learning where clustering can be used to preprocess data by identifying groups that can then be labeled for supervised learning tasks.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Excel; still an enigma, for now.</title>
      <dc:creator>Gacheri-Mutua</dc:creator>
      <pubDate>Wed, 11 Jun 2025 21:47:52 +0000</pubDate>
      <link>https://dev.to/gacherimutua/excel-still-an-enigma-for-now-41ag</link>
      <guid>https://dev.to/gacherimutua/excel-still-an-enigma-for-now-41ag</guid>
      <description>&lt;h2&gt;
  
  
  by someone who only wanted to do summation.
&lt;/h2&gt;

&lt;p&gt;My interaction with Excel this week has shown me that working with it is similar to knowing that one person who doesn't say much but has layers to them that you begin to notice after one interaction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Initial interaction with excel
&lt;/h3&gt;

&lt;p&gt;On the surface, Excel is a spreadsheet that you organise and format data for storage; however, you find it appealing. It is quite humbling to think you are tech-savvy, then spending the next two hours trying to convert the percentages to integers. &lt;/p&gt;

&lt;p&gt;This cordial spreadsheet holds the power to analyse, automate, model, present data, and, for the unfortunate, cause despair. One missing comma and you can't format the whole column in a dataset. Excel is excellent at data analysis, allowing users to explore trends, patterns, and outliers in datasets, which is particularly useful for departments such as sales, marketing, and finance to make informed forecasts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exciting features
&lt;/h3&gt;

&lt;p&gt;One feature that stuck out to me was pivot tables. They are easy to navigate and are useful for grouping, filtering, and comparing different information across multiple capacities. Conditional formatting is another handy tool that highlights cells based on specific rules to gain targeted information, such as identifying underperforming sectors in a given field. The most exciting part is that with Excel, different tools can be used in combinations and permutations according to how much you know Excel.&lt;/p&gt;

&lt;h3&gt;
  
  
  And now,
&lt;/h3&gt;

&lt;p&gt;The more I learn about Excel, the more I see data differently since structures and hidden relationships that went unnoticed are being revealed. Instead of feeling overwhelmed, you begin to ask better questions, and that is a fine indicator that you are engaging with data analytically for interpretation. Then, Excel becomes a lens to spot the missing links, or what escapes the untrained eye.&lt;/p&gt;

</description>
      <category>career</category>
    </item>
  </channel>
</rss>
