Posts

Neural Networks Demystified: Your Introduction to Deep Learning

From Brain to Algorithm Neural networks started as an attempt to mimic the human brain - neurons connected by dendrites, passing electrical signals in complex layers. Today, we've moved beyond brain simulation to focus on what matters: exceptional predictive power . But here's the thing: neural networks aren't magic. They're just sophisticated function approximators built on concepts you already understand. What You're Actually Building A Multi-Layer Perceptron (MLP) neural network has three types of layers: Input Layer: Takes your predictor variables (like diamond carat and clarity) Hidden Layer(s): Performs mathematical transformations (this is where the "learning" happens) Output Layer: Produces predictions (like diamond price) Every neuron in one layer connects to every neuron in the next. That's why it's called "fully connected." The Diamond Price Challenge We'll predict diamond prices using just two predictors: C...

When Yes/No Needs Probability: Logistic Regression

The Yacht Owner Problem Ten college friends reunite. Some own yachts, others don't. You have their incomes and yacht ownership status (yes/no). Question: Can you predict whether someone owns a yacht based on their income? This is classification, but with a twist. We don't just want "yes" or "no" - we want to know how confident we should be in that prediction. Why Linear Regression Fails for Yes/No Questions Your first instinct might be: "Use linear regression! Treat yacht ownership as 1 (yes) or 0 (no) and fit a line." The problem: Linear regression gives you predictions like 1.25 or -0.3. What does a 125% chance of owning a yacht mean? What about a -30% chance? Probabilities must stay between 0 and 1. Linear regression can't guarantee this. The Linear Probability Model (Tempting but Flawed) If you force linear regression onto binary data anyway, you get: Probability of Yacht = 0.0023 × Income + 0.1418 For someone earning $75,00...

From Linear to Polynomial Regression: The Art of Not Overlearning

 Last week you learned linear regression for prediction (how much will this house cost?). This week: polynomial regression and the critical problem of overlearning. Same dataset. Different challenges. Same tidymodels framework. The Overlearning Problem: When Models Know Too Much Question: Can a model be too good at learning the training data? Answer: Absolutely, and it's called overlearning. Overlearning happens when your model performs amazingly well on training data but falls flat when facing new data. It's like memorizing test answers without understanding the concepts - you'll ace that specific test but fail when the questions change slightly. This isn't just a minor issue - overlearning is one of the most pressing and still not fully solved problems in machine learning. When Does Overlearning Happen? Three main scenarios make overlearning more likely: Small training dataset : Not enough examples to generalize properly Too many variables/parameters : The ...

Machine Learning Fundamentals: Linear Regression Explained

 From Classification to Prediction Last week you learned k-Nearest Neighbors for classification (Adelie, Chinstrap, or Gentoo?). This week: linear regression for prediction (how much will this house cost?). Same workflow. Different goal. Same tidymodels framework. The Intuition: Averages Are Predictions Question: What's the price of an average-sized house in King County? Answer: Probably the average price. If the average house is 1,957 square feet and the average price is $521,294, then predicting $521,294 for a 1,957 sqft house makes sense. But what about a 3,000 sqft house? Or a 1,200 sqft house? We need a better model. Enter: The Line of Best Fit Instead of using just the average, linear regression finds the line that best predicts prices based on square footage. Unfitted model: Price = β₁ × Sqft + β₀ Fitted model (after training): Price = 240 × Sqft + 52,509 Translation: Each additional square foot adds $240 to the predicted price, and a 0-sqft house (hypotheti...

Your First Machine Learning Model: k-Nearest Neighbors

 The Saturday Afternoon Problem Before we dive into algorithms, let's think about how you already do machine learning without knowing it. You want to find someone to spend Saturday afternoon with. You're looking for your "nearest neighbor" based on: Gender (0 or 1) Age (in years) Outdoor sports interest (0-10 scale) Three candidates appear. Who's most similar to you (male, 50 years old, sports score 7)? Candidate 1: Male, 21 years old, score 5 → Average difference: 10.33 Candidate 2: Female, 51 years old, score 9 → Average difference: 1.33 Wait - the 21-year-old guy seems visually closer, but the math says the 51-year-old woman is more similar? This is the scaling problem we'll solve today. What Is k-Nearest Neighbors? It's the most intuitive machine learning algorithm: to classify something new, find what it's closest to and copy that label. If k=1: Find the single closest penguin and use its species If k=4: Find the 4 closest penguin...

Your First Data Transformation: Tidyverse Magic

ISE 423 Lecture 3 Recap What We're Actually Doing Today Stop thinking "programming" - start thinking "data manipulation." Today you learned to take messy data and turn it into exactly what you need, step by step. The Big Three Commands (Your New Best Friends) select() - Pick the columns you want (like choosing which Excel columns to keep)  filter() - Pick the rows you want (like Excel's AutoFilter, but way better)  mutate() - Create new columns based on existing ones (like Excel formulas, but cleaner) The Titanic Example (Real Data, Real Insights) We started with a dataset about Titanic passengers - 8 columns of information about who survived, their age, gender, ticket class, and fare paid. Step 1: Select what matters select(DataTitanic, Survived, Name, Gender, Age) Translation: "Just give me these 4 columns, ignore the rest." Step 2: Filter for who you want filter(DataTitanic, Gender == "female") Translation: "Only sh...

Getting Started with R: Your Data Analysis Toolkit

ISE 423 Lecture 2 Recap What You Actually Need (The Setup) Two things, that's it: R = The engine that runs your code RStudio = The friendly interface that makes R actually usable Think of it like a car: R is the engine, RStudio is everything else that makes driving pleasant. The RStudio Layout (Your New Workspace) RStudio gives you four panels that do different jobs: Top-left: Source Editor - Where you write and save your R scripts Bottom-left: Console - Where R actually runs your commands Top-right: Environment/History - See your variables and what you've done Bottom-right: Files/Plots/Packages - Manage everything else Essential Setup (Do This Once) Critical setting change: Go to Tools → Global Options and uncheck "Restore .RData into workspace at startup" Why? Because you want a fresh start every time, not mysterious leftover data from last week confusing you. Work with Projects: File → New Project. This keeps your analysis organized in its own...