We predicted a Bones day, but Noodle had other plans. Considering Monday was a No Bones day, we shrugged it off and figured it's ok to be wrong and appeased ourselves with self-care.
from deephaven import new_table
from deephaven.column import string_col
accuracy = new_table
([
string_col("Date", ["11/1/2021", "11/2/2021", "11/3/2021", "11/4/2021", "11/5/2021"]),
string_col("Noodles_Says", ["No Bones", "No Bones", "Bones", "Bones", "Bones"]),
string_col("Prediction", ["Bones", "Bones", "Bones", "Bones", "No Bones"])
])
Nevertheless, the real question is, how can we better predict Bones days? In a comment on Jonathan's TikTok (@jongraz), I suggested that perhaps Noodle is so amazing because he bases his behavior on a planetary configuration. Many astrologists believe that when Mercury and Jupiter are in conjunction, it brings good luck, positivity, and optimism. So, as an interesting use case, we'll use Deephaven to see if the separation of Mercury and Jupiter is what causes Noodle to have No Bones days.
Here, we have a function that 1) performs a calculation to find the separation of the two planets, and 2) sees how this correlates with Bones and No Bones days.
This model accurately determines Bones days 68% of the time, and No Bones days 71% of the time! Decent odds.It also looks like Noodle prefers to take it easy and relax the more closely the planets align.
Take a look at our predictions for this week.
from deephaven import new_table
from deephaven.column import string_col
future = new_table
([
string_col("Date", ["11/8/2021", "11/9/2021", "11/10/2021", "11/11/2021", "11/12/2021"]),
string_col("Prediction", ["No Bones", "No Bones", "No Bones", "No Bones", "Bones"])])
Looks like a week to stay in your comfiest pajamas and binge your leftover Halloween candy. However, remember that Noodle likes sun - the odds are about 50/50 on a sunny day.
from deephaven import read_csv
noodle_pug = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/NoodlePug/noodle_pug.csv")
number_per_day = noodle_pug.drop_columns(cols = ["Date", "Weather_NYC"]).sum_by(by = ["Day_of_Week"])
number_per_weather = noodle_pug.drop_columns(cols = ["Date", "Day_of_Week"]).sum_by(by = ["Weather_NYC"])
- noodle_pug
- number_per_day
- number_per_weather
Will sunny days counter the separation of the planets? What really causes No Bones days? We think it's a complex mixture of all these models.
Stay tuned for updates once Noodle determines our fate for the week.
Try your own model
Do you have ideas for better predictors of Bones/No Bones days?
Test it out! Then let us know on Twitter.
In a terminal enter:
compose_file=https://raw.githubusercontent.com/deephaven/deephaven-core/main/containers/python-examples/base/docker-compose.yml
curl -O "${compose_file}"
docker compose pull
docker compose up -d
Navigate to http://localhost:10000/ide/, then use the script below to open some tables in the Deephaven IDE.
To try out our code for the planet separation:
from deephaven import new_table
from deephaven.column import string_col
os.system("pip install ephem")
import ephem
def sep(date):
m = ephem.Mercury()
j = ephem.Jupiter()
m.compute(date)
j.compute(date)
return (int)(byte)(10*ephem.separation(m, j))
planet = noodle_pug.update(formulas = ["Mercury_Jupiter_sep = (int)sep(Date)","Prediction = (Mercury_Jupiter_sep <= 13) ? `No Bones` : `Bones`"])
future = new_table
([
string_col("Date", ["11/8/2021", "11/9/2021", "11/10/2021", "11/11/2021", "11/12/2021"])])\
.update(formulas = ["Prediction = ((int)sep(Date)<=13) ? `No Bones` : `Bones`"])
If you like our code, read our Quick Start guide for launching Deephaven with Docker to get started on your own projects.