TypeError: cm_plot() missing 2 required positional arguments: 'label_name' and 'normlize'
时间: 2024-02-04 21:02:05 浏览: 34
根据你提供的错误信息,`cm_plot()` 函数缺少两个必需的位置参数:`label_name` 和 `normlize`。
这个错误是因为在调用 `cm_plot()` 函数时没有正确传递这两个参数。确保在调用 `cm_plot()` 函数时提供了正确的参数。
例如,你可以修改调用 `cm_plot()` 函数的代码如下:
```python
draw_confusion_matrix(label_true=y_gt,
label_pred=y_pred,
label_name=labels_name, # 修正参数名称为 "labels_name"
normlize=True, # 提供正确的 "normalize" 参数值
title="Confusion Matrix on Fer2013",
pdf_save_path="Confusion_Matrix_on_Fer2013.jpg",
dpi=300)
```
请注意,这只是一个示例,你可能需要根据你的具体需求和数据进行相应的修改。确保正确提供函数所需的所有参数。
相关问题
TypeError: draw_confusion_matrix() missing 2 required positional arguments: 'label_name' and 'normlize'
抱歉,我之前的回答有一个拼写错误。在调用 `draw_confusion_matrix()` 函数时,你需要提供正确的参数名称 `normalize` 而不是 `normlize`。这可能是导致你出现 `TypeError` 的原因。
请修改调用 `draw_confusion_matrix()` 函数的代码如下:
```python
draw_confusion_matrix(label_true=y_gt,
label_pred=y_pred,
label_name=labels_name, # 提供正确的 "label_name" 参数值
normalize=True, # 提供正确的 "normalize" 参数值
title="Confusion Matrix on Fer2013",
pdf_save_path="Confusion_Matrix_on_Fer2013.jpg",
dpi=300)
```
确保在调用函数时提供了正确的参数名称和值。希望这次能够帮助到你!
TypeError: plot() missing 2 required positional arguments: 'xs' and 'ys'
这个错误通常是由于缺少"plot"函数所需的参数引起的。根据错误提示,"plot"函数缺少两个必需的参数,即"xs"和"ys"。
通常情况下,"plot"函数需要传递两个参数,分别是要绘制的x坐标和y坐标。如果你使用的是Matplotlib的"plot"函数,则需要确保你已经为这两个参数提供了正确的值。
下面是一个示例代码,你可以参考一下:
``` python
import matplotlib.pyplot as plt
# 生成一些数据
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
# 绘制图形
plt.plot(x, y)
# 显示图形
plt.show()
```
在这个示例中,我们首先生成了一些数据,然后使用Matplotlib的"plot"函数绘制了这些数据。可以看到,"plot"函数的前两个参数分别是x坐标和y坐标。最后,我们调用"show"函数显示了绘制的图形。
如果你的代码仍然出现上述错误,请检查一下你的"plot"函数调用是否正确,并确保你已经正确地传递了所有必需的参数。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)