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, principles, and equations essential for the Diploma Level: Machine Learning Practice (Computer-Based Exam), along with Mermaid knowledge graphs to visualize relationships.
Key Concepts:
loc (label-based), iloc (position-based).dropna(), fillna().dtypes, apply(type).Equations/Code Snippets:
df.loc[23:24, 'Maths':'History'] # Label-based selection
df.iloc[2:4, 1:3] # Position-based selection
df.dropna() # Remove rows with NaN
df['Hindi'].apply(type).nunique() # Count unique data typesKey Concepts:
MinMaxScaler, StandardScaler.Handling Imbalanced Data:
pd.get_dummies), label encoding.CountVectorizer, TfidfVectorizer.When Preprocessing is Needed:
NaN).Key Concepts:
train_test_split(test_size=0.2, random_state=42).KFold, StratifiedKFold, cross_val_score.Metrics:
r2, neg_mean_squared_error, mean_absolute_error.accuracy, precision, recall, f1.Equations:
Key Concepts:
GridSearchCV.RandomizedSearchCV.learning_curve (plots training/test error vs. sample size).Example:
param_grid = {'max_depth': [2, 3, 4], 'min_samples_split': [2, 3]}
grid_search = GridSearchCV(DecisionTreeClassifier(), param_grid, cv=5)Supervised Learning:
Linear Models:
SGDRegressor (supports l1, l2 penalties).LogisticRegression (for classification).Tree-Based:
DecisionTreeClassifier (prone to high variance, low bias).RandomForestClassifier (ensemble of trees).SVM:
Naive Bayes:
GaussianNB supports partial_fit.Neural Networks:
MLPClassifier/MLPRegressor (hidden layers, activation functions).Unsupervised Learning:
K-Means:
n_clusters.Ensemble Methods:
BaggingClassifier (reduces variance).AdaBoost (learning rate shrinks contributor weights).VotingClassifier (voting='soft' averages probabilities).Key Concepts:
pd.read_csv(chunksize=1024).partial_fit (for SGDClassifier, GaussianNB).fetch_openml() to load datasets.Decision Trees:
max_depth: Controls tree depth (higher → risk of overfitting).min_samples_split: Minimum samples to split a node.K-Nearest Neighbors (KNN):
RadiusNeighborsClassifier: Uses all neighbors in radius.SVM:
Neural Networks:
hidden_layer_sizes=(5, 3): 2 hidden layers (5 neurons → 3 neurons).Techniques:
Regression:
neg_mean_squared_error, r2.Classification:
accuracy, precision, recall, f1.Pipelines: Chain preprocessing and modeling.
Pipeline([('scaler', MinMaxScaler()), ('sgd', SGDRegressor())])learning_curve to diagnose bias/variance.where is the set of centroids.
where is the learning rate, and is the loss function.
where is the weight of the weak learner .
Pandas:
loc/iloc and handling NaN values.apply and dtypes work.Model Selection:
cross_val_score for robust evaluation.neg_mean_squared_error or r2.Hyperparameter Tuning:
GridSearchCV is exhaustive; RandomizedSearchCV is faster.learning_curve to diagnose underfitting/overfitting.Algorithms:
max_depth to avoid overfitting.Imbalanced Data:
Neural Networks:
hidden_layer_sizes=(5, 3) means 2 layers (5 neurons → 3 neurons).Clustering:
n_clusters = n_samples.