Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Question 1 of 60 · Introduction to machine learning and PySpark · Easy
What is machine learning primarily used for?
Not quite. Try another option.
Answer: Learning patterns from data
Machine learning enables computers to learn patterns from data and use them to make predictions or decisions.
Question 2 of 60 · Introduction to machine learning and PySpark · Easy
What is PySpark?
Not quite. Try another option.
Answer: A Python API for Apache Spark
PySpark provides a Python interface for using Apache Spark's distributed data-processing features.
Question 3 of 60 · Techniques of machine learning · Easy
Which machine learning technique uses labeled training data?
Not quite. Try another option.
Answer: Supervised learning
Supervised learning trains a model using examples that contain both input features and known labels.
Question 4 of 60 · Techniques of machine learning · Easy
Which technique finds groups or patterns in data without known labels?
Not quite. Try another option.
Answer: Unsupervised learning
Unsupervised learning discovers structures, such as clusters, in unlabeled data.
Question 5 of 60 · Introduction to Spark MLlib · Easy
What is the main purpose of Spark MLlib?
Not quite. Try another option.
Answer: Providing scalable machine learning tools
Spark MLlib is Apache Spark's library for scalable machine learning.
Question 6 of 60 · Key concepts of Spark ML · Easy
In Spark ML, what does an Estimator produce when its fit() method is called?
Not quite. Try another option.
Answer: A fitted Model
An Estimator learns from a DataFrame through fit() and produces a fitted Model.
Question 7 of 60 · Key concepts of Spark ML · Easy
What is a Spark ML Pipeline used for?
Not quite. Try another option.
Answer: Combining multiple ML stages
A Pipeline organizes multiple processing and modeling stages into one machine learning workflow.
Question 8 of 60 · Spark ML algorithms using PySpark · Easy
Which PySpark package commonly contains classification and regression algorithms?
Not quite. Try another option.
Answer: pyspark.ml
The pyspark.ml package provides DataFrame-based machine learning algorithms and utilities.
Question 9 of 60 · Linear regression · Easy
What type of value does linear regression usually predict?
Not quite. Try another option.
Answer: A continuous numeric value
Linear regression predicts continuous values, such as price, temperature, or sales.
Question 10 of 60 · Logistic regression · Easy
Logistic regression is commonly used for which task?
Not quite. Try another option.
Answer: Classification
Logistic regression is a classification algorithm, often used for binary outcomes such as yes or no.
Question 11 of 60 · Decision tree · Easy
How does a decision tree generally make a prediction?
Not quite. Try another option.
Answer: By following feature-based branches
A decision tree applies feature-based conditions and follows branches until it reaches a prediction.
Question 12 of 60 · K-means · Easy
What does the value represent in K-means clustering?
Not quite. Try another option.
Answer: The number of clusters
In K-means, specifies how many clusters the algorithm should create.
Question 13 of 60 · SVM · Easy
What is the main goal of a Support Vector Machine classifier?
Not quite. Try another option.
Answer: Finding a separating hyperplane
An SVM finds a hyperplane that separates classes, usually while maximizing the margin between them.
Question 14 of 60 · Naive Bayes · Easy
Naive Bayes is based on which mathematical idea?
Not quite. Try another option.
Answer: Bayes' theorem
Naive Bayes applies Bayes' theorem and makes a simplifying assumption about feature independence.
Question 15 of 60 · Evaluation and performance matrix · Easy
Why is a test dataset used when evaluating a machine learning model?
Not quite. Try another option.
Answer: To measure performance on unseen data
A test dataset estimates how well the trained model performs on data it did not learn from.
Question 16 of 60 · Confusion matrix · Easy
In a confusion matrix, what is a true positive?
Not quite. Try another option.
Answer: A positive case predicted as positive
A true positive occurs when the actual class is positive and the model correctly predicts positive.
Question 17 of 60 · R2 · Easy
What does the metric indicate in regression?
Not quite. Try another option.
Answer: The proportion of variance explained
measures how much of the variation in the target variable is explained by the regression model.
Question 18 of 60 · RMSE · Easy
What does RMSE stand for?
Not quite. Try another option.
Answer: Root Mean Squared Error
RMSE is the square root of the average squared prediction error: .
Question 19 of 60 · MAE · Easy
What does MAE measure?
Not quite. Try another option.
Answer: The average absolute prediction error
MAE averages the absolute differences between actual and predicted values: .
Question 20 of 60 · Correlation heat map · Easy
What does a correlation heat map usually display?
Not quite. Try another option.
Answer: Relationships between numeric variables
A correlation heat map uses colors to show the strength and direction of relationships between numeric variables.
Question 21 of 60 · Introduction to machine learning and PySpark · Medium
A PySpark pipeline must train a model on a dataset that is too large for a single machine. Which capability of Spark is most relevant to this task?
Not quite. Try another option.
Answer: Distributed processing across cluster nodes
Spark distributes data and computation across multiple nodes, allowing machine learning workflows to process datasets larger than a single machine can handle.
Question 22 of 60 · Techniques of machine learning · Medium
A company has customer records without labels and wants to group customers according to purchasing behavior. Which machine learning technique is most appropriate?
Not quite. Try another option.
Answer: Unsupervised clustering
Clustering is an unsupervised technique used to discover groups in data when target labels are unavailable.
Question 23 of 60 · Introduction to Spark MLlib · Medium
Which statement best describes the purpose of Spark MLlib?
Not quite. Try another option.
Answer: It provides distributed machine learning algorithms
MLlib is Spark's machine learning library, offering scalable algorithms, feature processing tools, and evaluation utilities.
Question 24 of 60 · Key concepts of Spark ML · Medium
In Spark ML, what is the main purpose of a Pipeline?
Not quite. Try another option.
Answer: To chain transformers and estimators
A Pipeline organizes a sequence of data transformations and model-training steps into one reproducible workflow.
Question 25 of 60 · Key concepts of Spark ML · Medium
A Spark ML model expects all predictor values in one column of vector type. Which component is commonly used to create this column from several feature columns?
Not quite. Try another option.
Answer: VectorAssembler
VectorAssembler combines multiple input columns into a single vector column, which is the standard feature format for Spark ML algorithms.
Question 26 of 60 · Spark ML algorithms using PySpark · Medium
A PySpark workflow uses StringIndexer on a categorical column before training a classifier. What problem does this step primarily address?
Not quite. Try another option.
Answer: It converts categorical values into numeric indices
StringIndexer assigns numerical indices to distinct string labels so that Spark ML algorithms can process categorical data.
Question 27 of 60 · Linear regression · Medium
A linear regression model predicts house prices using area and number of rooms. If the coefficient for area is positive, what does it indicate when other features remain fixed?
Not quite. Try another option.
Answer: Price tends to increase with area
A positive coefficient means that increasing the corresponding feature is associated with an increase in the predicted target, assuming other features are unchanged.
Question 28 of 60 · Linear regression · Medium
A regression model has an RMSE of when predicting monthly sales. What is the most appropriate interpretation?
Not quite. Try another option.
Answer: Typical prediction error is about sales units
RMSE is expressed in the same units as the target and summarizes the typical magnitude of prediction errors, with larger errors receiving greater weight.
Question 29 of 60 · Logistic regression · Medium
A logistic regression model returns a probability of for the positive class. Using a threshold of , what class will normally be predicted?
Not quite. Try another option.
Answer: The positive class
With a threshold of , probabilities at least are generally assigned to the positive class.
Question 30 of 60 · Logistic regression · Medium
A binary classifier produces many false negatives in a medical screening task. Which change may improve detection of positive cases?
Not quite. Try another option.
Answer: Lower the classification threshold
Lowering the threshold makes the classifier more likely to predict the positive class, which can reduce false negatives while potentially increasing false positives.
Question 31 of 60 · Decision tree · Medium
A decision tree classifies loan applications by repeatedly splitting records according to feature values. What is the main benefit of selecting a split with high information gain?
Not quite. Try another option.
Answer: It creates purer child nodes
Information gain measures the reduction in impurity after a split. A high value generally produces child nodes with more consistent class labels.
Question 32 of 60 · K-means · Medium
In K-means clustering, a data point is reassigned during an iteration when:
Not quite. Try another option.
Answer: Another centroid becomes closer
K-means assigns each point to the nearest centroid, then updates centroid positions based on the assigned points.
Question 33 of 60 · K-means · Medium
A K-means model is trained with . What does the value represent?
Not quite. Try another option.
Answer: The number of requested clusters
The K-means parameter specifies how many clusters the algorithm should form.
Question 34 of 60 · SVM · Medium
What objective is central to a linear Support Vector Machine classifier?
Not quite. Try another option.
Answer: Finding a boundary with a large margin
An SVM seeks a separating hyperplane that maximizes the margin between classes, while allowing controlled classification errors when necessary.
Question 35 of 60 · Naive Bayes · Medium
The Naive Bayes classifier is called naive because it assumes that features are:
Not quite. Try another option.
Answer: Conditionally independent given the class
Naive Bayes simplifies probability estimation by assuming that features are conditionally independent once the class label is known.
Question 36 of 60 · Evaluation and performance matrix · Medium
A model achieves accuracy on a dataset where of records belong to one class. Why might accuracy be misleading?
Not quite. Try another option.
Answer: A majority-class predictor can achieve similar accuracy
With imbalanced classes, predicting the majority class for every record may produce high accuracy while failing to identify minority-class examples.
Question 37 of 60 · Confusion matrix · Medium
A fraud detection model labels a legitimate transaction as fraudulent. Which confusion matrix category describes this result?
Not quite. Try another option.
Answer: False positive
The prediction is positive, but the actual class is negative, so it is a false positive.
Question 38 of 60 · R2 · Medium
A regression model has . Which interpretation is most appropriate?
Not quite. Try another option.
Answer: The model explains about of target variance
measures the proportion of variation in the target explained by the regression model relative to a baseline based on the target mean.
Question 39 of 60 · MAE · Medium
Two regression models have MAE values of and on the same test set. Which model has better average absolute performance?
Not quite. Try another option.
Answer: The model with MAE
MAE is the average absolute difference between predictions and actual values. Lower MAE indicates smaller average errors.
Question 40 of 60 · Correlation heat map · Medium
A correlation heat map shows a correlation of between two predictor variables. What concern should be investigated before fitting a linear model?
Not quite. Try another option.
Answer: Possible multicollinearity between predictors
A strong correlation between predictors may indicate multicollinearity, which can make coefficient estimates unstable and harder to interpret.
Question 41 of 60 · Introduction to machine learning and PySpark · Hard
A PySpark classification workflow imputes missing values, standardizes features, and tunes a logistic regression model with CrossValidator. Which design best prevents information leakage while estimating generalization performance?
Not quite. Try another option.
Answer: Place preprocessing and classification in one pipeline and cross-validate the pipeline
Cross-validating the complete pipeline fits every preprocessing stage only on each training fold. Fitting preprocessing before fold creation allows validation-fold statistics to influence training.
Question 42 of 60 · Techniques of machine learning · Hard
A binary dataset contains 0.2% positive examples. A classifier that always predicts the negative class obtains 99.8% accuracy. Which evaluation strategy is most appropriate when missing a positive is costly?
Not quite. Try another option.
Answer: Optimize recall subject to an acceptable precision using stratified validation data
Severe imbalance makes accuracy misleading. When false negatives are costly, recall is central, while a precision constraint prevents an unusably large number of false positives.
Question 43 of 60 · Introduction to Spark MLlib · Hard
A legacy application uses pyspark.mllib models on RDDs, while a new workflow requires pipelines, parameter grids, and DataFrame-based feature transformers. Which migration decision is technically sound?
Not quite. Try another option.
Answer: Use pyspark.ml because its DataFrame API supports estimators, transformers, and pipelines
pyspark.ml is the primary DataFrame-based API and provides pipeline-compatible estimators, transformers, evaluators, and tuning tools. Legacy RDD models do not directly implement those pipeline stage contracts.
Question 44 of 60 · Key concepts of Spark ML · Hard
Consider pipeline = Pipeline(stages=[assembler, scaler, lr]), where scaler and lr are estimators. After calling model = pipeline.fit(train), which statement is correct?
Not quite. Try another option.
Answer: model contains fitted transformer stages and can transform new DataFrames
Fitting a pipeline converts estimator stages into fitted models, which are transformers. The resulting PipelineModel applies the learned transformations to compatible new DataFrames.
Question 45 of 60 · Spark ML algorithms using PySpark · Hard
A parameter grid compares logistic regression models using CrossValidator, and the final model must be refitted on all training data using the best parameters. What does Spark's CrossValidator.fit(train) return?
Not quite. Try another option.
Answer: A CrossValidatorModel containing a best model refitted on the full input dataset
Spark evaluates parameter maps across folds, selects the best map according to the evaluator, and fits the selected estimator configuration on the entire input dataset.
Question 46 of 60 · Linear regression · Hard
Two predictors are nearly perfectly collinear, and an unregularized Spark linear regression model produces unstable coefficients across samples. Which parameter change most directly stabilizes the solution while generally retaining both predictors?
Not quite. Try another option.
Answer: Set regParam above zero and set elasticNetParam to zero
A positive regParam with elasticNetParam=0 applies ridge regularization. Ridge stabilizes coefficients under multicollinearity and typically shrinks correlated predictors without forcing one to zero.
Question 47 of 60 · Linear regression · Hard
For labels and predictions , what are the RMSE and values, respectively?
Not quite. Try another option.
Answer: and
The squared-error sum is , so . The label mean is and , giving .
Question 48 of 60 · Logistic regression · Hard
A fitted binary logistic regression model outputs calibrated positive-class probabilities. The false-negative cost is four times the false-positive cost, and both classes have equal prior importance. Under minimum expected cost, at what probability should the model predict the positive class?
Not quite. Try another option.
Answer:
Predict positive when . With , this becomes , so the threshold is .
Question 49 of 60 · Logistic regression · Hard
A multinomial logistic regression model uses three classes and a feature vector of size five, with intercepts enabled. Ignoring Spark's internal reference-category representation choices, how many class-specific coefficient and intercept values conceptually define the softmax scores before accounting for non-identifiability?
Not quite. Try another option.
Answer:
Each of the three classes has five feature coefficients and one intercept, giving conceptual values. Softmax probabilities remain unchanged under certain common shifts, which creates non-identifiability.
Question 50 of 60 · Decision tree · Hard
A categorical feature has 40 distinct categories, but a Spark decision tree is configured with maxBins=32. What is the most appropriate correction?
Not quite. Try another option.
Answer: Increase maxBins to at least 40 so the categorical feature can be represented
For a categorical feature, maxBins must be at least the feature's cardinality. Tree depth and node-size settings do not remove this representation constraint.
Question 51 of 60 · Decision tree · Hard
A decision tree has nearly zero training error but poor validation performance. Increasing maxDepth worsens the gap. Which change most directly regularizes the tree structure?
Not quite. Try another option.
Answer: Decrease maxDepth and increase minInstancesPerNode
A shallower tree with more observations required per node limits highly specific splits. This reduces variance and directly addresses structural overfitting.
Question 52 of 60 · K-means · Hard
A K-means dataset contains annual income measured in dollars and age measured in years. Income has variance several orders of magnitude larger than age. What is the likely effect of fitting without scaling?
Not quite. Try another option.
Answer: Income will dominate Euclidean distances and therefore dominate cluster assignments
Standard K-means minimizes within-cluster squared Euclidean distance and does not automatically standardize features. A large-scale feature can therefore dominate the objective.
Question 53 of 60 · K-means · Hard
A K-means run reports a lower training cost for than for , but a substantially lower validation silhouette score for . Which conclusion is best supported?
Not quite. Try another option.
Answer: The extra centroids reduce within-cluster error but produce less separated validation clusters
K-means training cost generally decreases as more centroids are added. A lower validation silhouette indicates that the resulting clusters are less cohesive or less separated despite the lower training objective.
Question 54 of 60 · SVM · Hard
A team attempts to train Spark LinearSVC directly on labels . Which modification is required?
Not quite. Try another option.
Answer: Construct one-vs-rest binary classifiers because LinearSVC is binary
Spark's LinearSVC handles binary classification. Multiclass SVM behavior can be constructed with a strategy such as one-vs-rest using separate binary models.
Question 55 of 60 · SVM · Hard
For a linear SVM, a training point satisfies . What is its hinge loss , and where is the point relative to the margin?
Not quite. Try another option.
Answer: , correctly classified but inside the margin
The signed score is positive, so the point is correctly classified. Because it is below , it lies inside the margin and has hinge loss .
Question 56 of 60 · Naive Bayes · Hard
A Bernoulli Naive Bayes model is trained on document features that contain term frequencies such as , , and . Which preprocessing best matches the model's likelihood assumptions?
Not quite. Try another option.
Answer: Binarize each feature to indicate whether the corresponding term is present
Bernoulli Naive Bayes models binary feature occurrence. Counts should be converted to presence indicators, whereas centering or standardization can also introduce invalid negative values.
Question 57 of 60 · Evaluation and performance matrix · Hard
A three-class classifier performs well on a dominant class but poorly on two rare classes. Which metric is most sensitive to the rare-class failures while assigning each class equal importance?
Not quite. Try another option.
Answer: Macro-averaged recall
Macro recall computes recall separately for each class and averages the values equally. Weighted and micro metrics are more strongly influenced by the dominant class.
Question 58 of 60 · Confusion matrix · Hard
A classifier produces , , , and . If the threshold is changed so that 20 false positives become true negatives while 10 true positives become false negatives, what are the new precision and recall?
Not quite. Try another option.
Answer: and
The new counts are , , , and . Thus precision is , and recall is .
Question 59 of 60 · R2 · Hard
A regression model evaluated on unseen data has . Which interpretation is correct?
Not quite. Try another option.
Answer: Its squared-error sum is 35% larger than the mean-prediction baseline's squared-error sum
Since , implies . The model is worse than predicting the evaluation-set mean under squared error.
Question 60 of 60 · RMSE · Hard
Two regression models are evaluated on the same four cases. Model A has absolute errors , while Model B has absolute errors . Which comparison is correct?
Not quite. Try another option.
Answer: Model A has lower MAE but higher RMSE than Model B
Model A has and , while Model B has both and . RMSE penalizes Model A's large outlier more strongly.
That's unit 6
Answer a few questions and your score shows up here.
Nearly through. Did unit 6 of INT315 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 6 of INT315 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.