我正在尝试在 Ubuntu 上安装 tensorflow,但收到此消息:
(base) k@k-1005:~/Documents/ClassificationTexte/src$ python tester.py
Using TensorFlow backend.
RUN: 1
1.1. Training the classifier...
LABELS: {'negative', 'neutral', 'positive'}
2019-12-10 11:58:13.428875: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2019-12-10 11:58:13.432727: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3190585000 Hz
2019-12-10 11:58:13.433041: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5591c387b750 executing computations on platform …Run Code Online (Sandbox Code Playgroud) 我想知道如何将混淆矩阵从 scikit learn 转换为数据框。
我不知道混合不同型号的所有MC是否可行。我为什么问是因为可读性。我必须始终在终端中打印并将 mc 复制到 Excel 文件中,这确实要求很高,因为我根据所选参数多次运行脚本。
models = {'Model_SVC': model1, 'Model_G_NB': model2, 'Model_LR': model3, 'Model_RF': model4, 'Model_KN': model5, 'Model_MLP': model6}
cv_splitter = KFold(n_splits=10, shuffle=False, random_state=None)
for model_name, model in models.items():
y_pred = cross_val_predict(model, features, ylabels, cv=cv_splitter)
print("Model: {}".format(model_name))
print("Accuracy: {}".format(accuracy_score(ylabels, y_pred)))
cm = confusion_matrix(ylabels, y_pred)
output = pd.DataFrame()
print("matrice confusion: {}".format(cm), file=f)
Run Code Online (Sandbox Code Playgroud)
矩阵如下所示:
Model: Model_SVC
Accuracy: 0.5692307692307692
matrice confusion: [[ 34 4 46]
[ 10 2 33]
[ 16 3 112]]
Model: Model_G_NB
Accuracy: 0.43846153846153846
matrice confusion: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Latex 显示我的结果表格,但我在显示时遇到了一些问题:应用粗体时数字未居中,您能帮我找出原因,在代码下方以及它是什么样的:
\documentclass[a4paper, 11pt, french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}% Include the listings-package
\usepackage{listings}
\lstset{language=python}
\usepackage[table]{xcolor}
\usepackage{collcell}
\usepackage{hhline}
\usepackage{pgf}
\usepackage{comment} % habilita el uso de comentarios en varias lineas (\ifx \fi)
\usepackage{lipsum} %Este paquete genera texto del tipo Lorem Ipsum.
\usepackage{fullpage} % cambia el margen
\usepackage{booktabs} % Required for better horizontal rules in tables
\usepackage{fouriernc} % Use the New Century Schoolbook font
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{graphicx}
\begin{document}
\begin{table}[ht]
\begin{tabular}{lSSS}
\toprule
\multirow{2}{*}{Models} &
\multicolumn{1}{c}{POS} \\
& {N+POS - P} \\ % & …Run Code Online (Sandbox Code Playgroud)