0
0
Intro to Computingfundamentals~20 mins

Machine learning concept in Intro to Computing - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Machine Learning Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Overfitting in Machine Learning

Which of the following best describes overfitting in machine learning?

AThe model performs well on training data but poorly on new, unseen data.
BThe model performs poorly on both training and testing data due to lack of learning.
CThe model ignores the training data and predicts random outputs.
DThe model performs equally well on training and testing data.
Attempts:
2 left
💡 Hint

Think about when a model learns too much detail from the training data.

🔍 Analysis
intermediate
2:00remaining
Output of Simple Linear Regression Prediction

What is the output of the following Python code that fits a simple linear regression and predicts a value?

Intro to Computing
from sklearn.linear_model import LinearRegression
import numpy as np

X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2, 4, 6, 8, 10])
model = LinearRegression().fit(X, y)
prediction = model.predict([[6]])
print(round(prediction[0], 2))
A11.0
B10.0
C12.0
D6.0
Attempts:
2 left
💡 Hint

Look at the pattern in y relative to X.

data_output
advanced
2:00remaining
Confusion Matrix Interpretation

Given a binary classification confusion matrix below, what is the accuracy?

[[50, 10],
 [5, 35]]
A80%
B75%
C90%
D85%
Attempts:
2 left
💡 Hint

Accuracy = (True Positives + True Negatives) / Total samples.

visualization
advanced
2:00remaining
Interpreting a Decision Tree Plot

Which statement best describes the role of the root node in a decision tree?

AIt is the first decision point that splits the data based on the most important feature.
BIt is the last node that gives the final prediction.
CIt is a leaf node that contains the predicted class label.
DIt is a node that randomly splits data without any criteria.
Attempts:
2 left
💡 Hint

Think about where the tree starts splitting data.

🔍 Analysis
expert
2:00remaining
Identifying Error in K-Means Clustering Code

What error will the following code raise when run?

from sklearn.cluster import KMeans
import numpy as np

X = np.array([[1, 2], [1, 4], [1, 0], [10, 2], [10, 4], [10, 0]])
model = KMeans(n_clusters=2, random_state=0)
model.fit(X)
print(model.predict([[0, 0]]))
ATypeError: fit() missing 1 required positional argument
BNo error, output is [0]
CValueError: Number of clusters must be greater than number of samples
DAttributeError: 'KMeans' object has no attribute 'predict'
Attempts:
2 left
💡 Hint

Check if KMeans has a predict method and if input shapes are correct.