This project fetches recent earthquake data from GeoNet and provides six different approaches for classifying earthquakes based on their potential intensity (High or Low):
Data Source: Earthquake data is provided by GeoNet (https://www.geonet.org.nz/).
To generate the earthquake map and run either classifier:
python decision_tree.py
python neural_network.py
python statistical_model.py
python ml_model.py
python neural_model.py
python transformer_model.py
The Decision Tree approach provides a simple, interpretable model that's great for understanding the classification process. It's particularly useful for:
Output files: decision_tree.html
and decision_tree.png
The Neural Network approach offers a more sophisticated model that can capture complex patterns in the data. It's particularly useful for:
Output files: neural_network.html
and neural_network.png
The Statistical Model approach provides traditional machine learning algorithms with proven statistical foundations. It supports both Logistic Regression and Naive Bayes classifiers and is particularly useful for:
Output file: statistical_model.html
The Machine Learning Model approach focuses specifically on Logistic Regression optimization with advanced features like decision boundary visualization. It's particularly useful for:
Output files: ml_model.html
and ml_model.png
The Neural Model approach uses MLPClassifier for neural network simulation without requiring TensorFlow. It's particularly useful for:
Output files: neural_model.html
and neural_model.png
The Transformer Model approach uses DistilBERT for attention-based text classification by converting numerical earthquake data into descriptive text. It's particularly useful for:
Output files: transformer_model.html
and transformer_model.png
You can modify the behavior of all models by editing the config.py
file. Key settings include:
DAYS_FILTER
: Number of past days to fetch earthquake data for.MIN_MAGNITUDE
: Minimum magnitude of earthquakes to include.INTENSITY_THRESHOLD
: Magnitude threshold used to define 'High' vs 'Low' intensity.MODEL_TYPE
: Choose between "decision_tree"
, "neural_network"
, or "statistical"
.DECISION_TREE_MAP_INTENSITY_TYPE
: Set to "predicted"
to show predicted intensities, or "actual"
to show intensities based on the threshold.STATISTICAL_MODEL_CONFIG
: Configure statistical model parameters including algorithm choice ("logistic_regression"
or "naive_bayes"
) and hyperparameters.ML_MODEL_CONFIG
: Configure Logistic Regression parameters including solver, regularization strength, and maximum iterations.NEURAL_MODEL_CONFIG
: Configure MLPClassifier parameters including hidden layer sizes, solver, and learning rate settings.TRANSFORMER_MODEL_CONFIG
: Configure DistilBERT parameters including model name, sequence length, and training hyperparameters.View the generated maps: