Keras笔记(一)

来源:互联网 发布:网络数据包截获 转发 编辑:程序博客网 时间:2024/05/19 16:06

在Keras中,训练或测试模型共有4个步骤:

1、通过一个python函数定义model;

2、使用model.compile(optimizer="...", loss="...",metrics=["accuracy"])去编译模型;

3、使用model.fit(x = ..., y=..., epochs = ..., batchsize = ...)去训练模型;

4、使用model.evaluate(x=..., y=...)去测试数据。


在完成Andrew Ng的Deeplearning中的作业时,有一步是利用pydot展示构建的model,发现有错误。

RuntimeError: Failed to import pydot. You must install pydot and graphviz  for `pydotprint` to work

这个错误,即使pip install pydot     pip install graphviz之后还存在。

经过网上搜寻答案,发现需要去官网上下载一个graphviz的msi文件,一路next,并且把bin路径(比如:C:\Program Files (x86)\Graphviz2.38\bin)添加在环境变量的“path”下。


重新试过,还是出错。发现版本出现问题,将安装的pydot卸载后,使用pydot_ng即可。

原创粉丝点击