Home / Past papers / MLP End Term / this paper

What will be the output of the following block of code? 



What is the output of the following block of code? 



What is the output of the following code snippet?
Which of the options will be the correct output for the following code snippet? 



Which of the options will be the correct output for the following code snippet? 



Which of the following options is correct explained variance score for the following code snippet applying PCA technique.
Which of the following options is the correct output of the following block of code? 







Which of the following options represent the correct output of the following block of code? 




Which of the following options is the possible output for the following block of code?
What operation does the following code implement?
Which of the following options represent the recall value for the class 2 in the confusion matrix shown in Figure 1 if y_true = [0, 1, 2, 2, 2], y_pred = [0, 0, 2, 2, 1] ?
Consider the following code block and mark the correct output.
Consider X and y as the training dataset. What will be the output of the following code?
Consider the following block of code and mark all possible correct options.
What will be the output of the following code block: 



Which of the following options represent the output of the following block of code? 



Which of the following statements will be true based on the following diagram?
Which of the following options is the correct output of the following block of code?
Which of the following is likely to be the correct output of the code given below?
For the following block of code, we get the output as 0.9875. How would the output change if we decrease max depth value ?:
Consider the following block of code and mark the correct option.
Consider the following code snippet. What value should we fill at the blank place, so that given code block creates graph as shown below:
Calculate the coefficient of determination (R2) [up to 1 decimal point] based on the following block of code.
In the given block of code, the Iris dataset having shape (150,4) has been loaded for model training. What do you think will be the output of the code given below?
Code snippet written below plots a graph for some dataset X as shown below. In the given dendrogram which sample is most similar to the sample having label as 1 ?

What will be the output of the following code?
What will be the output of the following code? 
Which of the following is likely to be the correct output:
Which of the following is/are true about the following block of the code? 



Auto-generated summary from the source site. Handy as a checklist; the lessons above explain each idea from scratch.
Here’s a structured summary of core topics, concepts, principles, and equations essential for the Diploma Level: Machine Learning Practice exam, along with Mermaid knowledge graphs to visualize relationships.
Datasets in sklearn.datasets:
Loaders vs. Fetchers:
Bunch object (dictionary-like with keys like data, target, feature_names).load_iris(), load_wine()).fetch_california_housing()).Synthetic Datasets:
make_blobs(), make_classification(), make_regression().Dataset Attributes:
data.shape (not data.shape()), target, feature_names, DESCR.Bunch Object:
data, target, target_names, feature_names, DESCR.from sklearn.datasets import load_wine
data = load_wine()
print(data.data.shape) # Correct (no parentheses)
Scaling:
StandardScaler: Standardizes features (mean=0, std=1).
scaler.fit(X) computes mean/std.scaler.transform(X) applies scaling.scaler.mean_ gives the mean of features.Polynomial Features:
PolynomialFeatures(degree=2, interaction_only=True) generates:
interaction_only=True).[x1, x2] → [1, x1, x2, x1*x2].Dummy Features:
add_dummy_feature(X) adds a column of 1s (bias term) at the start.Encoding:
MultiLabelBinarizer: Converts multi-label data to binary matrix.
[(1,2), (3,)] → [[1,1,0], [0,0,1]].where = mean, = standard deviation.
Linear Models:
logistic or softmax for output).shuffle=True to shuffle data every epoch.Cross-Validation:
train_test_split(X, y, test_size=0.2, random_state=42).Metrics:
Explained Variance (PCA):
pca.explained_variance_ratio_ gives the proportion of variance explained by each component.ROC Curve:
from sklearn.metrics import confusion_matrix
y_true = [0, 1, 2, 2, 2]
y_pred = [0, 0, 2, 2, 1]
cm = confusion_matrix(y_true, y_pred, labels=[0, 1, 2])
### Recall for class 2 = TP/(TP+FN) = 2/(2+1) = 0.67
PCA (Principal Component Analysis):
PCA(n_components=2).fit(X) computes components.explained_variance_ratio_ gives variance explained by each component.where = eigenvectors of covariance matrix.
K-Means:
KMeans(n_clusters=3).fit(X) assigns clusters.inertia_ (WCSS) vs. number of clusters to find optimal .scipy.cluster.hierarchy).MLPClassifier/MLPRegressor:
hidden_layer_sizes=(10,5): 2 hidden layers (10 and 5 neurons).n_layers_: Total layers (input + hidden + output).coefs_: List of weight matrices (shape [n_layers-1]).Activation Functions:
logistic (binary) or softmax (multi-class).relu, tanh, etc.from sklearn.neural_network import MLPClassifier
mlp = MLPClassifier(hidden_layer_sizes=(8,12), random_state=12)
mlp.fit(X, y)
print(mlp.n_layers_) # 4 (input + 2 hidden + output)
VotingClassifier:
voting='hard': Majority vote.voting='soft': Predicts class with highest average probability.flatten_transform=True: Flattens output for transform.BaggingClassifier:
SVC) with bootstrapping.Scikit-Learn API Design Principles:
fit, predict, transform).random_state for reproducibility).coef_, feature_importances_.| Concept | Equation |
|---|---|
| StandardScaler | |
| MaxAbsScaler | |
| R² Score | |
| Recall | |
| Precision | |
| PCA Transformation | (where = eigenvectors) |
| Polynomial Features (deg=2) | (if interaction_only=False) |
Code Outputs: Focus on:
PolynomialFeatures).StandardScaler.mean_).coef_, n_features_in_).Equations: Memorize:
fit/predict pattern).Visualizations: