TypeError: to_categorical() got an unexpected keyword argument 'nb_classes'
2024-08-24 14:23:52
在学习莫烦教程中keras教程时,报错:TypeError: to_categorical() got an unexpected keyword argument 'nb_classes',代码如下
X_train = X_train.reshape(X_train.shape[0],-1) / 255 #normalize
X_test = X_test.reshape(X_test.shape[0],-1) / 255 #normalize
y_train = np_utils.to_categorical(y_train, nb_classes=10)
y_test = np_utils.to_categorical(y_test, nb_classes=10)
错误原因:keras版本问题,将nb_classes改为num_classes
参考keras文档:http://keras-cn.readthedocs.io/en/latest/utils/
最新文章
- 严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
- vs2015启动网站调试提示 HTTP 错误 403.14 - Forbidden Web 服务器被配置为不列出此目录的内容。 解决方法
- MVC JS中非表单元素路由传值
- CLR via C# 3rd - 01 - The CLR's Execution Model
- BootStrap安装
- SDC文件模版
- Android 一步一步教你使用ViewDragHelper
- fatal error C1853
- jemalloc/jemalloc.h: No such file or directory
- 使用ThinkPHP框架高速发展网站(多图)
- iOS strong与weak的使用
- FAST MONTE CARLO ALGORITHMS FOR MATRICES II (快速的矩阵分解策略)
- CSAPP:第六章 存储器层次结构
- hive参数配置及任务优化
- 若依项目整合eCharts实现图表统计功能
- linux 下安装 oracle
- sublime3 安装 Package Control 报错 “There Are No Packages Available For Installation”
- c++实现web服务框架
- windows 删除删除不掉的文件
- Activity启动流程
热门文章
- STM8S——Universal asynchronous receiver transmitter (UART)
- linux下ftp连接:530 Permission denied
- alibaba/Sentinel 分布式 系统流量防卫兵
- python包管理工具pip
- 微软Word制作自己的模板
- Ajax中post后台.net MVC中Controller的路径问题。
- react + antiDesign开发中遇到的问题记录
- Oracle purge 用法介绍
- Mac SpotLight无法搜索
- Scrum立会报告+燃尽图(十二月十日总第四十一次):用户推广