Practice
import numpy as np
from sklearn.linear_model import LinearRegression
X = np.array([[1], [2], [3]])
y = np.array([1, 2, 2.9])
model = LinearRegression().fit(X, y)
print(model.score(X, y))Solution
Step 1: Understand the code
The code fits a linear regression model to the data and calculates the R^2 score.Step 2: Calculate the R^2 score
The model fits the data almost perfectly, resulting in an R^2 score close to 1.Final Answer:
Option D -> Option DQuick Check:
Linear regression fits well here. [OK]
Solution
Step 1: Identify offline data collection characteristics
Offline data collection involves gathering data that has already been generated and stored, not in real-time.Step 2: Eliminate real-time options
Options A, C, and D involve real-time or near-real-time data collection, which is characteristic of online data collection.Final Answer:
Option D -> Option DQuick Check:
Offline = historical, stored data. [OK]
Solution
Step 1: Identify the nature of the problem.
Predicting the next word in a sentence involves understanding context and patterns, which are complex and not easily defined by rules.Step 2: Eliminate rule-based problems.
Options A, C, and D are deterministic and can be solved with explicit algorithms.Final Answer:
Option A -> Option AQuick Check:
ML for patterns, rules for logic. [OK]
Solution
Step 1: Understand receptive fields
Smaller receptive fields in initial layers help capture fine-grained local features, which are crucial for understanding detailed patterns.Step 2: Eliminate wrong options
To capture more global features early on is incorrect because global features are captured in deeper layers. To reduce the computational cost of the network is incorrect as smaller receptive fields don't necessarily reduce computational cost. To increase the depth of the network without increasing parameters is incorrect because depth and parameters are not directly related to receptive field size.Final Answer:
Option C -> Option CQuick Check:
Smaller fields capture local details. [OK]
Solution
Step 1: Identify the constraint.
Cannot alter training data, need fairness in predictions.Step 2: Choose the suitable technique.
Post-processing techniques adjust predictions to ensure fairness without altering the model or data.Final Answer:
Option D -> Option DQuick Check:
Post-processing adjusts predictions, not data. [OK]
