Machine Learning Exam #2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

40 Terms

1
New cards

Quadratic

One bend: a U or an ∩

  • B2 > 0: Upward, U

  • B2 < 0: Downward, ∩


2
New cards

Cubic

Two bends: an S

3
New cards

Polynomial Transformations

  • Changes the shape of the mean, correcting linearity, not heteroskedasticity

  • The relationship has multiple bends or turning points

  • Flexibility for complex shapes

  • Genuine optimum


4
New cards

X + I(X^2) + I(X^3)

Raw powers; correlated

  • Structural collinearity: individual raw coefficients and their p-values are not telling you much on their own, does not hurt fitted curve

  • Interpretation


5
New cards

poly(X, 3)

orthogonal polynomial basis; span the same base but are mutually uncorrelated

  • Adding a degree does not disturb the coefficients you already have

  • Prediction and comparing degrees


6
New cards

Turning point

X* = -B1/2B2

7
New cards

anova()

whether adding a polynomial degree improves the model

  • anova(m1, m2, m3)

  • Nested F-Test = p-value on orthagonal basis


8
New cards

Rule of Thumb: Data Amount

10 to 20 observations per estimated parameter

  • The honest answer depends on signal strength, noise level, how the predictor values are spread out, and what you want the model for.


9
New cards

Log Transformations

  • Monotonic: relationship curves once and keeps going

  • Percentage based interpretations

  • Data is right-skewed or heteroskedastic

  • Multiplicative relationship: elasticities, compound growth, diminishing returns


10
New cards

Inverse Property

log(ex) = x

elog(x) = x

11
New cards

Multiplication & Division Property

log(ab) = log(a) + log(b)

log(a/b) = log(a) - log(b)

12
New cards

Exponential Property

log(ab) = b*log(a)

13
New cards

Percentage Property

d log(x) = d x/x

14
New cards

Additive relationship

change by fixed amounts

15
New cards

Muliplicative relationships

change by percentages

16
New cards

Elasticity

log-log; 1% increase in X changes Y by β1%

  • Both variables right-skewed

  • Typical: exp(y)

  • Average: exp(y+se2/2)


17
New cards

Diminishing returns

log-X: a 1% increase in X changes Y by β1×0.01 units

  • X is right-skewed

  • Average: in units of y


18
New cards

Compound growth

log-Y: A one-unit increase in X changes Y by about β1×100%

  • Y is right-skewed

  • Typical: exp(y)

  • Average: exp(y+se2/2)


19
New cards

Diagnostic

  1. Distribution: skewness

  2. Linearity: curvature and funnel

  3. Domain logic: theory on model


20
New cards

RMSE

knowt flashcard image
21
New cards

MAE

knowt flashcard image
22
New cards

exp(predict(model, newdata))

revenue of a typical observations (the median)

23
New cards

exp(predict(model, newdata) + sigma(model)^2 / 2)

average across observations

24
New cards

exp(predict(model, newdata, interval = "prediction"))

prediction interval; percentage spread rather than dollar spread

25
New cards

Formula: doubling X on log-log transformation

100*(2B1-1)

26
New cards

Classification

function f(X) that takes a feature vector X and predicts the value of a categorical response Y

  • Anomaly detection

  • Recommender system

  • Sentiment analysis


27
New cards

Why not linear regression for classification?

  • Predictions escape [0,1]

  • Variance is not constant

  • Standard errors are not trustworthy; too comfortability significant when there is no evidence


28
New cards

Odds

p/(1-p)

29
New cards

Logit: log(odds)

transforms odds from bounded at 0 to unbounded

Reciprocals are turned into the same number, negative

30
New cards

Log(Odds) > Probability

1 / 1 + e-(B0+B1X)

31
New cards

Sigmoid curve

  • For very low X, p​ approaches 0 but never arrives

  • For very high X, p​ approaches 1 but never arrives

  • Where β0+β1X=0, the log-odds are 0, the odds are 1, and the probability is exactly 0.5. That is the middle of the S-curve, the one balance at which default is a coin flip

  • Every output is a valid probability, always


<ul><li><p>For very low X, <span style="font-family: KaTeX_Main, math, &quot;Times New Roman&quot;, serif; line-height: 1.2; font-size: 1.21em;"><em>p</em>​</span> approaches 0 but never arrives</p></li><li><p>For very high X, <span style="font-family: KaTeX_Main, math, &quot;Times New Roman&quot;, serif; line-height: 1.2; font-size: 1.21em;"><em>p</em>​</span> approaches 1 but never arrives</p></li><li><p>Where <span style="font-family: KaTeX_Main, math, &quot;Times New Roman&quot;, serif; line-height: 1.2; font-size: 1.21em;">β0+β1X=0<em>,</em></span> the log-odds are 0, the odds are 1, and the probability is exactly 0.5. That is the middle of the S-curve, the one balance at which default is a coin flip</p></li><li><p>Every output is a valid probability, always</p></li></ul><p></p>
32
New cards

Maximum likelihood estimation

search for the β0​ and β1​ that make the data we actually observed as likely as possible

33
New cards

createDataPartition()

separate imbalance data

34
New cards

Deviance

For every observation, the model assigned a probability to what actually happened. Deviance adds up, across all training rows, how surprised the model should be.

Confident and right is near zero, confident and wrong is huge.

35
New cards

Null Deviance

total for a model with no predictors, which gives every customer the same base rate, and can only be surprised by the “Yes”

36
New cards

Residual deviance

the total once predictors are in the model

37
New cards

Degrees of freedom

the number of training rows minus the number of parameters the model estimates

38
New cards

Akaike Information Criterion (AIC)

Roughly, AIC is deviance plus 2 for every parameter

Penalizes extra parameters, because deviance will always improve

Compare models that fit the same rows

39
New cards

Logistic Regression: Interpreting coefficients

  1. B: log-odds scale

  2. exp(B): odds ratio

    1. Each additional unit multiples the odds of “Yes” by B

  3. (exp(B)-1)*100: percentage

    1. Each additional unit raises the odds of “Yes” by that percent

  4. Effect of X units: eX*B

When adding variables, you are holding the other predictors constant

40
New cards

Accuracy

Accuracy assigns the same cost to every error and then averages across observations