pysal / notebooks

jupyter/ipython notebooks demonstrating PySAL functionality
53 stars 38 forks source link

NameError: Sparse Categorical Speed, 4d_distance #63

Open thedatalass opened 5 years ago

thedatalass commented 5 years ago

Sparse Categorical Speed

spcat1a = []
for n in np.arange(25,250,25):
    o = np.tile(np.arange(n),n)
    s = dt.now()
    b = spcategorical1a(np.array(o))
    e = dt.now()
    spcat1a.append((e-s).total_seconds())
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-23d91b0c87a5> in <module>
      3     o = np.tile(np.arange(n),n)
      4     s = dt.now()
----> 5     b = spcategorical1a(np.array(o))
      6     e = dt.now()
      7     spcat1a.append((e-s).total_seconds())

NameError: name 'spcategorical1a' is not defined

4d_distance

%timeit nplinalg()
%timeit distpython()
%timeit scpkdtree()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-75f6979764bc> in <module>
      1 get_ipython().run_line_magic('timeit', 'nplinalg()')
----> 2 get_ipython().run_line_magic('timeit', 'distpython()')
      3 get_ipython().run_line_magic('timeit', 'scpkdtree()')

/srv/conda/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2305                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2306             with self.builtin_trap:
-> 2307                 result = fn(*args, **kwargs)
   2308             return result
   2309 

</srv/conda/lib/python3.7/site-packages/decorator.py:decorator-gen-60> in timeit(self, line, cell, local_ns)

/srv/conda/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/srv/conda/lib/python3.7/site-packages/IPython/core/magics/execution.py in timeit(self, line, cell, local_ns)
   1145             for index in range(0, 10):
   1146                 number = 10 ** index
-> 1147                 time_number = timer.timeit(number)
   1148                 if time_number >= 0.2:
   1149                     break

/srv/conda/lib/python3.7/site-packages/IPython/core/magics/execution.py in timeit(self, number)
    159         gc.disable()
    160         try:
--> 161             timing = self.inner(it, self.timer)
    162         finally:
    163             if gcold:

<magic-timeit> in inner(_it, _timer)

<ipython-input-2-8bde5fb2158b> in distpython()
     34 
     35 def distpython():
---> 36     dist(np.array((67, 46, 92, 67)),np.array((44, 97, 25, 50)))
     37     dist(np.array((67, 46, 92, 67)),np.array((84, 37, 66, 53)))
     38     dist(np.array((67, 46, 92, 67)),np.array((30, 46, 23, 80)))

NameError: name 'dist' is not defined
darribas commented 5 years ago

Thank you very much for reporting @thedatalass! Could you please provide a link to the source notebook so we can fix it in place? The link provided is to an ephemeral Binder container (now defunct).