系外行星的随机森林

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使用CSPRNG中的序列种子PRNG安全吗?   java如何使JTable列大小与内容精确(或紧密)匹配?   java Android textview具有两种不同大小的文本   java在任意事物的列表(数组)中创建关联的最佳方法是什么?   java保存可扩展字符串?   java成员类(内部类)如何访问外部类的实例变量?   java使用Android 6.0(API级别23)使用rest的最佳方式是什么   java为什么我会收到“学习记录”。Student@25a43blb'尝试显示链接列表中的所有对象时?   java如何将SVG文本转换为SVG路径?   java Paypal返回URL参数支付状态   java Libgdx:导出到可运行Jar   java JPA获取连接实体的最小/最大属性   附加到类型变量的java编号?   java Object[]到底是什么?   java如何在安卓中的片段和活动之间共享数据   java使用MinGW为windows构建linux库   java将变量值传递给eval函数   java仅在转换完成时使方法返回   Java二维数组对角线