#supervisedlearning
➡️ Machine Learning from Scratch, part 35: supervised vs unsupervised learning. In supervised learning every training example comes with the right answer, a label. The model guesses, a loss function measures how wrong the guess was, and training makes that error smaller step by step. In unsupervised learning there are no labels. The model still has a goal, but it is measured on the data itself. k-means is the classic example: place a few group centers, give every point to its nearest center, add up the squared distances, move each center to the middle of its points and repeat. That total never gets larger, and after a few rounds the groups stop changing. Our own run, nothing downloaded. learn.py (16 lines of numpy) makes 300 points in 2D from 3 true groups and learns them both ways. With labels (a nearest-middle classifier trained on 200 points) it gets 100 of 100 new points right. Without labels, k-means brings the total squared distance down from 2927 to 741, and its groups match the true ones for 298 of 300 points. Honest notes: our three groups are made up and well separated on purpose, so both methods do very well; real data is messier. The 298 counts each found group as the true group most of its points belong to (here that is a clean one-to-one match). k-means starts from far-apart points, because a random start can get stuck in a worse grouping. The algorithm cannot know what a group means, so a person still has to name it. #machinelearning #ai #supervisedlearning #coding #python
MachineLearningToGo26,000 次观看 • 1 个月前
没有更多内容可加载
