Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andyljones committed Jan 18, 2021
1 parent 6bac395 commit c6c879b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
16 changes: 9 additions & 7 deletions boardlaw/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,27 +201,29 @@ def grad_noise_scale(B):

return noise_scale

def grad_student_descent():
def board_runs(boardsize=9):
import pandas as pd
from pavlov import stats, runs
import matplotlib.pyplot as plt

# date of the first 9x9 run
valid = runs.pandas().query('_created > "2020-12-23 09:52Z" & boardsize == 9 & parent == ""')
valid = runs.pandas().query(f'_created > "2020-12-23 09:52Z" & boardsize == {boardsize} & parent == ""')

results = {}
for name in valid.index:
if stats.exists(name, 'elo-mohex'):
s = stats.pandas(name, 'elo-mohex')
if len(s) > 60:
if len(s) > 60 and (s.notnull().sum() > 15).any():
results[name] = s.μ
df = pd.concat(results, 1)
smoothed = df.rolling(60, 15).mean()
smoothed = df.ffill(limit=3).where(df.bfill().notnull()).iloc[3:].head(900)

with plt.style.context('seaborn-poster'):
ax = smoothed.plot(cmap='viridis', legend=False)
ax = smoothed.plot(cmap='viridis_r', legend=False, linewidth=2)
ax.set_facecolor('whitesmoke')
ax.grid(axis='y')
ax.set_ylim(-13, -2)
ax.set_ylim(None, 0)
ax.set_ylabel('eElo')
ax.set_title('grad student descent')
ax.set_title(f'all substantial runs on {boardsize}x{boardsize} boards')

return smoothed
25 changes: 22 additions & 3 deletions main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"outputs": [],
"source": [
"from pavlov import stats\n",
"ax = stats.plot(['*perky-boxes*', '*great-fits', '*forked-shots', -1], 'elo-mohex', 'μ', skip=3, fill=True, head=720)\n",
"ax = stats.plot(['*perky-boxes*', '*forked-shots', '*better-slopes', -1], 'elo-mohex', 'μ', skip=3, fill=True, head=720)\n",
"ax.set_ylim(None, 0)"
]
},
Expand All @@ -27,7 +27,8 @@
"metadata": {},
"outputs": [],
"source": [
"stats.review(-1)"
"from boardlaw.analysis import *\n",
"smoothed = grad_student_descent()"
]
},
{
Expand All @@ -36,7 +37,25 @@
"metadata": {},
"outputs": [],
"source": [
"stats.plot()"
"boardsize = 9\n",
"with plt.style.context('seaborn-poster'):\n",
" colors = ['C7']*(smoothed.shape[1]-1) + ['C1']\n",
" ax = smoothed.plot(color=colors, legend=False, linewidth=1.5)\n",
" ax.set_facecolor('whitesmoke')\n",
" ax.grid(axis='y')\n",
" ax.set_ylim(None, 0)\n",
" ax.set_ylabel('eElo')\n",
" ax.set_title(f'grad student ascent, {boardsize}x{boardsize}')\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"stats.review()"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion rebar/recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def html_tag(video, height=None, **kwargs):
Your browser does not support the video tag.
</video>"""

def notebook(video, height=None):
def notebook(video, height=512):
from IPython.display import display, HTML
return display(HTML(html_tag(video, height)))

Expand Down

0 comments on commit c6c879b

Please sign in to comment.