Files
FYS-STK4155/doc/LectureNotes/_build/html/reports/chapter9.err.log
T
Morten Hjorth-Jensen 77d85c179c minor update
2023-11-09 17:52:38 +01:00

145 lines
8.3 KiB
Plaintext

Traceback (most recent call last):
File "/Users/mhjensen/miniforge3/lib/python3.9/site-packages/jupyter_cache/executors/utils.py", line 58, in single_nb_execution
executenb(
File "/Users/mhjensen/miniforge3/lib/python3.9/site-packages/nbclient/client.py", line 1305, in execute
return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
File "/Users/mhjensen/miniforge3/lib/python3.9/site-packages/jupyter_core/utils/__init__.py", line 166, in wrapped
return loop.run_until_complete(inner)
File "/Users/mhjensen/miniforge3/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/Users/mhjensen/miniforge3/lib/python3.9/site-packages/nbclient/client.py", line 705, in async_execute
await self.async_execute_cell(
File "/Users/mhjensen/miniforge3/lib/python3.9/site-packages/nbclient/client.py", line 1058, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/Users/mhjensen/miniforge3/lib/python3.9/site-packages/nbclient/client.py", line 914, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
%matplotlib inline
"""The sigmoid function (or the logistic curve) is a
function that takes any real number, z, and outputs a number (0,1).
It is useful in neural networks for assigning weights on a relative scale.
The value z is the weighted sum of parameters involved in the learning algorithm."""
import numpy
import matplotlib.pyplot as plt
import math as mt
z = numpy.arange(-5, 5, .1)
sigma_fn = numpy.vectorize(lambda z: 1/(1+numpy.exp(-z)))
sigma = sigma_fn(z)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(z, sigma)
ax.set_ylim([-0.1, 1.1])
ax.set_xlim([-5,5])
ax.grid(True)
ax.set_xlabel('z')
ax.set_title('sigmoid function')
plt.show()
"""Step Function"""
z = numpy.arange(-5, 5, .02)
step_fn = numpy.vectorize(lambda z: 1.0 if z >= 0.0 else 0.0)
step = step_fn(z)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(z, step)
ax.set_ylim([-0.5, 1.5])
ax.set_xlim([-5,5])
ax.grid(True)
ax.set_xlabel('z')
ax.set_title('step function')
plt.show()
"""Sine Function"""
z = numpy.arange(-2*mt.pi, 2*mt.pi, 0.1)
t = numpy.sin(z)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(z, t)
ax.set_ylim([-1.0, 1.0])
ax.set_xlim([-2*mt.pi,2*mt.pi])
ax.grid(True)
ax.set_xlabel('z')
ax.set_title('sine function')
plt.show()
"""Plots a graph of the squashing function used by a rectified linear
unit"""
z = numpy.arange(-2, 2, .1)
zero = numpy.zeros(len(z))
y = numpy.max([zero, z], axis=0)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(z, y)
ax.set_ylim([-2.0, 2.0])
ax.set_xlim([-2.0, 2.0])
ax.grid(True)
ax.set_xlabel('z')
ax.set_title('Rectified linear unit')
plt.show()
------------------
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 get_ipython().run_line_magic('matplotlib', 'inline')
 3 """The sigmoid function (or the logistic curve) is a 
 4 function that takes any real number, z, and outputs a number (0,1).
 5 It is useful in neural networks for assigning weights on a relative scale.
 6 The value z is the weighted sum of parameters involved in the learning algorithm."""
 8 import numpy
File ~/miniforge3/lib/python3.9/site-packages/IPython/core/interactiveshell.py:2432, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
 2430 kwargs['local_ns'] = self.get_local_scope(stack_depth)
 2431 with self.builtin_trap:
-> 2432 result = fn(*args, **kwargs)
 2434 # The code below prevents the output from being displayed
 2435 # when using magics with decorator @output_can_be_silenced
 2436 # when the last Python token in the expression is a ';'.
 2437 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):
File ~/miniforge3/lib/python3.9/site-packages/IPython/core/magics/pylab.py:99, in PylabMagics.matplotlib(self, line)
 97 print("Available matplotlib backends: %s" % backends_list)
 98 else:
---> 99 gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
 100 self._show_matplotlib_backend(args.gui, backend)
File ~/miniforge3/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3606, in InteractiveShell.enable_matplotlib(self, gui)
 3585 def enable_matplotlib(self, gui=None):
 3586  """Enable interactive matplotlib and inline figure support.
 3587
 3588  This takes the following steps:
 (...)
 3604  display figures inline.
 3605  """
-> 3606 from matplotlib_inline.backend_inline import configure_inline_support
 3608 from IPython.core import pylabtools as pt
 3609 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
File ~/miniforge3/lib/python3.9/site-packages/matplotlib_inline/__init__.py:1
----> 1 from . import backend_inline, config # noqa
 2 __version__ = "0.1.6" # noqa
File ~/miniforge3/lib/python3.9/site-packages/matplotlib_inline/backend_inline.py:6
 1 """A matplotlib backend for publishing figures via display_data"""
 3 # Copyright (c) IPython Development Team.
 4 # Distributed under the terms of the BSD 3-Clause License.
----> 6 import matplotlib
 7 from matplotlib import colors
 8 from matplotlib.backends import backend_agg
ModuleNotFoundError: No module named 'matplotlib'