This commit is contained in:
JakubStac 2024-05-12 16:37:09 +02:00
parent d8c336d5e5
commit 4693c3e980

View File

@ -23,8 +23,6 @@ X = data.drop('target_column', axis=1)
y = data['target_column']
X = pd.get_dummies(X)
print(X)
print(y)
# Podział danych na zbiór treningowy i testowy
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
@ -33,7 +31,7 @@ X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_
model = DecisionTreeClassifier()
model.fit(X_train, y_train)
fig = plt.figure(figsize=(25,20))
fig = plt.figure(figsize=(25, 20))
_ = plot_tree(model, feature_names=X.columns, class_names=model.classes_, filled=True)
plt.savefig('drzewo_decyzyjne.png')
plt.show()