Flats in feature space
About this app
From the table into space: 24 flats with m², rooms and area fly as points into a 3D feature space, the colour is the label (price or “sold within a month”). For a new flat “?” the k nearest neighbours answer — as regression with a price, as classification with yes or no. Row = example, column = feature, last column = label.
With explain mode: an AI tutor walks you through the app, points out what matters in the scene and answers your questions.
Example, feature, label
Supervised learning starts with a table. Every row is an example, here a flat we have seen. The columns are the features, what we know about it: size in square metres, number of rooms, location in the centre or outside. The last column is the label, the answer the model is to learn. If the label is a number such as the price, it is called regression (Latin regredi, to lead back); if it is a category such as “sold within a month: yes or no”, it is classification.
What the app shows
The app shows 24 flats in a city with invented, plausible prices as a table. Three features give three axes: every row flies as a point into a 3D feature space, the area forms two layers, and the colour shows the label, from cheap to expensive or in two colours for sold and not sold. For a new flat marked with a question mark, a k-nearest-neighbours model looks for the most similar flats in the space. For regression the prediction is the mean of their prices; for classification the majority decides.
Try it yourself
Move the new flat with the sliders for square metres, rooms and area and watch which neighbours it finds and how the prediction changes. Switch between price and sale and see that the same points are only coloured differently. Set k to 1, 3, 5 or 7. Add the flat with a price of your own as a new row and let it fly into the space. Clicking a point marks its row in the table.
Frequently asked questions
- What is the difference between a feature and a label?
- Features are the inputs known for every example, such as the size, number of rooms and location of a flat. The label is the output the model is to predict, such as the price. During training both are known; for a new flat only the features are known and the model estimates the label.
- When is it regression and when classification?
- In regression the label is a number on a continuous scale, for example a price or a temperature. In classification the label is a category from a fixed set, for example sold or not sold, spam or not spam. The same features can serve both tasks; only the label changes.
- How does k nearest neighbours work?
- The method stores all examples. For a new case it measures the distance to every example in feature space and takes the k nearest. For regression the prediction is the mean of their labels, for classification the most frequent category. How the features are weighted determines who counts as close.
- What can I try in the app?
- You move a new flat through the feature space with sliders, switch between price and sale as the label, set the number of neighbours, add rows of your own and let the table fly into the space row by row as points.
Subject: Machine Learning
More from Machine Learning
- AdaBoost
- Anatomy of a prompt
- Data privacy traffic lights
- Decision Tree
- Ensemble: Bagging vs. Boosting
- Finding faces: masks versus learning from examples
- k-Means
- k-Nearest Neighbors (kNN)
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps