小编Rea*_*uss的帖子

错误:格式:无法识别“svg”。使用以下之一:

你好,我尝试用我的 csv 数据表创建决策树。我使用以下命令在 anaconda 和 python 中安装了 graphviz 包:

conda install graphviz
pip install graphviz
Run Code Online (Sandbox Code Playgroud)

让我的树可见。这是我在 Jupyther Notebook 中编写的代码:

import pandas as pd
import graphviz
from sklearn import metrics 
from sklearn.tree import DecisionTreeClassifier, export_graphviz
from sklearn.model_selection import train_test_split

file = 'automotive_data.csv'  
COLS = np.arange(0,22,1).tolist()#gibt später bei usecols eine andere möglichkeit die spalten anzusprechen  
data = pd.read_csv(file, header=0, sep = ",", index_col=0, usecols=COLS)
 

x = data.iloc[:,1:]
x = x.to_numpy()

y = data[['Ausfall']]
y

xTrain, xTest, yTrain, yTest = train_test_split(x, y, test_size=0.3, …
Run Code Online (Sandbox Code Playgroud)

format image visible python-3.x anaconda

9
推荐指数
2
解决办法
5007
查看次数

标签 统计

anaconda ×1

format ×1

image ×1

python-3.x ×1

visible ×1