Squiggle Hub

ozziegooen

1 variables
·
Updated
/*
How long does it take to read different books?
How much does that cost, in counterfactual value, assuming that reading time is counterfactually valuable?

This is a very simple table of estimates. Inspired by a previous Guesstimate model.
*/
@hide
cost(wpm, valuePerHour, words) = {
  wordsPerHour = wpm * 120
  words * (valuePerHour / wordsPerHour)
3 variables
·
Updated
import "hub:ozziegooen/helpers" as helpers
/*
Repurposed from this Guesstimate model:
https://www.getguesstimate.com/models/187

Different dangerous activities feature different expected chances of dying.
It's hard to estimate exactly how bad dying is, but one metric we can use is to
instead consider how many hours in expectation risky events will cost you.

For instance, something that has a 1/4 chance of killing you, can be
Updated
// Model to estimate QALYs saved from autonomous vehicles
import "hub:ozziegooen/sTest" as sTest

// == Model Inputs ==
@name("Key Model Parameters")
inputs = {
  @doc(
    "Annual driving hours in US (2019). Highly uncertain due to:
    - COVID/remote work changes
    - Different measurement methodologies
Updated
// Note: Most of this was AI-generated, using Squiggle AI
// Cost-benefit analysis of AI vs. human driving

import "hub:ozziegooen/sTest" as sTest

@name("🚗 Key Input Parameters")
inputs = {
  // Safety parameters
  currentDeathsPer100kDrivers = 10 to 12
  aiSafetyImprovement = mx([0.9 to 0.99, 0.5 to 0.9], [0.9, 0.1]) // Main estimate with skeptical prior
8 variables
·
Updated
import "hub:ozziegooen/sTest" as sTest
@hide
test = sTest.test
@hide
expect = sTest.expect
@hide
describe = sTest.describe

@hide
styleSquiggleCode(code) = "
1 variables
·
Updated
/*
Optimized Squiggle Code
*/

ss(t) = SampleSet.fromDist(t) // SampleSet function for distributions

// Animal Module Definition
animalModule = {
  // Sentient Welfare Parameters
  average_qaly_per_year = ss(0.7 to 0.9)
3 variables
·
Updated
@startOpen
@name("Documentation")
documentation = "
# SquiggleJest Testing Library

SquiggleJest is a simple testing library for Squiggle, inspired by Jest for JavaScript. It provides a way to write and run tests for your Squiggle models and functions.

## How to Use

1. Import the library (assuming it's in a file named 'squiggleJest.squiggle'):
3 variables
·
Updated
binomialSample(trials, probability) = trials == 0 ? 0 : List(
  trials,
  {|| sample(Sym.bernoulli(sample(Dist(probability))))}
)
  -> sum

_mxChoose(fns, prob) = fns[mx(List.upTo(0, List.length(fns) - 1), prob)
  -> sample
  -> round]
2 variables
·
Updated
@name("Charging Efficiency % (A Constant)")
chargingEfficiency = 0.7 to 0.9

@name("Fn: Cost to Charge Battery Once")
costToCharge(batteryCapacity, electricityRate, chargingEfficiency) = {
  loadInkWh = batteryCapacity / 1000
  chargeCost = loadInkWh * electricityRate / chargingEfficiency
  chargeCost
}
Updated
wordsPerMinute = 110 to 150

// cost per person
// cost per event
// cost per person per word
// cost per event per word

event(numberOfPeople, costPerHour, hours, hoursofPrep) = numberOfPeople *
  costPerHour *
  (hours + hoursofPrep)
Updated
/*
Describe your code here
*/

f(t) = t * 20
Updated
import "hub:ozziegooen/sTest" as sTest
// This is me messing around with AI-generated Squiggle code. This likely has severe problems!
// Cost-Benefit Analysis for a New Factory Construction Project

// Helper function to calculate net present value
npv(cashFlows, discountRate) = List.reduceWhile(
  cashFlows,
  { value: 0, year: 0 },
  {
    |acc, flow|
1 variables
·
Updated
export examples = [
  "ozziegooen/virus-model",
  "ozziegooen/meeting-cost-calculator",
  "ozziegooen/laptop-battery-cost",
  "ozziegooen/wells-riley-model",
  "ozziegooen/shapley-values",
  "ozziegooen/AI-safety-company-factors",
  "ozziegooen/ev-agi-to-individuals",
  "ozziegooen/costs-of-computer-use",
  "ozziegooen/costs-of-sfo-to-uk-flight-claude",
2 variables
·
Updated
@name("Charging efficiency")
@doc("Power lost when charging")
chargingEfficiency = 0.7 to 0.9

// Calculate cost
@hide
costToCharge(batteryCapacity, electricityRate, chargingEfficiency) = {
  loadInkWh = batteryCapacity / 1000
  costPerkWh = electricityRate
  chargeCost = loadInkWh * costPerkWh / chargingEfficiency
Updated
/*
A replication of this Guesstimate code:
https://www.getguesstimate.com/models/10465

This is a model of the expected value, in QALYs, to a random US citizen, due to Transformative AI.
I expect that due to TAI, there's some probability (around .01% to 10%) that humans alive today will
have a long-term positive outcome, meaning that they are sentient and experiencing welfare until roughly
the end of the universe.

There's also a chance that there will be an s-risk, and humans now will experience this same time, but
Updated
/*
Experimental, in-progress model of AI safety compute, over time.
*/

startYear = 2023
endYear = 2080
yearRange = [startYear, endYear]

transformative_ai_timelines(t: yearRange) = {
  dist = mx(logistic(30, 10), logistic(30, 30), [0.9, 0.4]) -> truncateLeft(0)
4 variables
·
Updated
/*
Simple Shapley Value Calculator

Some math from GPT-4 plus this blog post:
https://www.aidancooper.co.uk/how-shapley-values-work/

Inspiration from Nuno Sempere's Shapley Value Calculator
https://shapleyvalue.com/

Exported Functions:
2 variables
·
Updated
// InfectedPeople = TotalPeople * chanceOfInfectionPerPerson
// KEY FORMULAS -----
export model(
  infectedPeople, // Q: Does this need to be 1+? Can it be probabilistic? It would be much nicer if we could treat this as a very low number, rather than a small chance of a person.
  hoursSpentInEnvironment,
  quantumEmissionRate,
  lungCapacity,
  airflow,
  roomVolume
) = {
2 variables
·
Updated
import "hub:ozziegooen/movies-2024-July-prediction-tournament" as moviesData
/*
Describe your code here
*/

@startClosed
@name("Complicated Example Function for Movie Predictions Spec")
@spec(moviesData.spec)
@location
export myForecast = {
6 variables
·
Updated
@startOpen
@name("Documentation: Start Here!")
documentation = "This model contains the information necessary to support a forecasting competition to predict the ratings of upcoming movies on IMDB, Metacritic, and Rotten Tomatoes.

To participate in the competition, write a function matching this signature:  
```
fn(
  time: Date between 2024-04-01 and 2024-06-01,  
  movieUrl: Metacritic movie ID like \"boy-kills-world\" or \"challengers\",
  scoreType: One of [\"imdb\", \"metacritic\", \"rottenTomatoes\"]