Untitled

mail@pastecode.io avatar
unknown
python
a month ago
553 B
4
Indexable
Never
from sklearn.datasets import load_breast_cancer
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
data = load_breast_cancer()
X, y = data.data, data.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=41)
clf = RandomForestClassifier(n_estimators=100, random_state=41)
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
print(f"doğruluğu: {accuracy:.2%}")
Leave a Comment