Home / Past papers / MLP End Term / this paper











































































Use the confusion matrix given below. What is the recall score for the label (class) 1 ?











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 exam, followed by Mermaid knowledge graphs to visualize relationships.
Scaling/Normalization:
MinMaxScaler: Scales features to [0, 1] range.StandardScaler: Standardizes features to mean=0, variance=1.Encoding Categorical Data:
OneHotEncoder: Converts categorical features into binary columns.LabelEncoder: Converts categorical labels into numerical values (e.g., ["Yes", "No"] → [1, 0]).Polynomial Features:
PolynomialFeatures(degree=n): Generates polynomial/combination features (e.g., ).Pipeline & ColumnTransformer:
Pipeline: Sequentially applies transformations/estimators.ColumnTransformer: Applies different transformations to different columns.| Technique | Equation |
|---|---|
| Min-Max Scaling | |
| Standard Scaling | |
| Polynomial Features | (for original features, degree ) |
Dummy Regressor/Classifier:
strategy="median": Always predicts the median of y_train.strategy="most_frequent": Always predicts the most frequent class.K-Nearest Neighbors (KNN):
n_neighbors, p (for Minkowski), weights (uniform/distance).Naïve Bayes:
Support Vector Machines (SVM):
C (regularization), gamma (RBF kernel width).Decision Trees & Random Forest:
max_depth, min_samples_split, bootstrap, oob_score.Stochastic Gradient Descent (SGD):
learning_rate="adaptive", penalty="l2" (Ridge), early_stopping.log_loss (classification), squared_error (regression).Neural Networks (MLP):
adam, sgd, lbfgs.StandardScaler).Model Evaluation:
Confusion Matrix:
Overfitting Mitigation:
| Metric | Equation |
|---|---|
| Recall | |
| Precision | |
| F1-Score | |
| SGD Update Rule |
k folds to evaluate generalization.Common Hyperparameters:
C (SVM/Logistic Regression), alpha (Ridge/Lasso), n_estimators (Random Forest).Hierarchical Clustering:
K-Means:
k (number of clusters).k-means++).Principal Component Analysis (PCA):
n_components: Number of principal components to retain.Feature Union:
PolynomialFeatures + PCA).| Technique | Equation |
|---|---|
| PCA Variance | |
| Feature Union | Concatenates outputs of multiple transformers. |
DataFrame Slicing:
loc: Label-based indexing (inclusive of both start/end).iloc: Position-based indexing (exclusive of end).Handling Missing Data:
dropna(), fillna(), or ignore in OneHotEncoder (handle_unknown="ignore").Aggregation:
groupby(), apply(), sum(), mean().### loc vs iloc
df.loc[23:25, 'Marks':'History'] # Labels 23-25, columns 'Marks' to 'History'
df.iloc[2:4, 1:3] # Rows 2-3 (0-based), columns 1-2
Better Metrics:
class_weight in models (e.g., RandomForestClassifier).Resampling:
| Topic | Equation |
|---|---|
| Min-Max Scaling | |
| Standard Scaling | |
| Polynomial Features | (for features, degree ) |
| Recall | |
| Precision | |
| F1-Score | |
| SGD Update | |
| Ridge Regression (L2) | |
| PCA Variance |