0
0
ML Pythonml~20 mins

Moving averages in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Moving Average Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Simple Moving Average (SMA)

Which of the following best describes the Simple Moving Average (SMA) in time series data?

AIt calculates the average of all past data points up to the current point.
BIt calculates the average of a fixed number of the most recent data points.
CIt weights recent data points more heavily than older ones.
DIt predicts future values by fitting a linear trend to the data.
Attempts:
2 left
💡 Hint

Think about how SMA uses a window of data points.

Predict Output
intermediate
2:00remaining
Output of Exponential Moving Average Calculation

What is the output of the following Python code that calculates an exponential moving average (EMA) with alpha=0.5 on the data [10, 20, 30]?

ML Python
data = [10, 20, 30]
alpha = 0.5
ema = [data[0]]
for x in data[1:]:
    ema.append(alpha * x + (1 - alpha) * ema[-1])
print([round(v, 2) for v in ema])
A[10, 15.0, 22.5]
B[10, 20.0, 30.0]
C[10, 15.0, 25.0]
D[10, 17.5, 23.75]
Attempts:
2 left
💡 Hint

EMA updates by weighting the new value and previous EMA.

Model Choice
advanced
2:00remaining
Choosing Moving Average Type for Noisy Data

You have a noisy sensor data stream and want to smooth it while giving more importance to recent readings. Which moving average method is best?

AExponential Moving Average (EMA)
BCumulative Moving Average (CMA)
CSimple Moving Average (SMA)
DWeighted Moving Average with equal weights
Attempts:
2 left
💡 Hint

Consider which method weights recent data more.

Hyperparameter
advanced
2:00remaining
Effect of Alpha in Exponential Moving Average

In an Exponential Moving Average (EMA), what is the effect of increasing the smoothing factor alpha from 0.1 to 0.9?

AThe EMA becomes smoother and reacts slower to recent changes.
BThe EMA becomes equivalent to a Simple Moving Average.
CThe EMA ignores recent data and focuses on older data.
DThe EMA becomes less smooth and reacts faster to recent changes.
Attempts:
2 left
💡 Hint

Alpha controls the weight of the newest data point.

Metrics
expert
2:00remaining
Comparing Moving Average Smoothing with MSE

You apply two smoothing methods on a noisy time series: SMA with window size 3 and EMA with alpha=0.3. Which metric best compares their smoothing quality against the original clean signal?

ASum of absolute differences between noisy and smoothed signals
BAccuracy score of smoothed signal classification
CMean Squared Error (MSE) between smoothed and clean signals
DNumber of data points in the smoothed signal
Attempts:
2 left
💡 Hint

Think about measuring how close the smoothed signal is to the true clean signal.