triplebhmergerpredictor

Neural network model for predicting mergers in hierarchical triple black hole systems.

https://github.com/maraattia/triplebhmergerpredictor

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.6%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Neural network model for predicting mergers in hierarchical triple black hole systems.

Basic Info
  • Host: GitHub
  • Owner: maraattia
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Size: 430 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Created 11 months ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

DOI

Triple Black Hole Merger Predictor

This repository contains the implementation of a neural network model for predicting mergers in hierarchical triple black hole systems, as described in Attia & Sibony (2025). The model was trained on ~15 million secular simulations performed with a modified version of the JADE secular code.

Overview

Hierarchical triple black hole systems consist of an inner binary orbited by a distant third black hole. The gravitational interactions between these objects can induce oscillations in the inner binary's eccentricity through the von Zeipel–Lidov–Kozai (ZLK) mechanism. During periods of high eccentricity, the pericenter distance becomes extremely small, dramatically increasing gravitational wave emission and potentially leading to merger within the age of the Universe.

Our simulations were performed using the JADE code, which was originally developed for simulating the secular evolution of hierarchical triple systems in the context of planetary dynamics. We modified JADE to include gravitational wave emission effects, enabling efficient exploration of the triple black hole parameter space.

This neural network allows researchers to quickly predict whether a given triple system configuration will result in a merger of the inner binary within 14 billion years, without requiring full dynamical simulations.

Repository Structure

  • triple_bh_merger_predictor.py: Main implementation of the neural network predictor class
  • example_usage.py: Example script demonstrating all features of the predictor
  • requirements.txt: List of required Python packages
  • model/: Directory containing the pretrained model and scaler files
    • model_128_128_128_relu.tf: Pretrained neural network model
    • model_128_128_128_relu_scaler.pkl: Fitted scaler for input normalization
    • X_test.npy: Test dataset features (systems parameters)
    • y_test.npy: Test dataset labels (merger outcomes)

Parameter Ranges

The model is valid for systems with parameters in the following ranges: - Inner binary masses (M1, M2): 5 – 100 solar masses (with M1M2) - Outer black hole mass (M3): 1 – 200 solar masses - Inner semi-major axis (a_i): 1 – 200 AU - Outer semi-major axis (a_o): 100 – 10,000 AU (with a_o > 10 × a_i) - Outer orbit eccentricity (e_o): 0 – 0.9 - Mutual inclination (i_mut): 40 – 80 degrees

Requirements

  • Python 3.7+
  • TensorFlow
  • NumPy
  • Pandas
  • Matplotlib
  • scikit-learn

You can install the required packages using:

bash pip install -r requirements.txt

Usage

Basic Usage

```python from triplebhmerger_predictor import TripleBHMergerPredictor

Initialize the predictor

modelpath = "model/model128128128relu.tf" scalerpath = "model/model128128128reluscaler.pkl" predictor = TripleBHMergerPredictor(modelpath, scaler_path)

Predict for a single system

result = predictor.predictsystem( M1=68, M2=17, M3=92, # Masses in solar masses ai=88, ao=6820, # Semi-major axes in AU eo=0.67, i_mut=78.3 # Eccentricity and mutual inclination (degrees) )

The result contains the prediction, probability, and confidence

print(f"Prediction: {result['prediction']}") print(f"Probability: {result['probability']:.3f}") print(f"Confidence: {result['confidence']:.3f} ({result['confidence_level']})") ```

Batch Predictions

```python import numpy as np

Create an array of system parameters

Format: [M1, M2, M3, ai, ao, eo, imut]

systems = np.array([ [68, 17, 92, 88, 6820, 0.67, 78.3], [30, 30, 30, 100, 9000, 0.1, 45.0], # Add more systems... ])

Get merger probabilities

probabilities = predictor.predict(systems)

Get confidence measures

confidences = predictor.get_confidence(probabilities)

Convert to binary predictions (1 = merger, 0 = no merger)

predictions = (probabilities >= 0.5).astype(int) ```

Comprehensive Example

For a complete demonstration of all features, run the provided example script:

bash python example_usage.py

This script demonstrates: - Single system predictions - Batch predictions for multiple systems - Visualization of prediction results - Model evaluation - Parameter space exploration

Model Details

The neural network has the following architecture: - Input layer (7 neurons): One for each parameter (M1, M2, M3, a_i, a_o, e_o, i_mut) - Three hidden layers (128 neurons each) with ReLU activation - Output layer (1 neuron) with sigmoid activation

The model achieves 95% overall accuracy, with 99.7% accuracy for high-confidence predictions.

Citation

If you use this code in your research, please cite:

Attia, M., & Sibony, Y. (2025). Exploring the Parameter Space of Hierarchical Triple Black Hole Systems. Astronomy & Astrophysics.

If you need to reference this repository, please refer to the CITATION file.

License

This code is licensed under the BSD 3-Clause License—see the LICENSE file for details.

Acknowledgements

The contributors to the development of this software are Mara Attia and Yves Sibony. We acknowledge the use of the Claude AI assistant (Anthropic, 2024) for code optimization.

Contact

For questions or feedback, please contact maraaattia@gmail.com

Owner

  • Login: maraattia
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "Attia"
    given-names: "M."
    orcid: "https://orcid.org/0000-0002-7971-7439"
  - family-names: "Sibony"
    given-names: "Y."
    orcid: "https://orcid.org/0000-0002-7829-776X"
title: "Triple Black Hole Merger Predictor"
version: 1.0.1
date-released: 2025-04-07
doi: 10.5281/zenodo.15167208
url: "https://doi.org/10.5281/zenodo.15167208"
repository-code: "https://github.com/maraattia/TripleBHMergerPredictor"
license: BSD-3-Clause
references:
  - type: article
    authors:
      - family-names: "Attia"
        given-names: "M."
      - family-names: "Sibony"
        given-names: "Y."
    title: "Exploring the Parameter Space of Hierarchical Triple Black Hole Systems"
    journal: "Astronomy & Astrophysics"
    year: 2025
    doi: xxx
    url: "https://doi.org/xxx"
preferred-citation:
  type: article
  authors:
    - family-names: "Attia"
      given-names: "M."
    - family-names: "Sibony"
      given-names: "Y."
  title: "Exploring the Parameter Space of Hierarchical Triple Black Hole Systems"
  journal: "Astronomy & Astrophysics"
  year: 2025
  doi: xxx
  url: "https://doi.org/xxx"
abstract: >
  This software provides a neural network model for predicting mergers in hierarchical 
  triple black hole systems. The model was trained on ~15 million simulations performed 
  with a modified version of the JADE secular code that includes gravitational wave 
  emission. It enables rapid prediction of merger outcomes for triple black hole systems 
  characterized by seven parameters: inner binary masses, outer black hole mass, inner 
  and outer semi-major axes, outer orbit eccentricity, and mutual inclination.
keywords:
  - black holes
  - gravitational waves
  - hierarchical triple systems
  - stellar dynamics
  - machine learning
  - neural networks
  - astrophysics

GitHub Events

Total
  • Release event: 1
  • Delete event: 1
  • Push event: 2
  • Pull request event: 3
  • Create event: 5
Last Year
  • Release event: 1
  • Delete event: 1
  • Push event: 2
  • Pull request event: 3
  • Create event: 5

Dependencies

requirements.txt pypi
  • matplotlib >=3.4.2
  • numpy >=1.19.5
  • pandas >=1.3.0
  • scikit-learn >=0.24.2
  • tensorflow >=2.5.0