系外行星的随机森林

bem的Python项目详细描述


边界元:超越与随机森林的系外行星质量半径关系

根据行星和恒星参数预测系外行星的半径

Build Statuslicense: MITPyPI version

布兰卡·艾德梅·马奎斯

与玛丽·居里一起在法国从事核物理研究的葡萄牙科学家

安装BEM

pip install bem

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

一个简单的决策树

预测系外行星半径

如何运行BEM:

1.加载数据集和模型

# Load exoplanet and solar system planets datasetdataset= 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 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)

3.计算半径预测的误差线

# Load exoplanet and solar system planets dataset with uncertaintiesdataset_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.径向速度数据集

# Load the radial velocity datasetdataset_rv= bem.load_dataset_RV()# Predict the radius of the RV datasetradii_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。诊断图

# 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.石灰说明

查看他们的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)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用ContentExchange设置请求属性   java Spark/Hdfs/Hdfsclient兼容性   java springcloudstreamkafka配置:instanceCount和instanceIndex   Java中web服务序列化日期   java用动态数据替换占位符   java git gc似乎覆盖了一个packfile,留下了一个打开的文件描述符,其中包含对“oldxxx.pack”的引用   为什么Apache项目对Java版本敏感?   java Anylogic帮助如何在导入的3dobject通过输送机上的多个“站”时更改其颜色?   JavaEclipseNeonM2E可以导入一个大型项目,但似乎不能自动解决依赖关系   java@FindBy搜索具有满足条件的子元素的元素   java如何将ActionEvent e与键绑定一起使用?   java转换以集中方式从外部库抛出的异常   java中用户文件/数据文件与系统/程序文件的区别   java使用变量字符串或字符作为对象名   字体使用Java图形操纵字符串中每个字符的形状   JavaFX图表移动数据   java RandomAccessFile:将所有项设置为相同的字节数?   java Google Play inapp Billing onPurchasesUpdated()错误响应代码1   java在不知道属性名和属性数的情况下处理json对象   java是否可以一次从HazelcastInstance(映射和列表)中删除所有数据?