Use visdom to visualize loss in the network. First, enter in the terminal:
python -m visdom.server
Then run the code, the result is an error, and the following information appears:
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError:
HTTPConnectionPool(host='localhost', port=8097):
Max retries exceeded with url: /events (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6734182d50>:
Failed to establish a new connection:
[Errno 111] Connection refused'))
After Baidu, I found the solution:
Finished running the command: python -m visdom.serve, the following sentence will appear:
Setting up a new session...
To keep the terminal on this page, create a new terminal and run the network code in the new terminal.
Then open the link in the browser:
http://localhost:8097/
You can see the curve being drawn.