“Алгоритм логистической регрессии” Ответ

Алгоритм логистической регрессии в Python

# import the class
from sklearn.linear_model import LogisticRegression

# instantiate the model (using the default parameters)
logreg = LogisticRegression()

# fit the model with data
logreg.fit(X_train,y_train)

#
y_pred=logreg.predict(X_test)
Wide-eyed Whale

Алгоритм логистической регрессии в Python

print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
print("Precision:",metrics.precision_score(y_test, y_pred))
print("Recall:",metrics.recall_score(y_test, y_pred))
Wide-eyed Whale

Алгоритм логистической регрессии

# Import the necessary modules
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix, classification_report

# Create training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.4, random_state=42)

# Create the classifier: logreg
logreg = LogisticRegression()

# Fit the classifier to the training data
logreg.fit(X_train, y_train)

# Predict the labels of the test set: y_pred
y_pred = logreg.predict(X_test)

# Compute and print the confusion matrix and classification report
print(confusion_matrix(y_test, y_pred))
print(classification_report(y_test, y_pred))
josh.ipynb

Алгоритм логистической регрессии в Python

# import the metrics class
from sklearn import metrics
cnf_matrix = metrics.confusion_matrix(y_test, y_pred)
cnf_matrix
Wide-eyed Whale

Ответы похожие на “Алгоритм логистической регрессии”

Вопросы похожие на “Алгоритм логистической регрессии”

Больше похожих ответов на “Алгоритм логистической регрессии” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования