Skip to content

monika393/timeseries-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Sunspots Time Series Analysis 🌞🚀

A state-of-the-art time series analysis project using 270+ years of historical sunspots data, showcasing modern forecasting techniques from classical statistics to deep learning.

📖 Overview

This repository contains a complete time series analysis of sunspot activity data, exploring cyclical patterns in solar activity through multiple analytical approaches. Sunspots follow an approximately 11-year solar cycle, making this dataset perfect for demonstrating time series analysis techniques.

🎯 Project Objectives

  • Advanced Decomposition: STL decomposition revealing trend, seasonal, and cyclical components
  • 6 Forecasting Models: From classical ARIMA to modern deep learning (LSTM)
  • Solar Cycle Mastery: Deep analysis of the famous ~11-year solar cycle using cutting-edge techniques
  • Benchmarking Study: Rigorous comparison of statistical, ML, and deep learning approaches
  • Uncertainty Quantification: Bayesian and ensemble methods for prediction intervals
  • Operational Deployment: Model selection and recommendations for real-world forecasting

📁 Project Structure

time-series-analysis/
├── data/
│   ├── raw/                    # Original dataset from Kaggle
│   └── processed/              # Cleaned and preprocessed data
├── notebooks/
│   ├── 01_data_exploration.ipynb                # Complete data exploration & decomposition analysis
│   ├── 02_time_series_decomposition.ipynb      # Advanced STL decomposition & spectral analysis
│   └── 03_forecasting_models_comparison.ipynb  # 6 state-of-the-art forecasting models comparison
├── src/
│   ├── data_processing.py      # Data loading and preprocessing functions
│   ├── visualization.py        # Plotting and visualization utilities
│   └── models.py              # Model implementations and utilities
├── results/
│   ├── plots/                 # Generated visualizations
│   └── models/                # Saved model objects
├── requirements.txt           # Python dependencies
├── README.md                 # This file
└── .gitignore               # Git ignore rules

🚀 Getting Started

Prerequisites

  • Python 3.8+
  • Jupyter Notebook or JupyterLab

Installation

  1. Clone this repository:
git clone https://github.com/yourusername/time-series-analysis.git
cd time-series-analysis
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Download the dataset:

  2. Launch Jupyter:

jupyter notebook

📊 Analysis Highlights

Time Series Decomposition

  • Trend Analysis: Long-term patterns in sunspot activity
  • Seasonality Detection: Identification of the ~11-year solar cycle
  • STL Decomposition: Seasonal and Trend decomposition using Loess

Forecasting Models

1. ARIMA (AutoRegressive Integrated Moving Average)

  • Stationarity testing and data preprocessing
  • Parameter selection using ACF/PACF analysis
  • Model diagnostics and residual analysis
  • Multi-step ahead forecasting

2. Facebook Prophet

  • Automatic seasonality detection
  • Trend changepoint analysis
  • Cross-validation for model selection
  • Uncertainty quantification

3. Scikit-learn Approaches

  • Feature engineering with time-based variables
  • Linear regression with polynomial features
  • Ensemble methods (Random Forest, Gradient Boosting)
  • Support Vector Regression

🔍 Key Findings

(This section will be updated as analysis progresses)

  • Solar cycle patterns and their statistical significance
  • Model performance comparisons
  • Forecasting accuracy for different time horizons
  • Insights into sunspot activity patterns

📈 Visualizations

The project includes comprehensive visualizations:

  • Time series plots with trend lines
  • Decomposition charts (trend, seasonal, residual)
  • Autocorrelation and partial autocorrelation plots
  • Forecast plots with confidence intervals
  • Model performance comparison charts

🛠 Technologies Used

Core Stack

  • Data Processing: pandas, numpy
  • Visualization: matplotlib, seaborn, plotly
  • Statistical Analysis: scipy, statsmodels

Time Series Models

  • Classical: ARIMA, SARIMA, Exponential Smoothing
  • Modern: Facebook Prophet, NeuralProphet
  • Machine Learning: XGBoost, scikit-learn
  • Deep Learning: TensorFlow/Keras LSTM Networks

Advanced Features

  • Uncertainty Quantification: Bayesian methods, confidence intervals
  • Feature Engineering: Lag features, rolling statistics, cyclical encoding
  • Model Evaluation: Time series cross-validation, multiple metrics

📚 Notebooks Overview

01_data_exploration.ipynb 📊

Complete data exploration including:

  • Historical sunspot data loading and quality assessment
  • Statistical analysis and visualization of 270+ years of data
  • Time series decomposition (trend, seasonal, residual components)
  • Spectral analysis revealing the famous ~11-year solar cycle
  • Data preprocessing and feature engineering

02_time_series_decomposition.ipynb 🔬

Advanced decomposition analysis featuring:

  • STL (Seasonal and Trend decomposition using Loess)
  • Classical additive and multiplicative decomposition
  • Solar cycle identification and analysis
  • Component-wise statistical analysis
  • Frequency domain analysis with periodograms

03_forecasting_models_comparison.ipynb 🚀

State-of-the-art forecasting benchmark with 6 models:

  • Classical: ARIMA, SARIMA, Exponential Smoothing
  • Modern ML: Facebook Prophet, XGBoost
  • Deep Learning: LSTM Neural Networks
  • Comprehensive performance evaluation and model ranking
  • Uncertainty quantification with confidence intervals
  • Final recommendations for operational forecasting

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 References

📧 Contact

For questions or suggestions, please open an issue in this repository.


⭐ If you find this project helpful, please consider giving it a star!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors