Foundations & Concepts
Your first ML project
Learn Your first ML project: 34 practice questions and answers with an interactive quiz — from the offline AI Learning app.
Questions & Answers
Tap a question to reveal its answer. Written for self-study and interview preparation.
What is the main idea of machine learning (ML)?
Machine learning is when a computer learns patterns from examples (data) instead of being given exact step-by-step rules for every case. After learning, it can make predictions or decisions on new data it has not seen before. This is different from traditional programming, where a human writes all the rules by hand.
In an ML project, what do we usually call the examples the computer learns from?
The examples used to teach the model are called the training data. Each example usually has input features (what we know) and often a label (the correct answer we want to predict). Good training data is very important because the model learns its patterns from it.
What is a 'feature' in a machine learning dataset?
A feature is one piece of input information that describes an example, like the height of a plant or the number of rooms in a house. The model uses features to find patterns and make a prediction. A dataset usually has several features for each example.
What is a 'label' in supervised learning?
A label is the correct answer attached to a training example, such as 'cat' or 'dog' for a photo. In supervised learning, the model studies inputs together with their labels so it can learn to predict the label for new inputs. Without labels, the learning would be unsupervised instead.
What is the difference between supervised and unsupervised learning?
In supervised learning, the training data includes labels (correct answers), so the model learns to predict those answers. In unsupervised learning, there are no labels, so the model instead finds hidden patterns or groups in the data, like clustering similar customers together. The key difference is whether labeled answers are provided.
Why do we split data into a training set and a test set?
We train the model on the training set and then check its accuracy on a separate test set the model has never seen. This shows how well the model will work on new, real-world data instead of just memorizing the examples. If we tested on the same data we trained on, the score would be unfairly high.
What does it mean when a model is 'overfitting'?
Overfitting means the model has memorized the training data too closely, including its noise and quirks, so it performs well on training data but poorly on new data. It is like a student who memorizes exact answers but cannot solve a slightly different question. We want a model that generalizes, not one that just memorizes.
What is 'underfitting' in machine learning?
Underfitting happens when a model is too simple to capture the real patterns in the data, so it performs poorly even on the training data. It is like trying to draw a straight line through data that actually curves. The fix is usually a more powerful model or better features.
What is accuracy as a way to measure a classification model?
Accuracy is the fraction of predictions the model got correct out of all predictions made. For example, if a model labels 90 out of 100 images correctly, its accuracy is 90%. It is a simple, popular measure, but it can be misleading when the classes are very unbalanced.
What is the usual first step before training any ML model?
The usual first step is to collect and prepare the data, which includes cleaning it, handling missing values, and organizing features and labels. Clean, well-prepared data leads to a much better model. People often say 'garbage in, garbage out' to stress how important data quality is.
What is a popular beginner Python library for machine learning?
scikit-learn (imported as sklearn) is a popular and beginner-friendly Python library for classic machine learning. It provides ready-made tools for splitting data, training models, and measuring accuracy with just a few lines of code. It is a great choice for a first ML project.
from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier()In scikit-learn, what does the .fit() method do?
The .fit() method trains the model by feeding it the training inputs and their labels so it can learn the patterns. After fitting, the model is ready to make predictions. You typically call .fit(X_train, y_train) where X is the features and y is the labels.
model.fit(X_train, y_train)In scikit-learn, what does the .predict() method do?
The .predict() method uses a trained model to produce outputs (predictions) for new input data. For example, model.predict(X_test) returns the model's guessed labels for the test examples. You call it after the model has been trained with .fit().
predictions = model.predict(X_test)What is the famous Iris flower dataset often used for in first ML projects?
The Iris dataset contains measurements (like petal and sepal length and width) of three species of iris flowers. It is small and clean, so beginners use it to practice classification, predicting the species from the measurements. It is built into scikit-learn, making it easy to load.
What is the difference between classification and regression tasks?
Classification predicts a category or class, such as 'spam' or 'not spam'. Regression predicts a continuous number, such as the price of a house or tomorrow's temperature. The type of answer you need decides which kind of task you have.
Which of these is a regression problem?
Predicting the exact price of a used bicycle is a regression problem because the answer is a continuous number. Tasks that predict a category, like whether an email is spam, are classification problems. The clue is whether the output is a number on a scale or a label.
What is a 'model' in machine learning?
A model is the result of training: it is the learned set of patterns or rules that can turn inputs into predictions. You create an empty model, train it with data, and then use it to predict on new inputs. Different algorithms (like decision trees) produce different kinds of models.
Why is it important to have enough good-quality data for an ML project?
Models learn patterns from data, so too little or poor-quality data leads to weak, unreliable predictions. More good examples help the model learn real patterns instead of random noise. This is why people say 'garbage in, garbage out'.
What is a decision tree in simple terms?
A decision tree is a model that makes predictions by asking a series of yes/no questions about the features, like a flowchart. Each answer sends you down a branch until you reach a final decision at a leaf. It is popular for beginners because it is easy to understand and visualize.
What does 'generalization' mean for a machine learning model?
Generalization is a model's ability to perform well on new, unseen data, not just the data it was trained on. Good generalization is the real goal of machine learning. A model that only does well on training data but fails on new data has poor generalization.
What is data cleaning, and why is it needed in an ML project?
Data cleaning means fixing problems in the data, such as removing duplicates, correcting errors, and handling missing values. Clean data helps the model learn accurate patterns and avoids misleading results. It is often one of the most time-consuming but important steps.
What is a 'prediction' in machine learning?
A prediction is the output the trained model gives for a new input, like guessing that an email is spam or that a house costs a certain price. Predictions can be categories or numbers depending on the task. They are the main reason we build models.
Why might a model trained only on data from one city perform poorly in another city?
The model learned patterns specific to the first city's data, which may not match the new city's conditions, prices, or habits. This is a form of bias from unrepresentative training data. To work everywhere, the training data should reflect the places where the model will be used.
What is bias in a machine learning dataset?
Bias means the data unfairly favors or ignores certain groups or situations, often because it was not collected fairly. A biased dataset can make the model give unfair or wrong predictions for some people. Checking data for bias is an important part of responsible ML.
Why is privacy an important ethical concern in ML projects?
ML projects often use personal data, so collecting or sharing it without permission can harm people's privacy. Responsible practice means getting consent, using only the data you need, and keeping it secure. Respecting privacy builds trust and follows the law in many places.
What is the role of the 'target' (y) variable in a supervised ML project?
The target, often written as y, is the value we want the model to predict, such as the flower species or house price. The features (X) are the inputs, and the target is the desired output. During training, the model learns to map X to y.
What does normalizing or scaling features mean, and why can it help?
Scaling means adjusting features so they are on a similar range, for example converting all values to be between 0 and 1. This stops features with large numbers from unfairly dominating the model and can help many algorithms learn better. It is a common data-preparation step.
If a spam filter wrongly marks an important email as spam, what type of mistake is that?
This is a false positive: the model predicted 'spam' (positive) when the email was actually not spam. False positives and false negatives are different kinds of errors that matter in different ways. For a spam filter, false positives can be costly because real emails get hidden.
Why should you not test a model on the same data you trained it on?
If you test on the training data, the model may simply repeat answers it memorized, giving a falsely high score. This hides overfitting and does not show real-world performance. A separate test set gives an honest measure of how the model handles new data.
What is a simple way to describe how a model 'learns' during training?
During training, the model makes guesses, compares them to the correct answers, and gradually adjusts itself to reduce its mistakes. Over many examples, it gets better at matching inputs to the right outputs. This repeated adjust-and-improve process is the core of learning from data.
In Python, why do we often import pandas in a first ML project?
pandas is a library for loading and organizing data in table form called a DataFrame. It makes it easy to read files like CSVs, clean data, and select features and labels. It is a very common first step before training a model.
import pandas as pd
data = pd.read_csv('flowers.csv')What is the purpose of a validation set, separate from training and test sets?
A validation set is used during development to tune the model's settings and compare choices without touching the final test set. This keeps the test set truly unseen until the very end, giving an honest final score. It helps prevent accidentally overfitting to the test data.
What is one good first project idea to practice machine learning?
A good first project is classifying iris flowers or handwritten digits using a small, clean, ready-made dataset. These projects are simple enough to finish quickly while teaching the full workflow: load data, train, test, and measure accuracy. Starting small builds confidence before tackling harder problems.
After building a model, why is it useful to look at examples it got wrong?
Looking at wrong predictions, called error analysis, helps you understand where and why the model struggles. You might find messy data, a confusing category, or a missing feature you can improve. This insight guides how to make the next version of the model better.
Related topics in Foundations & Concepts
Put it into practice with AI Learning
This topic — and hundreds more — comes from our free, offline AI Learning app. Practice Q&A, quizzes and cheat sheets anywhere, no account needed.
- Free
- No account
- Works offline