Home / Past papers / MLP End Term / this paper
Consider following common data and answer the subquestions:
What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
Consider following parameter grid for regression with RandomForest: How many unique combinations of hyperparameters are there in the above parameter grid?

















































What will be the output of the following code?
What will be the output of the following 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 (Computer-Based Exam). The exam covers Pandas, Scikit-Learn, ML algorithms, hyperparameter tuning, evaluation metrics, and clustering. Key areas are grouped into theoretical concepts, practical coding skills, and mathematical foundations (where applicable).
DataFrame Operations:
df.shape, df.isna().sum(), df.dropna(), df.fillna().df.iloc[] (integer-location based indexing), df.loc[] (label-based indexing).df.value_counts() for categorical data.np.nan).Key Equations:
NaN):Linear Models:
alpha=0: No regularization.
SGDRegressor: Stochastic Gradient Descent for linear models.
max_iter: Number of epochs (default: 1000).class_weight='balanced': Adjusts weights inversely proportional to class frequencies.C: Inverse of regularization strength (smaller C = stronger regularization).Predict probabilities: predict_proba(X).
Kernel Trick: For non-linear decision boundaries.
Parameters:
max_depth: Limits tree depth to prevent overfitting.min_samples_split: Minimum samples required to split a node.min_samples_leaf: Minimum samples required at a leaf node.criterion: 'gini' (Gini impurity) or 'entropy' (information gain).Overfitting Risk: Deeper trees capture noise; shallower trees generalize better.
bootstrap=True).max_features controls randomness.Out-of-Bag (OOB) Error: Error estimated on unseen samples.
n_neighbors:
n_neighbors: Smoother decision boundaries.n_neighbors: Complex boundaries (risk of overfitting).Feature Scaling: Critical (distance-based).
K-Means Clustering:
'random' or 'k-means++'.Limitations:
Bagging (Bootstrap Aggregating):
Boosting:
Voting Classifier:
Metrics:
Classification:
Regression:
Cross-Validation:
k folds; trains on k-1 folds, tests on 1.n models for n samples.Dummy Classifier:
strategy='most_frequent').Feature Scaling:
Handling Missing Data:
KNNImputer, SimpleImputer.df.dropna().Feature Extraction:
PolynomialFeatures: Generates polynomial/combination features.
include_bias: Adds intercept term.Grid Search:
Example:
param_grid = {'n_estimators': [10, 20, 30], 'max_features': [2, 3, 4]}3 * 3 = 9).alpha in Ridge/Lasso).train_test_split(test_size=0.3, random_state=42).| Concept | Equation |
|---|---|
| Linear Regression | |
| Ridge Regression | |
| Lasso Regression | |
| Logistic Regression | |
| Precision | |
| Recall | |
| F1-Score | |
| R² Score | |
| Inertia (K-Means) | |
| Gini Impurity | |
| Entropy | |
| Euclidean Distance |
Pandas:
df.shape[0]*df.shape[1] - df.isna().sum().sum()).value_counts() for categorical data.Scikit-Learn:
model.fit(X_train, y_train), model.predict(X_test).Algorithms:
max_depth controls overfitting.n_estimators = number of trees.n_neighbors affects boundaries.Evaluation:
n models for n samples.Clustering:
Hyperparameters:
alpha controls regularization strength.max_iter = epochs.