0
0
ML Pythonprogramming~20 mins

Linear regression concept in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Linear Regression Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
Understanding the purpose of linear regression
What is the main goal of linear regression in machine learning?
ATo reduce the number of features by combining them
BTo classify data points into different categories based on input features
CTo cluster data points into groups without labels
DTo find the best straight line that predicts a continuous output from input features
Attempts:
2 left
Predict Output
intermediate
1:00remaining
Output of simple linear regression prediction
What is the predicted value y when x=3 using the model y = 2x + 1?
ML Python
def predict(x):
    return 2 * x + 1

result = predict(3)
print(result)
A8
B6
C7
D5
Attempts:
2 left
Hyperparameter
advanced
1:30remaining
Effect of learning rate in linear regression training
What happens if the learning rate is set too high during linear regression training with gradient descent?
AThe model will underfit the data by stopping early
BThe model may overshoot the minimum loss and fail to converge
CThe model will ignore the input features
DThe model will always converge faster without any issues
Attempts:
2 left
Metrics
advanced
1:30remaining
Choosing the right metric for linear regression
Which metric is commonly used to measure the error of a linear regression model's predictions?
AMean Squared Error (MSE)
BAccuracy
CF1 Score
DConfusion Matrix
Attempts:
2 left
🔧 Debug
expert
2:00remaining
Identifying the error in linear regression code
What error will this code raise when fitting a linear regression model using scikit-learn? from sklearn.linear_model import LinearRegression X = [[1], [2], [3]] y = [2, 4, 6] model = LinearRegression() model.fit(X, y) print(model.predict([4]))
AValueError because input to predict must be 2D array, but [4] is 1D
BTypeError because model.fit expects a list of strings
CNo error, output will be 8
DNameError because LinearRegression is not imported
Attempts:
2 left