Page7/8
Real-World Applications Β· Page 1 of 1
Practical Applications
Real-World Uses
Financial Analysis
Stock price moving average:
[100, 102, 101, 105, 103, 107]
20-day moving average:
[100, 102, 101] β avg 101
[102, 101, 105] β avg 102.67
[101, 105, 103] β avg 103
[105, 103, 107] β avg 105
Traders use this to spot trends!
Network Monitoring
Packet rate per second:
packets = [10, 15, 20, 18, 22, ...]
1-second window:
Current traffic: 22 packets/sec
Average: 17 packets/sec
Threshold: 25 packets/sec
Alert if threshold exceeded!
Anomaly Detection
Normal behavior window:
[5, 6, 4, 7, 5, 6]
avg = 5.5, std = 0.8
New window:
[5, 6, 4, 25, 5, 6]
avg = 8.5 - ANOMALY!
Flag unusual patterns!
User Analytics
Last 7 days of user activity:
Mon: 10 logins
Tue: 12
Wed: 11
Thu: 8
Fri: 9
Sat: 0 - Unusual!
Sun: 0
Rolling window shows pattern change
System Metrics
CPU usage monitoring:
Window = last 60 seconds
If average > 80%: Scale up
If average < 20%: Scale down
Sliding window prevents reaction to spikes
Video Streaming
Adaptive bitrate streaming:
Network: [5Mbps, 4Mbps, 6Mbps, 3Mbps, 5Mbps]
Average bandwidth (window = 5):
[5, 4, 6, 3, 5] β avg 4.6Mbps
Send 4.5Mbps video quality
main.py
Loading...
OUTPUT
βΆClick "Run Code" to executeβ¦