我为我的随机森林中的预测变量建立了部分依赖图。我想提取用于构建图的数据(尤其是置信区间和预测值),然后在ggplot中对其进行重建。如何访问用于绘制图和置信区间的数据?
这里有一些与我的代码相似的软件包提供了数据集。
LimitRange
答案 0 :(得分:0)
这是在查看软件包源代码后发现的解决方案。这是对绘制图的功能的修改。
def createDestination(self):
'''
split the src variable for machine type
and create a folder with 'Evo' - machine
'''
s = src.split('\\')
new_folder = (dst + '\\Evo ' + s[-1])
if not os.path.exists(new_folder):
os.makedirs(new_folder)
return self.new_folder
def copyPrograms(new_folder):
'''
find all TB-Deco programs in second tier directory.
'''
# create file of folders in directory
folder_list = os.listdir(src)
# iterate the folder list
for folder in folder_list:
# create a new directory inside each folder
folder_src = (src + '\\' + folder)
# create a list of the files in the folder
file_list = os.listdir(folder_src)
# iterate the list of files
for file in file_list:
# if the file ends in .part .PART .dbp or .DBP - add it to a list
if (file.endswith('.part') or file.endswith('.PART') or
file.endswith('.dbp') or file.endswith('.DBP')):
# create a location variable for that file
file_src = (src + folder + '\\' + file)
# copy the file from the server to dst folder
new_file = ('Evo ' + file)
file_dst = (new_folder + '\\' + new_file)
if not os.path.exists(file_dst):
shutil.copy2(file_src, file_dst)
def main():
createDestination()
copyPrograms(new_folder)
if __name__ == "__main__":
main()
此功能中可能还会残留一些不必要的垃圾,但是它将重现用于绘制情节的数据。