我通过 Scikit learn 的库创建了部分依赖图。但是,由于我可以完全阅读所有图,因此我在将图调整得更大方面面临挑战。有没有一种方法可以改变绘图视图和大小?
代码:
from sklearn.ensemble.partial_dependence import partial_dependence, plot_partial_dependence
import pandas as pd
from pandas import read_csv, DataFrame
from sklearn.ensemble import GradientBoostingRegressor
import numpy as np
my_model = GradientBoostingRegressor()
my_model.fit(X, y)
my_plots = plot_partial_dependence(my_model,
features=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],
X=X,
feature_names=['core_self_evaluations', '1b_score', 'investigate','respect_for_people','social','mastery_orientation','realistic','conventional','astronaut_score','innovation','agreeableness','gradeClass_second_lower','AC_TeamPlayer','enterprising','AC_Problemsolving','AC_StartsConversation','verbal','leadership_score','Race_chinese','performance_orientation','self_monitoring','UniLoc_overseas','attention_to_detail'], # labels on graphs
grid_resolution=5)
Run Code Online (Sandbox Code Playgroud)
创建的情节:
我在使用Plotly生成图表时遇到了错误,它似乎影响了我尝试在其上生成的大多数图表.所有失败的错误似乎都是重复的.我正在使用Jupyter笔记本(Anaconda 3,Python 3.6).
下面找到了无法生成输出的代码(但我的数据表和其他所有内容都是正确的).
**我不确定Plotly库是否存在问题(我正在使用Plotly最新的,我使用"Pip install Plotly"安装)
import pandas as pd # package for high-performance, easy-to-use data
structures and data analysis
import numpy as np # fundamental package for scientific computing with Python
import matplotlib
import matplotlib.pyplot as plt # for plotting
import seaborn as sns # for making plots with seaborn
color = sns.color_palette()
import plotly.offline as py
py.init_notebook_mode(connected=True)
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
import plotly.graph_objs as go
import plotly.offline as offline
offline.init_notebook_mode()
from plotly import tools
import …Run Code Online (Sandbox Code Playgroud) pandas数据表中的第一行已变为列.我尝试了各种重命名方法和重组,但一直没有用.真的很琐碎,但不幸的是我需要一些帮助.
线"0"应该作为第一个数据行"Bachelor"而下降.有人可以指出我这样做的正确方法吗?
我试图在我的Jupyter笔记本上显示粗体字,方程式和斜体字.但是,我只能使用"#"符号编写注释,并且任何其他尝试创建缩进,粗体字和方程式都不起作用.
我需要能够显示数学符号,例如:
$^1/_2$
${3 \over 4}$
Run Code Online (Sandbox Code Playgroud)
我可以错过图书馆导入或类似的东西吗?
我正在使用Jupyter 5.0和Anaconda和Python 3.5
python ×3
jupyter ×2
anaconda ×1
markdown ×1
matplotlib ×1
pandas ×1
plotly ×1
scikit-learn ×1