Decision_trees #3
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user