1. Home
  2. Explore
  3. Computer Science
  4. Linear Regression with Scikit-Learn

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Linear Regression with Scikit-Learn

  • 114Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: ML Foundations
A machine learning problem that predicts a continuous numerical value, such as medical expenses or house prices, is called a
problem.

114 questions

  1. 1
    A machine learning problem that predicts a continuous numerical value, such as medical expenses or house prices, is called a
    _____
    problem.
    Hint

    Contrast continuous quantities with discrete categories.

    Answer

    regression

  2. 2
    A machine learning problem in which each input is assigned to a discrete category or label is called a
    _____
    problem.
    Hint

    Examples include rain versus no rain and benign versus malignant.

    Answer

    classification

  3. 3
    Machine learning that uses labeled examples containing known target values is called
    _____
    learning.
    Hint

    The model receives the correct answers during training.

    Answer

    supervised

  4. 4
    Machine learning that discovers structure or groups in data without target labels is called
    _____
    learning.
    Hint

    Clustering is a common example.

    Answer

    unsupervised

  5. 5
    In a typical machine learning workflow, the assumed relationship between input features and targets is represented by the
    _____
    .
    Hint

    It has a structure and learned parameters.

    Answer

    model

  6. 6
    The values that a machine learning algorithm learns or estimates inside a model are called model
    _____
    .
    Hint

    In linear regression, these include weights and a bias.

    Answer

    parameters

  7. 7
    Values selected before training, such as maximum tree depth or learning rate, are called
    _____
    parameters.
    Hint

    They are set by the practitioner rather than learned directly by the model.

    Answer

    hyper

  8. 8
    The numerical function used during training to measure how badly predictions differ from targets is called a
    _____
    function.
    Hint

    The optimizer attempts to minimize it.

    Answer

    loss

  9. 9
    In linear regression, the relationship between an input xxx and a target yyy is commonly written as y=wx+by = wx + by=wx+b, where www is the
    _____
    .
    Hint

    It controls the rate at which the target changes with the input.

    Answer

    slope

  10. 10
    In the equation y=wx+by = wx + by=wx+b, the value bbb is the
    _____
    because it is the value of yyy when x=0x = 0x=0.
    Hint

    It is where the line crosses the yyy axis.

    Answer

    intercept

  11. 11
    In machine learning terminology, the slope of a linear model is often called a
    _____
    .
    Hint

    It multiplies an input feature.

    Answer

    weight

  12. 12
    In machine learning terminology, the intercept of a linear model is often called a
    _____
    .
    Hint

    It is added after the weighted inputs.

    Answer

    bias

  13. 13
    In a medical expense model, the age and BMI values supplied to the model are called the
    _____
    .
    Hint

    They are the information provided to generate a prediction.

    Answer

    inputs

  14. 14
    In the same medical expense model, the actual charges that the model tries to predict are called the
    _____
    .
    Hint

    They are the known desired outputs in the training data.

    Answer

    targets

  15. 15
    A linear regression model with several features predicts a target using a weighted
    _____
    of those features.
    Hint

    Each feature is multiplied by a weight and the results are added.

    Answer

    sum

  16. 16
    The Scikit Learn class commonly used to fit a linear relationship between features and a continuous target is
    _____
    .
    Hint

    Its name combines the type of relationship with the task.

    Answer

    LinearRegression

  17. 17
    The optimization method used by Scikit Learn's LinearRegression class is generally the
    _____
    least squares method.
    Hint

    It directly computes the best coefficients using matrix operations.

    Answer

    ordinary

  18. 18
    Adding a second numeric feature to linear regression changes a fitted line into a two feature geometric
    _____
    .
    Hint

    The model still has a linear relationship but now uses an additional dimension.

    Answer

    plane

  19. 19
    The difference between an actual target and its model prediction is called a
    _____
    .
    Hint

    It measures how far a data point is from the fitted prediction.

    Answer

    residual

  20. 20
    RMSE stands for
    _____
    mean squared error.
    Hint

    The metric takes a square root after averaging squared errors.

    Answer

    root

  21. 21
    RMSE squares residuals so that positive and negative errors do not
    _____
    each other out.
    Hint

    Without squaring, errors with opposite signs could sum to zero.

    Answer

    cancel

  22. 22
    RMSE is expressed in the same units as the target because the final square root changes squared dollars back into
    _____
    .
    Hint

    The metric is easier to interpret when it uses the target's original units.

    Answer

    dollars

  23. 23
    Compared with RMSE, mean absolute error gives less influence to extreme
    _____
    .
    Hint

    It uses absolute values rather than squared errors.

    Answer

    outliers

  24. 24
    A model with a lower loss is generally considered
    _____
    than a model with a higher loss.
    Hint

    Loss measures how much information the model fails to capture.

    Answer

    better

  25. 25
    The strategy of repeatedly taking a small step in the direction that reduces the loss is called gradient
    _____
    .
    Hint

    Imagine moving downhill while checking which direction goes lower.

    Answer

    descent

  26. 26
    Ordinary least squares is usually efficient for small datasets but can become inefficient and memory intensive for
    _____
    datasets.
    Hint

    Think of datasets with millions of rows.

    Answer

    larger

  27. 27
    Stochastic gradient descent is especially useful for training models on
    _____
    datasets.
    Hint

    It updates parameters iteratively rather than solving everything directly.

    Answer

    larger

  28. 28
    A correlation coefficient describes the strength and
    _____
    of the relationship between two variables.
    Hint

    The sign indicates increasing or decreasing association.

    Answer

    direction

  29. 29
    A correlation coefficient can range from
    _____
    one to one.
    Hint

    The lower endpoint represents perfect negative correlation.

    Answer

    minus

  30. 30
    A correlation coefficient of one represents a perfectly
    _____
    linear relationship.
    Hint

    Both variables increase together in a completely consistent way.

    Answer

    positive

  31. 31
    A correlation coefficient close to minus one represents a perfectly
    _____
    linear relationship.
    Hint

    As one variable increases, the other decreases consistently.

    Answer

    negative

  32. 32
    A correlation coefficient close to zero indicates practically no linear
    _____
    .
    Hint

    The variables do not show a clear increasing or decreasing trend.

    Answer

    correlation

  33. 33
    The pandas method used to compute correlations between numeric series is
    _____
    .
    Hint

    It is a short method name applied to a Series or DataFrame.

    Answer

    corr

  34. 34
    To compute a correlation involving a categorical feature such as smoker, the categories must first be converted into
    _____
    values.
    Hint

    Correlation calculations require numbers.

    Answer

    numeric

  35. 35
    A high correlation between two variables does not prove a cause and
    _____
    relationship.
    Hint

    Correlation does not establish which variable causes the other.

    Answer

    effect

  36. 36
    A variable that independently causes two correlated variables is often called a
    _____
    variable.
    Hint

    It can create an apparent relationship between two other variables.

    Answer

    confounding

  37. 37
    In logistic regression, the weighted sum of input features is passed through the
    _____
    function.
    Hint

    This function squashes values into the interval from zero to one.

    Answer

    sigmoid

  38. 38
    The output of the sigmoid function is interpreted as the
    _____
    of the positive class.
    Hint

    For rain prediction, it can represent the chance of rain tomorrow.

    Answer

    probability

  39. 39
    The loss function commonly used for logistic regression is called
    _____
    entropy loss.
    Hint

    It penalizes incorrect predicted probabilities.

    Answer

    cross

  40. 40
    Logistic regression is primarily a
    _____
    algorithm, despite its name.
    Hint

    It is used to predict categories such as yes or no.

    Answer

    classification

  41. 41
    A classification problem with two possible classes, such as rain or no rain, is called
    _____
    classification.
    Hint

    The prefix refers to two outcomes.

    Answer

    binary

  42. 42
    A classification problem with more than two possible classes, such as handwritten digits, is called
    _____
    classification.
    Hint

    The model chooses among many categories.

    Answer

    multi-class

  43. 43
    The Australian weather task predicts whether it will rain tomorrow using weather data from
    _____
    .
    Hint

    The input consists of current weather observations.

    Answer

    today

  44. 44
    The prediction of whether rain will occur tomorrow is a classification problem because the output is a discrete
    _____
    .
    Hint

    The alternatives are yes and no.

    Answer

    class

  45. 45
    The training set is used to
    _____
    the model's parameters.
    Hint

    Predictions are compared with known targets during this stage.

    Answer

    train

  46. 46
    A validation set is used to evaluate model variations while tuning models, but it should not be used to
    _____
    the model directly.
    Hint

    It helps compare choices such as different hyper parameters.

    Answer

    train

  47. 47
    A test set should generally be used only at the end to report the model's final
    _____
    .
    Hint

    Using it repeatedly during development can lead to overfitting.

    Answer

    performance

  48. 48
    The phenomenon in which a model performs very well on training data but poorly on unseen data is called
    _____
    .
    Hint

    The model has memorized examples instead of learning general patterns.

    Answer

    overfitting

  49. 49
    A common random split for a sufficiently large dataset uses approximately 60% for training, 20% for validation, and 20% for
    _____
    .
    Hint

    This final portion is reserved for reporting results.

    Answer

    testing

  50. 50
    For time series data, training, validation, and test sets should often be separated chronologically to prevent learning from the
    _____
    .
    Hint

    A model should not use later observations to predict earlier ones.

    Answer

    future

  51. 51
    The scikit-learn utility commonly used for random train and test splitting is
    _____
    .
    Hint

    Its name directly describes the operation.

    Answer

    train_test_split

  52. 52
    The process of replacing missing values with estimated values is called
    _____
    .
    Hint

    A simple strategy may use the column mean.

    Answer

    imputation

  53. 53
    A common simple imputation strategy replaces missing numeric values with the column
    _____
    .
    Hint

    It is the arithmetic average of the available values.

    Answer

    mean

  54. 54
    When a numeric feature contains strong outliers, replacing missing values with the
    _____
    may be preferable to using the mean.
    Hint

    This measure is less affected by extreme values.

    Answer

    median

  55. 55
    Scaling a numeric feature means transforming its values into a more consistent
    _____
    .
    Hint

    This prevents features with large magnitudes from dominating optimization.

    Answer

    range

  56. 56
    The Scikit Learn transformer that commonly scales numeric features into the interval from zero to one is
    _____
    .
    Hint

    Its name refers to the minimum and maximum values.

    Answer

    MinMaxScaler

  57. 57
    Standardization typically transforms a feature to have mean zero and standard deviation
    _____
    .
    Hint

    This is the usual standardized scale.

    Answer

    one

  58. 58
    The technique that converts each category into a separate column containing zeros and ones is called
    _____
    encoding.
    Hint

    Exactly one category column is active for each row.

    Answer

    one-hot

  59. 59
    A categorical feature with two categories that indicates the presence or absence of something can be represented using
    _____
    and one.
    Hint

    The two values form a binary representation.

    Answer

    zero

  60. 60
    A decision tree represents a hierarchical sequence of
    _____
    decisions.
    Hint

    Each node usually chooses between two branches.

    Answer

    binary

  61. 61
    A decision tree classifier selects splits by attempting to reduce a measure called the
    _____
    score.
    Hint

    A lower value indicates a purer or better split.

    Answer

    Gini

  62. 62
    A perfect decision-tree split has a Gini score of
    _____
    .
    Hint

    All observations after the split belong perfectly to their classes.

    Answer

    zero

  63. 63
    The maximum number of levels allowed in a decision tree is controlled by the
    _____
    hyper parameter.
    Hint

    It directly limits how deep the tree can grow.

    Answer

    max_depth

  64. 64
    The number of terminal nodes in a decision tree can be limited using the
    _____
    hyper parameter.
    Hint

    Leaf nodes are the endpoints where predictions are returned.

    Answer

    max_leaf_nodes

  65. 65
    A decision tree that memorizes nearly every training example is likely to have a very high training accuracy but poor
    _____
    accuracy.
    Hint

    This measures performance on previously unseen examples during development.

    Answer

    validation

  66. 66
    The process of restricting tree depth or leaf count to reduce overfitting is called
    _____
    .
    Hint

    It controls model complexity.

    Answer

    regularization

  67. 67
    A decision tree can be inspected using feature
    _____
    values that indicate the relative contribution of features.
    Hint

    These values help identify which columns the tree relies on most.

    Answer

    importance

  68. 68
    A random forest combines the predictions of many decision
    _____
    .
    Hint

    A forest is a collection of these models.

    Answer

    trees

  69. 69
    For classification, a random forest usually combines tree predictions by
    _____
    .
    Hint

    The most frequently predicted class is selected.

    Answer

    voting

  70. 70
    For regression, a random forest usually combines tree predictions by taking their
    _____
    .
    Hint

    The result is a continuous numerical value.

    Answer

    average

  71. 71
    The technique of combining multiple models to obtain a stronger overall model is called
    _____
    .
    Hint

    It relies on combining diverse predictions.

    Answer

    ensembling

  72. 72
    Random forests benefit from model diversity because errors from individual trees can
    _____
    when their predictions are combined.
    Hint

    Some trees may overestimate while others underestimate.

    Answer

    cancel

  73. 73
    The random forest hyper parameter that controls the number of decision trees is called
    _____
    .
    Hint

    It determines how many estimators are placed in the forest.

    Answer

    n_estimators

  74. 74
    Randomly selecting training rows with replacement for different trees is called
    _____
    .
    Hint

    Each tree receives a different resampled dataset.

    Answer

    bootstrapping

  75. 75
    Randomly selecting a subset of features for each split helps prevent all trees in a forest from becoming
    _____
    .
    Hint

    The trees should be diverse rather than making exactly the same decisions.

    Answer

    identical

  76. 76
    In gradient boosting, the first prediction is often the
    _____
    value of the target column.
    Hint

    This initial prediction ignores the input features.

    Answer

    average

  77. 77
    Each new decision tree in gradient boosting is trained to correct the
    _____
    made by the previous model.
    Hint

    The trees focus on residuals rather than starting over.

    Answer

    errors

  78. 78
    The parameter that scales the contribution of each new tree in gradient boosting is the
    _____
    rate.
    Hint

    A smaller value makes each update more gradual.

    Answer

    learning

  79. 79
    Gradient boosting is called boosting because new models are added to
    _____
    an existing model.
    Hint

    This differs from independently training trees and averaging them.

    Answer

    improve

  80. 80
    The Python library commonly used in the course for efficient gradient boosting is
    _____
    .
    Hint

    Its name begins with XG and it provides regressor and classifier classes.

    Answer

    XGBoost

  81. 81
    The XGBoost parameter that determines the maximum depth of each boosting tree is
    _____
    .
    Hint

    It limits the complexity of each individual tree.

    Answer

    max_depth

  82. 82
    The gradient boosting parameter that controls how many successive trees are trained is
    _____
    .
    Hint

    Increasing it adds more corrective models.

    Answer

    n_estimators

  83. 83
    In K-fold cross-validation, the dataset is divided into
    _____
    parts called folds.
    Hint

    The letter also appears in the name of the technique.

    Answer

    K

  84. 84
    During K-fold cross-validation, each fold is used once as the
    _____
    set.
    Hint

    The remaining folds are used for training in that iteration.

    Answer

    validation

  85. 85
    K-fold cross-validation allows every observation to be used for both training and
    _____
    across different iterations.
    Hint

    Each fold changes roles during the process.

    Answer

    validation

  86. 86
    A baseline model that always predicts the average target provides a minimum standard that later models should
    _____
    .
    Hint

    A complex model should outperform a simple reference.

    Answer

    beat

  87. 87
    A baseline model that always predicts the most common class is especially useful for imbalanced
    _____
    problems.
    Hint

    It exposes whether accuracy is inflated by a dominant class.

    Answer

    classification

  88. 88
    The condition in which one class occurs much more often than another is called class
    _____
    .
    Hint

    Rain tomorrow had far fewer yes values than no values.

    Answer

    imbalance

  89. 89
    Creating, transforming, or combining features to make them more useful for a model is called feature
    _____
    .
    Hint

    Extracting year and month from a date is one example.

    Answer

    engineering

  90. 90
    Extracting year, month, day, weekday, and hour from a timestamp is an example of feature
    _____
    .
    Hint

    The original date is transformed into several predictive variables.

    Answer

    engineering

  91. 91
    A model's ability to perform well on new data rather than memorized training examples is called
    _____
    .
    Hint

    It is the opposite of overfitting.

    Answer

    generalization

  92. 92
    Combining predictions from several different model types is an example of
    _____
    .
    Hint

    The combined result may be better than any individual model.

    Answer

    ensembling

  93. 93
    Training a second model to learn how to combine the outputs of several first-level models is called
    _____
    .
    Hint

    The models are arranged in layers.

    Answer

    stacking

  94. 94
    The task of grouping similar unlabeled observations into groups is called
    _____
    .
    Hint

    It is a major form of unsupervised learning.

    Answer

    clustering

  95. 95
    In K-means clustering, the letter K specifies the desired number of
    _____
    .
    Hint

    You choose this number before fitting the algorithm.

    Answer

    clusters

  96. 96
    The center point representing a K-means cluster is called a
    _____
    .
    Hint

    It is calculated as the mean of the points assigned to a cluster.

    Answer

    centroid

  97. 97
    K-means assigns an observation to the cluster whose centroid is
    _____
    to that observation.
    Hint

    The algorithm uses distance to determine membership.

    Answer

    closest

  98. 98
    The total within-cluster variance used to assess K-means clustering is called
    _____
    .
    Hint

    Lower values indicate points are more tightly grouped around centroids.

    Answer

    inertia

  99. 99
    A graph of K-means inertia against the number of clusters is called an
    _____
    curve.
    Hint

    The preferred K often occurs where improvement begins to level off.

    Answer

    elbow

  100. 100
    DBSCAN identifies clusters using the local
    _____
    of observations.
    Hint

    It looks for regions containing many nearby points.

    Answer

    density

  101. 101
    In DBSCAN, a point that has enough neighboring observations within the specified radius is called a
    _____
    point.
    Hint

    It forms the dense interior of a cluster.

    Answer

    core

  102. 102
    The dimensionality reduction method that uses linear projections to preserve as much variance as possible is
    _____
    .
    Hint

    It is commonly abbreviated PCA.

    Answer

    principal component analysis

  103. 103
    The new axes created by principal component analysis are called principal
    _____
    .
    Hint

    They are ordered according to the amount of variance they capture.

    Answer

    components

  104. 104
    Reducing hundreds of features to a smaller number while retaining important variation is called dimensionality
    _____
    .
    Hint

    The number of dimensions or columns becomes smaller.

    Answer

    reduction

  105. 105
    The nonlinear visualization technique commonly abbreviated T-SNE is a form of
    _____
    learning.
    Hint

    It preserves local neighborhood relationships in a lower-dimensional representation.

    Answer

    manifold

  106. 106
    T-SNE is especially useful for
    _____
    high-dimensional data in two or three dimensions.
    Hint

    It helps reveal clusters in data that cannot be directly plotted in many dimensions.

    Answer

    visualizing

  107. 107
    In a practical machine learning project, the first step is to understand the
    _____
    requirements.
    Hint

    You must know why the model is being built and how it will be used.

    Answer

    business

  108. 108
    Before choosing a model, a data scientist should determine whether the task is regression, classification, or
    _____
    learning.
    Hint

    This third category has no target labels.

    Answer

    unsupervised

  109. 109
    The metric used by people to judge whether a model meets business goals is called an evaluation
    _____
    .
    Hint

    Examples include accuracy, precision, recall, and RMSE.

    Answer

    metric

  110. 110
    A model's final results should be presented using language and visualizations that nontechnical
    _____
    can understand.
    Hint

    These are the people who make decisions based on the project.

    Answer

    stakeholders

  111. 111
    When a model gives an individual prediction, the data must undergo the same
    _____
    steps used during training.
    Hint

    This includes imputation, scaling, and categorical encoding.

    Answer

    preprocessing

  112. 112
    A saved machine learning model should usually be stored together with its imputer, scaler, encoder, and relevant column
    _____
    .
    Hint

    These objects are needed to process future inputs consistently.

    Answer

    names

  113. 113
    The Python library commonly used in the content to serialize and reload trained models is
    _____
    .
    Hint

    It can save Python objects such as models and preprocessing tools.

    Answer

    joblib

  114. 114
    An API route allows another program to send input data to a model and receive a prediction through a web
    _____
    .
    Hint

    It exposes model functionality over the internet.

    Answer

    service

1 of 114
Question 1 of 114

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent