mikeizbicki / cmc-csci145-math166

Data Mining
32 stars 57 forks source link

Part 3 and part 4 code is crashing before finishing final three graphs #109

Closed noahmbenjamin closed 2 years ago

noahmbenjamin commented 2 years ago

Hello! It seems to be crashing in the calculate_err_vs_m and calculate_err_vs_d functions, but it only crashes after m or d reach large values. I'm not sure if this is a timeout error because it was running for so long.

Any help is much appreciated, I'm pasting the error message down below.

I know this probably won't get seen until Wednesday but thought I'd make an issue just in case anyone else was running into the same problem.

Thanks!


TypeError Traceback (most recent call last) Cell In [59], line 1 ----> 1 calculate_err_vs_m( 2 d=2, 3 sigma=0, 4 f=f_polynomial(p=2), 5 p=1, 6 )

Cell In [58], line 97, in calculate_err_vs_m(d, sigma, f, p, num_trials) 95 # plot the errors 96 fig, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(14,5)) ---> 97 ax1.set_xscale('log',basex=2) 98 #ax1.set_yscale('log') 99 ax1.set_ylim([0.0,1.0])

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axes/_base.py:73, in _axis_method_wrapper.__set_name__..wrapper(self, *args, kwargs) 72 def wrapper(self, *args, *kwargs): ---> 73 return get_method(self)(args, kwargs)

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axis.py:816, in Axis._set_axes_scale(self, value, kwargs) 814 g = self.axes._shared_axes[name] 815 for ax in g.get_siblings(self.axes): --> 816 ax._axis_map[name]._set_scale(value, kwargs) 817 ax._update_transScale() 818 ax.stale = True

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axis.py:773, in Axis._set_scale(self, value, kwargs) 771 def _set_scale(self, value, kwargs): 772 if not isinstance(value, mscale.ScaleBase): --> 773 self._scale = mscale.scale_factory(value, self, **kwargs) 774 else: 775 self._scale = value

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/scale.py:714, in scale_factory(scale, axis, kwargs) 712 scale = scale.lower() 713 scale_cls = _api.check_getitem(_scale_mapping, scale=scale) --> 714 return scale_cls(axis, kwargs)

TypeError: init() got an unexpected keyword argument 'basex'

noahmbenjamin commented 2 years ago

Hi I'm sorry I'm confused and maybe I missed something. Is the crashing is a part of the assignment and is the goal is to fix it?

DestrosCMC commented 2 years ago

Using the lambda server, I did not encounter this error. However, @afroCoderHanane has an open pull request: #107 that seems to fix the issue.