Skip to main content

BEM : beyond the exoplanet mass-radius relation with random forest

Predicting the radius of exoplanets based on its planetary and stellar parameters

Build Status license: MIT PyPI version arXiv

Branca Edmée Marques

A portuguese scientist who worked on nuclear physics in France with Marie Curie

To install bem

pip install bem

or

git clone https://github.com/soleneulmer/bem.git
cd bem
python setup.py install

A simple decision tree

to predict exoplanet radius

How to run bem:

1. Load dataset and model

# Load exoplanet and solar system planets dataset
dataset = bem.load_dataset()
# Plot the dataset radius as a function of mass and equilibrium temperature
bem.plot_dataset(dataset)
# Build the random forest model and predict radius of the dataset
regr, y_test_predict, _, train_test_sets = bem.random_forest_regression(dataset)

2. Predict the radius of your planet

my_planet = [planetary_mass, semi major axis, eccentricity, stellar radius, stellar effective temperature, stellar mass]

or with error bars

my_planet = [planetary_mass, error, semi major axis, error eccentricity, error, stellar radius, error, stellar effective temperature, error, stellar mass, error]

# Predict a new radius
radius, my_pred_planet = bem.predict_radius(my_planet=np.array([[1.63,
								 0.034,
                                                 		 0.02,
                                                 		 0.337,
                                                 		 3505.0,
                                                 		 0.342]]),
                        		    my_name=np.array(['GJ 357 b']),
                            		    regr=regr,
                            		    jupiter_mass=False,
					    error_bar=False)
# If error_bar is True
# print('Radius: ', radius[0][0], '+-', radius[1])

3. Compute error bars for the radius predictions

# Load exoplanet and solar system planets dataset with uncertainties
dataset_errors = bem.load_dataset_errors()
# Compute the error bars for the test set planets
radii_test_output_error, _ = bem.computing_errorbars(regr,
                                                     dataset_errors,
                                                     train_test_sets)
# Plot the test set, true radius versus RF predicted radius
bem.plot_true_predicted(train_test_sets,
                        y_test_predict,
                        radii_test_output_error)

4. Radial velocity dataset

# Load the radial velocity dataset
dataset_rv = bem.load_dataset_RV()
# Predict the radius of the RV dataset
radii_RV_RF = regr.predict(dataset_rv)
# Plot the predictions of the RV dataset
bem.plot_dataset(dataset_rv, predicted_radii=radii_RV_RF, rv=True)

5. Diagnostic plots

# Plot the learning curve
bem.plot_learning_curve(regr, dataset)
# Plot the validation curves
bem.plot_validation_curves(regr, dataset, name='features')
bem.plot_validation_curves(regr, dataset, name='tree')
bem.plot_validation_curves(regr, dataset, name='depth')

6. LIME explanations

see their github

# Explain the RF predictions
# of the exoplanets from the test set
bem.plot_LIME_predictions(regr, dataset, train_test_sets)
# LIME explanation for your planet
# in this case GJ 357 b
bem.plot_LIME_predictions(regr, dataset, train_test_sets,
                          my_pred_planet=my_pred_planet,
                          my_true_radius=1.166)

Metadata

Release files for bem 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bem 1.0.0
File Size Uploaded Provenance
bem-1.0.0.tar.gz 743.9 kB Without provenance Details

Release files / bem-1.0.0.tar.gz

Download URL bem-1.0.0.tar.gz
Size 743.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d0abed772e2ecde8b61f0dc34440d14a173f3384de9f9b3ced793d9380ae091a
BLAKE2b-256 checksum
How to use checksums
b741705e8f79cc54c62d37a2520f63fdc2ccc5944bd6da0c80d94b23f72e7628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

Security for bem 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page