系外行星的随机森林

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使用ApachePOI将excel文件导入postgreSQL表   java多线程从iText pdf提取文本   winapi Java和SetWindowDisplayAffinity   eclipse juno的java Websphere 6.1插件   java MPAndroidChart:为Y轴提供一些偏移   java中作为参数传递枚举类型的继承   java Gui jframe的工作原理与netbeans不同   使用Bouncy Castle和PDFBox在Java中验证PDF签名   优化缩小Java代码   java无法在安卓中从Firebase取回子数据   返回的java方法?我应该什么时候用?   java错误处理已完成,退出代码为1。与穿过阵列的for循环有关   多线程Java volatile是否阻止缓存或强制执行写缓存?   java Multi-collectItems如何提前终止并返回已收集的项目   java为什么不在服务(请求,响应)中直接调用processRequest(请求,响应)?   java如何从字符串生成int数组?   打印获取用户输入的值并在其他预选文本中显示。JAVA   未显示java DynamicAsper UTF8字符   java Eclipse RCP:不启动应用程序的命令行参数