Home / Past papers / MLP End Term / this paper
Consider the following common data and answer the subquestion:
Consider the following code snippet: Which of the following will be equivalent to the above code snippet?




What is the output of the following code snippet: Enter -1, if you think the above statement will generate an error.
What is the output of the following code snippet: Enter -1, if you think the above statement will generate an error.
What is the output of the following code snippet: Enter -1, if you think the above statement will generate an error.
What is the output of the following code snippet: Choose correct options from following:























































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, and equations for the Diploma Level: Machine Learning Practice (Computer-Based Exam), along with Mermaid knowledge graphs to visualize relationships.
DataFrame Operations:
df.loc[] (label-based), df.iloc[] (position-based).df.loc[23:24, 'Maths':'History'] ≡ df.iloc[2:4, 1:3] (Q2).df.dropna() reduces rows (Q6).df.Hindi.apply(type).nunique() counts unique types (e.g., int, float, str) (Q4).Chunked Reading:
pd.read_csv(..., chunksize=1024) for large files (Q12).Data Splitting:
train_test_split(test_size=30) for exact sample counts (Q25).ShuffleSplit for randomized splits (Q26).Cross-Validation:
KFold(n_splits=3) splits data into folds (Q9).cross_val_score evaluates models (Q26).Learning Curves:
sklearn.model_selection.learning_curve analyzes training/test errors vs. sample size (Q10).Hyperparameter Tuning:
GridSearchCV exhaustively searches parameter grids (Q16, Q21).param_grid = {'max_depth': [2, 3, 4]}.Linear Models:
SGDRegressor/Classifier:
loss='log_loss' (logistic regression), loss='hinge' (SVM), loss='perceptron' (Q30).penalty='l1', 'l2', or 'elasticnet' for regularization (Q17).partial_fit for online learning (Q34).Polynomial Features:
PolynomialFeatures(degree=2) in pipelines (Q16).Tree-Based Models:
Decision Trees:
max_depth, min_samples_split, min_samples_leaf (Q20, Q36).Random Forest/Bagging:
BaggingClassifier with DecisionTreeClassifier as base estimator (Q23).Naive Bayes:
Neural Networks:
MLPClassifier/MLPRegressor for multi-layer perceptrons (Q29, Q35).hidden_layer_sizes=(5,3) defines 2 hidden layers (5 and 3 neurons) (Q35).Clustering:
K-Means:
n_clusters = n_samples (Q38).n_clusters (Q24).Ensemble Methods:
Voting Classifier:
voting='soft' averages predicted probabilities (Q22).AdaBoost:
learning_rate controls weak learner contributions (Q19).Radius Neighbors:
k) (Q33).Imbalanced Data:
Regression:
mean_absolute_error, neg_mean_squared_error (Q26, Q37).Classification:
Cross-Validation:
cross_val_score(scoring='neg_r2') for regression (Q26).CountVectorizer:
vocabulary_ maps terms to indices (Q14).{'this': 4, 'is': 2, ...}.SVM:
Perceptron:
SGDClassifier(loss='perceptron') is its stochastic version (Q30).Logistic Regression:
SGDClassifier(loss='log_loss') (Q30).eta0 in SGDRegressor).Regularization (L1/L2):
Pandas:
loc vs. iloc: loc uses labels, iloc uses integer positions.dropna() affects rows by default (not columns unless axis=1).Scikit-Learn:
make_pipeline to chain transforms and estimators.SGDRegressor.partial_fit).voting='soft' averages probabilities; 'hard' uses majority vote.Math:
n_clusters = n_samples).learning_rate affects AdaBoost (shrinks contributions).Code Snippets:
KFold output, CountVectorizer vocabulary).Hyperparameters:
max_depth, n_neighbors, degree are hyperparameters (not intercept_).Good luck! Focus on practical coding patterns, math behind algorithms, and scikit-learn’s API.