Which of the following best describes what machine learning is?
Think about how computers improve by experience rather than fixed instructions.
Machine learning is about computers learning from data patterns to make decisions or predictions without being told exact rules.
What will be the output of this Python code that uses a simple linear model to predict a value?
from sklearn.linear_model import LinearRegression import numpy as np # Training data: x values and y values X = np.array([[1], [2], [3], [4]]) y = np.array([2, 4, 6, 8]) model = LinearRegression() model.fit(X, y) # Predict for new input prediction = model.predict(np.array([[5]])) print(round(prediction[0], 1))
Look at the pattern in y compared to x in the training data.
The training data shows y = 2 * x. So for x=5, prediction is 10.
You want to build a system that recognizes objects in photos. Which model type is best suited for this task?
Think about models that work well with images and spatial patterns.
CNNs are designed to detect patterns in images and are widely used for image recognition tasks.
You trained a model to classify emails as spam or not spam. Which metric best tells you how many spam emails your model correctly identified?
Recall measures how many actual positive cases were found.
Recall shows the proportion of actual spam emails that the model correctly detected.
What error will this Python code raise when trying to train a simple model?
import numpy as np from sklearn.linear_model import LinearRegression X = np.array([[1], [2], [3]]) y = np.array([2, 4]) # Mismatched length model = LinearRegression() model.fit(X, y)
Check if the input and output arrays have the same number of samples.
The input X has 3 samples but y has only 2, causing a mismatch error during training.
