GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — PythonDataAnalysisCookbook/Chapter 12/ch12util.py at master · nullzoneopt/PythonDataAnalysisCookbook Expand file tree/ Copy pathch12util.pyMore file actions 36 lines (25 loc) · 820 Bytes / Copy pathch12util.pyFile metadata and controls36 lines (25 loc) · 820 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 import numpy as np from functools import partial import dautil as dl def plot_times(ax, serial, parallel): cp = dl.plotting.CyclePlotter(ax) x = 2 ** np.arange(9) cp.plot(x, serial, label='Serial') cp.plot(x, parallel, label='Parallel') ax.set_xlabel('# Bootstraps') ax.set_ylabel('Time (s)') ax.set_title('Execution Time of Bootstrapping') ax.legend(loc='best') def plot_distro(ax, boot_vals, observed): dl.plotting.hist_norm_pdf(ax, boot_vals) ax.axvline(observed, color='k', lw=3, label='Observed') def time_many(code, n=1): times = [] for i in range(9): times.append(dl.perf.time_once(partial(code, n=2 ** i), n)) return times def bootstrap(arr): n = len(arr) indices = np.random.choice(n, size=n) return arr[indices] |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |