def load_style(directory='.', name='kf_book/custom.css'): version = [ int(version_no) for version_no in matplotlib.__version__.split('.') ] try: if sys.version_info[0] >= 3: style = json.load(open(os.path.join(directory, "kf_book/538.json"))) else: style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict) plt.rcParams.update(style) except: pass set_figsize() reset_axis() np.set_printoptions(suppress=True, precision=3, threshold=10000., linewidth=70, formatter={'float': lambda x: ' {:.3}'.format(x)}) styles = open(os.path.join(directory, name), 'r').read() set_figsize() # I don't know why I have to do this, but I have to call # with suppress a second time or the notebook doesn't suppress # exponents np.set_printoptions(suppress=True) return HTML(styles)
def load_style(directory='.', name='kf_book/custom.css'): version = [ int(version_no) for version_no in matplotlib.__version__.split('.') ] try: if sys.version_info[0] >= 3: style = json.load(open(os.path.join(directory, "kf_book/538.json"))) else: style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict) # matplotlib has deprecated the use of axes.color_cycle as of version if version[0] > 1 or (version[0] == 1 and version[1] >= 5): style[ "axes.prop_cycle"] = "cycler('color', ['#6d904f','#013afe', '#202020','#fc4f30','#e5ae38','#A60628','#30a2da','#008080','#7A68A6','#CF4457','#188487','#E24A33'])" style.pop("axes.color_cycle", None) plt.rcParams.update(style) except: pass set_figsize() reset_axis() np.set_printoptions(suppress=True, precision=3, linewidth=70, formatter={'float': lambda x: ' {:.3}'.format(x)}) styles = open(os.path.join(directory, name), 'r').read() set_figsize() return HTML(styles)
def load_style(directory='.', name='kf_book/custom.css'): version = [ int(version_no) for version_no in matplotlib.__version__.split('.') ] try: if sys.version_info[0] >= 3: style = json.load(open(os.path.join(directory, "kf_book/538.json"))) else: style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict) plt.rcParams.update(style) except: pass set_figsize() reset_axis() np.set_printoptions(suppress=True, precision=3, linewidth=70, formatter={'float': lambda x: ' {:.3}'.format(x)}) styles = open(os.path.join(directory, name), 'r').read() set_figsize() return HTML(styles)
def load_style(directory = '.', name='kf_book/custom.css'): version = [int(version_no) for version_no in matplotlib.__version__.split('.')] try: if sys.version_info[0] >= 3: style = json.load(open(os.path.join(directory, "kf_book/538.json"))) else: style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict) plt.rcParams.update(style) except: pass set_figsize() reset_axis () np.set_printoptions(suppress=True, precision=3, threshold=10000., linewidth=70, formatter={'float':lambda x:' {:.3}'.format(x)}) styles = open(os.path.join(directory, name), 'r').read() set_figsize() # I don't know why I have to do this, but I have to call # with suppress a second time or the notebook doesn't suppress # exponents np.set_printoptions(suppress=True) return HTML(styles)
def load_style(directory = '.', name='kf_book/custom.css'): version = [int(version_no) for version_no in matplotlib.__version__.split('.')] try: if sys.version_info[0] >= 3: style = json.load(open(os.path.join(directory, "kf_book/538.json"))) else: style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict) # matplotlib has deprecated the use of axes.color_cycle as of version if version[0] > 1 or (version[0] == 1 and version[1] >= 5): style["axes.prop_cycle"] = "cycler('color', ['#6d904f','#013afe', '#202020','#fc4f30','#e5ae38','#A60628','#30a2da','#008080','#7A68A6','#CF4457','#188487','#E24A33'])" style.pop("axes.color_cycle", None) plt.rcParams.update(style) except: pass set_figsize() reset_axis () np.set_printoptions(suppress=True,precision=3, linewidth=70, formatter={'float':lambda x:' {:.3}'.format(x)}) styles = open(os.path.join(directory, name), 'r').read() set_figsize() return HTML(styles)
estimated_weight = predicted_weight + scale_factor * (z - predicted_weight) # save and log estimates.append(estimated_weight) predictions.append(predicted_weight) if do_print: gh.print_results(estimates, predicted_weight, estimated_weight) return estimates, predictions initial_estimate = 160. estimates, predictions = predict_using_gain_guess( estimated_weight=initial_estimate, gain_rate=1, do_print=True) book_plots.set_figsize(10) # weights.insert(0, 160) plt.figure() gh.plot_gh_results(weights, estimates, predictions, [160, 172]) # plt.show() print(weights) e, p = predict_using_gain_guess(initial_estimate, -1.) plt.figure() gh.plot_gh_results(weights, e, p, [160, 172]) # plt.show() print(weights) # change gain rate weight = 160. # initial guess gain_rate = -1.0 # initial guess