Class \ Predict | Cat | Dog | Dragon |
Cat | 40 | 10 | 0 |
Dog | 10 | 20 | 10 |
Dragon | 0 | 0 | 30 |
3/4
1
1/4
1/2
matrix.argmax(axis = 1)
, where matrix = numpy.array([[1, 2, 3], [4, 5, 6]])
? [2, 2]
[3, 3]
[1, 1, 1]
[2, 2, 2]
5
4
3
10
numpy.linalg.solve(X, X @ y)
, assuming the code runs without error (and numerical instability)? y
X
X @ y
y @ X
A
is (3, 2), the shape of B
is (3, 3), and the shape of C
is (4, 3). What is the shape of A @ B @ C
? (3, 3)
(4, 2)
(2, 4)
x0
has two columns, and x = sklearn.preprocessing.PolynomialFeatures(2).fit_transform(x0)
is used as the design matrix, how many weights (include coefficients and biases or intercepts) will a linear regression estimate? df
has 10 columns and 5 rows. After applying p = PCA(3)
and p.fit(df)
, what is the shape of p.components_
? Note: the rows of p.components_
are the principal components. (3, 10)
(10, 3)
(3, 5)
(5, 3)
[[1], [2], [3], [4]]
and starting centroids [0]
and [7]
, what are the centroids after the first iteration of assigning points and updating centroids, using the iterative K-Means Clustering algorithm with Manhattan distance? [2, 4]
[1.5, 3.5]
[0, 7]
[1, 3]
dw
at [w1, w2, w3, w4]
= [-1, 1, 2, -2]
is [2, -2, -1, 1]
, if gradient descent w = w - alpha * dw
is used, which variable will increase by the largest amount in the next iteration? w2
w1
w3
w4
dxy = skimage.filters.sobel(img)
produces the dxy
matrix in the following table. To highlight the edge pixels in the original image in green, image[dxy > t] = [0, 255, 0]
is used, and 2 pixels are highlighted. Which value of t
is used? 0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
0 | 0.5 | 0.75 | 0 |
0 | 0 | 0 | 0 |
Count | Predict 0 | Predict 1 | Predict 2 |
Class 0 | 10 | 20 | 10 |
Class 1 | 0 | 10 | 0 |
Class 2 | 10 | 0 | 10 |
Network | Fold 1 accuracy | Fold 2 accuracy | Fold 3 accuracy |
W | 0.5 | 0.5 | 0.5 |
X | 0.6 | 0.8 | 1 |
Y | 0.7 | 0.8 | 0.9 |
Z | 0.8 | 0.8 | 0.8 |
[x1, x2]
to the linear program max x1 + 2 * x2
subject to x1 + x2 <= 1
and x1 >= 0
x2 >= 0
? [0, 1]
[1, 0]
[0, 0]
[1, 1]
max c @ x
subject to A @ x <= b
and x >= 0
has len(c)
= 5
, A.shape
= (3, 5)
, and len(b)
= 3
. What is the number of dual variables len(y)
? Note: the dual problem is min b @ y
subject to A' @ y >= c
and y >= 0
where '
means transpose. numpy.random.multivariate_normal([0, 0], [[1, c], [c, 4]], 1000)
. What is the value of c
? [0, 1, 2]
. What is the probability a sequence [0, 0, 2]
is observed (given it starts with 0
)? From \ To | 0 | 1 | 2 |
0 | 1 | 0 | 0 |
1 | 0 | 0.5 | 0.5 |
2 | 0.5 | 0 | 0.5 |
0
0.5
0.25
1
lr
, if lr.predict_proba(x)
for some item x
is [0.3, 0.5, 0.2]
, what is lr.predict(x)
for the same x
? 1
0
2
3
c1 = [[5], [4], [0]]
and c2 = [[2], [1]]
? Note: c1
is a cluster with 3 points and c2
is a cluster with 2 points. 4
3
2
1
u1 = [0, 0, 1]
, u2 = [1, 0, 0]
, u3 = [0, 1, 0]
, and the PCA (principal component analysis) features of an item x
is y = [-1, 0, 1]
, what is x
? [0, 1, -1]
[-1, 0, 1]
[1, 1, 1]
[1, 0, -1]
Last Updated: November 18, 2024 at 11:43 PM