My Julia Turing.jl page
Here is a collection of my Julia Turing.jl Probabilistic programming programs.
For more about Turing.jl see:
My Turing.jl models
Here are my Turing.jl models. Many of them are ported from my WebPPL and BLOG models, but also from other sources/problems/puzzles. The models are also available at GitHub: github.com/hakank/hakank/tree/master/julia/turing
All models include jl_utils.jl with the following convenience functions:
-
make_hash(a)
: convert an array of elements to a Dict
-
flip(p=0.5)
: same as Bernoulli(p)
-
simplex(v)
: return a normalized vector, i.e. the values sums to 1
-
show_var_dist(chains::Chains,var)
: show a sorted Dict with keys, values and percentages
-
show_var_dist_pct(chains::Chains, var, num=0)
: show distribution of a variable in a MCMCChain
-
show_var_dist_pct(chains::Chains, var, a::Array)
: show distribution of a variable in a MCMCChain using a lookup table of the variable names
-
show_var_dist(chains::Chains,num=0)
: show distributions of all variables in chain
-
credible_interval(chains::Chains, var, credMass=0.95)
: credible interval
-
confusion_matrix(y,pred,cats,print_all=true)
: confusion matrix
-
`linear_regression_model(x,y=missing)`
: general linear regression model (using MvNormal
and fairly strict priors)
The models:
- 6_digit_numbers.jl: 6 digit numbers (Blom, Holst, Sandell)
- 8_schools.jl: 8 Schools
- ab_testing.jl: A/B testing (Rasmus Bå%aring;th)
- ab_testing2.jl: A/B testing (larger instance)
- ab_test_simple.jl: A/B testing
- aircraft_position).jl: Aircraft and blips - position (BLOG)
- aircraft_static).jl: Aircraft and blips - static (BLOG)
- alarm_multi.jl: Alarm (multi) (ProbLog)
- all_different.jl: All different values in an array)
- ar1.jl: AR(1) model) (Stan)
- ar2.jl: Simple AR(2) model) (BLOG)
- asia.jl: Asia medical model) (Church)
- badges.jl: Bayesian data analys of the Badges problem (data: badges.csv)
- badges2.jl: Bayesian data analys of the Badges problem with different training and test dataset (data: badges.csv)
- bag_of_marbles.jl: Bag of marbles (De Raedt)
- bag_of_marbles2.jl: Bag of marbles, 2 (De Raedt)
- banachs_match_box_problem.jl: Banach's Match Box problem (Blom, Holst, Sandell)
- baseball_hitting_skills.jl: Baseball hitting skills, Hierarchical Partial Pooling (PyMC3)
- batalion.jl: Batalion model (BLOG)
- bayesian_linear_regression.jl: Bayesian linear regression (BLOG)
- bayesian_network.jl: Bayesian network (ProbLog)
- bayesian_null_hypothesis_test.jl: Bayesian null hypothesis test (WebPPL)
- bda.jl: Bayesian Data Analysis, example (WebPPL)
- bda2.jl: Bayesian Data Analysis, example (WebPPL)
- bda_presidential_election.jl: Presidential election (Bayesian Data Analysis) (WebPPL)
- bernoulli_test.jl: Bernoulli test
- bertrands_paradox.jl: Bertrand's paradox (Marcel Moosbrugger)
- beta_comparison.jl: Beta comparison (Yet another A/B test) (Infer.NET)
- biased_coin.jl: Biased coin (Cplint)
- binomial_basketball.jl: Binomial basketball (Wolfram)
- binomial_coin.jl: Binomial coin (Wolfram)
- binomial_dice2.jl: Binomial dice"
- binomial_trial_count.jl: Binomial Trial count (Infer.NET)
- birthday.jl: Birthday "paradox" (BLOG)
- book_bags.jl: Book bags problem (Netica)
- bugs_book_2_1_2.jl: BUGS book, example 2.1.2
- bugs_book_2_4_1.jl: BUGS book, example 2.4.1
- bugs_book_2_5_1.jl: BUGS book, example 2.5.1
- bugs_book_2_6_1.jl: BUGS book, example 2.6.1
- bugs_book_2_7_1.jl: BUGS book, example 2.7.1
- bugs_book_2_7_2.jl: BUGS book, example 2.7.2
- bugs_book_3_3_2.jl: BUGS book, example 3.3.2
- bugs_book_3_3_3.jl: BUGS book, example 3.3.3
- bugs_book_3_4_1.jl: BUGS book, example 3.4.1
- bugs_book_3_5_1.jl: BUGS book, example 3.5.1
- burglar_alarm_r2.jl: Burglar alarm (R2)
- burglary_multihouse.jl: Burglary, multihouse (BLOG)
- cantor.jl: Cantor distribution
- car_buyer.jl: Car Buyer (Netica)
- card_problem.jl: Card problem
- cards.jl: Cards problems (Cplint)
- cat.jl: Cat puzzle
- cats_rats_and_elephants.jl: Cats, rants, and elephants (Allen Downey)
- changepoint_coal_miners.jl: Changepoint detection, Coal Miners (PyMC)
- changepoint.jl: Changepoint detection (JAGS)
- changepoint_text_messages.jl: Changepoint detection, text messages (Cam Davidson-Pilon)
- cheating0.jl: Cheating at test, a more verbose model than cheating.jl and cheating2.jl (Cam Davidson-Pilon)
- cheating.jl: Cheating at test (Cam Davidson-Pilon)
- cheating2.jl: Cheating at test, alternative approach (Cam Davidson-Pilon)
- chicken_pecking.jl: Chicken pecking
- clickGraph.jl: ClickGraph (PSI)
- clickgraph_sppl.jl: ClickGraph (SPPL)
- clinical_trial.jl: Clinical trial (R2), data files: clinical_trial_control.csv, clinical_trial_treatment.csv
- clinical_trial_sppl.jl: Clinical trial (SPPL)
- coin_bias.jl: Coin bias (R2), datafile: coin_bias.txt
- coin_toss.jl: Coin toss (Stan)
- coin_tosses.jl: Coin tosses (Cplint)
- coin_tosses2.jl: Coin tosses, II (Cplint)
- coin_learning.jl: Coin learning (De Raedt, Dries, Kimmig)
- coin_learning2.jl: Coin learning II (De Raedt, Dries, Kimmig)
- color_of_the_taxi.jl: Color of the taxi (Bayesian, Kahnemann, Slovic, Tversky)
- cookie_problem.jl: Cookie problem (Allen Downey)
- coupon_collector.jl: Coupon collector problem
- coupon_collector2.jl: Coupon collector problem (plain simulation, not a Turing.jl model)
- credible_interval_test.jl: Test of
credible_interval
(WebPPL)
- credit_card_fraud.jl: Credit card fraud (Heckerman)
- csi.jl: CSI (context-specific independence) (BLOG)
- cycling_time1.jl: Cycling time (Infer.NET)
- decay_of_digoxin.jl: Decay of Digoxin (Giordano et.al)
- derangements.jl: Derangements
- dice_6_throws.jl: Dice problem (Cplint)
- dice_game.jl: Dice game (PuzzlOR)
- dice_problem.jl: Dice problem (Allen Downey)
- dice_puzzle.jl: Dice puzzle (de Mere)
- digit_recognition.jl: Digit recognition (R2), datafiles: digit_recognition_params.csv, digit_recognition_input.csv, digit_recognition_prior.csv
- disease_infection.jl: Disease infection (SPPL)
- drug_trial_evaluation.jl: Drug trail evaluation (Kruschke, PyMC3)
- election.jl: Election (SPPL)
- euro_coin_problem.jl: Euro coin problem (Allen Downey)
- euro_coin_problem_unreliable_measurements.jl: Euro coin problem, unreliable measurements (Allen Downey)
- fair_coin_from_a_biased_coin.jl: Fair coin from a biased coin (Cplint, von Neumann)
- fairness_hiring_model1.jl: Fairness Hiring model, 1 (SPPL)
- fairness_hiring_model2.jl: Fairness Hiring model, 2 (SPPL)
- fairness_income_model.jl: Fairness Income model (SPPL)
- false_coin.jl: False coin (variant of Peter Winkler's false coin problem)
- false_coin2.jl: False coin (Peter Winkler)
- family_out_problem.jl: Family out problem (Eugene Charniak)
- firing_squad.jl: Firing squad (Judea Pearl)
- five_coins.jl: Five coins problem
- football_bet_simple.jl: Football bet simple (Netica)
- galaxy.jl: Galaxy (BLOG)
- game_of_ur_problem.jl: Game of Ur problem (Allen Downey)
- game_of_ur_problem2.jl: Game of Ur problem, 2 (Allen Downey)
- game_show.jl: Game show problem
- gaussian_mixture_model.jl: Guassian Mixture model
- gaussian_mixture_model2.jl: Guassian Mixture model, II
- gender_height.jl: Gender height problem
- german_tank.jl: German tank problem
- german_tank_int.jl: German tank problem (integer version)
- girl_births.jl: Girl birth problem (Gelman et.al.)
- golf_putting_logit.jl: Golf putting, Logit model (PyMC3), datafiles: golf_putting.csv, golf_putting_broadie.csv
- golf_putting_geometry_based.jl: Golf putting, geometry based model (PyMC3),datafiles: golf_putting.csv, golf_putting_broadie.csv
- grades.jl: Student grades (BLOG)
- grass.jl: Grass problem (R2)
- growth_in_yeast_culture.jl: Growth in Yeast culture (Giordano et.al))
- handedness.jl: Handedness (Infer.NET)
- healthiness.jl: Healthiness (BLOG)
- heart_disease_regression.jl: Heart disease regression (Hugin)
- hierarchical_linear_regression_unpooled.jl: Hierarchical Linear regression (unpooled (PyMC3)<, datafile: radon.csv/li>
- hierarchical_linear_regression_pooled.jl: Hierarchical Linear regression (pooled (PyMC3)<, datafile: radon.csv/li>
- hierarchical_markov_switching.jl: Hierarchical Markov Switching (SPPL)
- hiv.jl: HIV (R2), data files: hiv_num_persons.csv, hiv_person.csv, hiv_time.csv, hiv_y.csv
- hmm1.jl: Hidden Markov Model (BLOG)
- hmm_weather.jl: Hidden Markov Model, simple weather model + recovering the transition probabilities (ProbLog)
- how_many_sons.jl: How many sons? (Ruma Falk)
- how_tall_is_a.jl: How tall is A? (Allen Downey)
- hypergeometric_dist.jl: Hypergeometric distribution (generating)/li>
- hypothesis_testing.jl: Hypothesis testing (AgenaRisk)
- icy_road.jl: Icy road problem (Hygin)
- indian_gpa.jl: Indian GPA (SPPL,Cplint)
- infinite_gaussian_mixture.jl: Infinite Gaussian mixture (BLOG)
- inhibition1.jl: Inhibition problem (ProbLog)
- inhibition_infection.jl: Inhibition problem (ProbLog)
- intelligence_test.jl: Intelligence test (Koller, Friedman)
- iris.jl: Bayesian data analys of the Iris dataset
- iris2.jl: Bayesian data analys of the Iris dataset, different training/test set (and testing some different training percentages, including just 3 instances of 150)
- jaywalking.jl: Jaywalking
- laplace_births.jl: Laplace births problem (Stan)
- light_bulbs.jl: Light bulbs problem
- linear_regression.jl: Linear regression example (Stan)
- linear_regression2.jl: Linear regression example, II (WebPPL)
- linear_regression4.jl: Linear regression example (PyMC3)
- linear_regression_r2.jl: Linear regression (R2), data files: linear_regression_r2_x.csv, linear_regression_r2_y.csv, linear_regression_r2_x1.csv, linear_regression_r2_y1.csv
- lions_tigers_and_bears.jl: Lions, Tigers, and Bears problem (Allen Downey)
- lions_tigers_and_bears3.jl: Lions, Tigers, and Bears problem, v3 (Allen Downey)
- locomotive_problem.jl: Locomotive problem (Allen Downey, Frederick Mosteller)
- logistic_regression.jl: Logistic regression (WebPPL)
- logistic_regression2.jl: Logistic regression (using
logistic
)
- logistic_regression_challenger.jl: Logistic regression, Challenger data (JAGS)
- logistic_regression_challenger2.jl: Logistic regression, Challenger data (using
logistic
)
- lotto_not_two_consecutive_numbers.jl: Lotto, probability of not two consecutive numbers. )
- m_and_m_problem.jl: M&M problem (Allen Downey)
- medical_diagnosis.jl: Medical diagonosis (Cplint)
- medical_diagnosis2.jl: Medical diagnosis (WebPPL)
- medical_test.jl: Medical test
- meeting_problem.jl: Meeting problem/li>
- meeting_under_the_clock.jl: Meeting under the clock (Julian Simon)
- mixture_of_gaussian.jl: Mixture of Gaussian (BLOG)
- mixture_of_gaussian2.jl: Mixture of Gaussian, II (BLOG)
- mixture_of_gaussian_infinite.jl: Mixture of Gaussian, infinite (BLOG)
- model_comparison.jl: Simple model comparison (WebPPL)
- monty_hall.jl: Monty Hall problem (PyMC3)
- morgage.jl: Mortgage (Giordano et.al)
- murder_mystery.jl: Murder mystery (Andy Gordon)
- native_fish.jl: Native fish (Nicholson et.al)
- negative_binomial_test.jl: Negative binomial test
- ninja_bears_hunters.jl: Ninjas, Bears, and Hunters game
- noisy_or.jl: Noisy or (R2)
- number_guessing_game.jl: Number guessing game (Church, WebPPL)
- number_lock2.jl: Number lock puzzle (Mastermind like) (Presh Tailwalker, et.al)
- number_of_walks_until_no_shoes.jl: Number of walks until no shoes (Blom, Holst, Sandell)
- oil_rig.jl: Oil rig (BayesiaLab)
- OneRM.jl: 1 RM (lifting) calculations
- path.jl: Probabilistic path (Cplint)
- person_login.jl: Person login (BLOG)
- pi.jl: Generate value of Pi
- piecewise_transformation.jl: Piecewise transformation (SPPL)
- piranha_puzzle.jl: Piranha puzzle (Joost-Pieter Katoen, R2)
- poisson_ball.jl: Poissin ball (BLOG)
- poisson_mean_inference.jl: Poissin mean inference (SPPL)
- probability_of_missing_values.jl: Probability of missing values (Flavio Poletti)
- queens.jl: N-queens
- random_sequence.jl: Random sequence (SPPL)
- random_walk.jl: Random walk
- random_walk_1.jl: Random walk (Blom, Holst, Sandell)
- rat_tumour.jl: Rat tumour hierarchical binomial model (PyMC3)
- regression_fallacy.jl: Regression fallacy (Gelman et.al.)
- repeated_iq_measurements.jl: Repeated IQ measurements (WebPPL)
- robot_localization.jl: Robot localization (SPPL)
- rolling_dice3.jl: Rolling dice problem (ProbLog)
- rolling_dice4.jl: Rolling dice problem (ProbLog)
- rolling_dice5.jl: Rolling dice problem (ProbLog)
- ruin_problem.jl: Ruin problem
- ruin_problem2.jl: Ruin problem (recursive version)
- same_rank.jl: Same rank problem (Blom, Holst, Sandell)
- sequence_waiting_times_1.jl: Sequence waiting times, I (Blog, Holst, Sandell)
- sequence_waiting_times_2.jl: Sequence waiting times, II (Blog, Holst, Sandell)
- seven_scientists.jl: Seven scientists (WebPPL)
- simple_aircraft.jl: Simple aircraft (BLOG)
- simple_mixture_model.jl: Simple mixture model (SPPL)
- simpson.jl: Simpson's paradox (Judea Pearl, Cplint)
- smokers.jl: Smokers problem (ProbLog)
- sprinkler.jl: Sprinkler problem
- student_interviews.jl: Student interviews (SPPL)
- student_mood_after_exam.jl: Student mood after exam (Joost-Pieter Katoen)
- survey_result_unbias).jl: Survey result unbias (R2), data file: survey_result_unbias_answer.csv, survey_result_unbias_gender.csv, survey_result_unbias_person_gender.csv, survey_result_unbias_population.csv
- survey_result_unbias2).jl: Survey result unbias, II (R2), data files: survey_result_unbias2_answer.csv, survey_result_unbias2_gender.csv, survey_result_unbias2_person_gender.csv, survey_result_unbias2_population.csv
- taxi.jl: Taxi problem (lpmln)
- testing_of_proportionality.jl: Testing of proportionality, Simple Spring-Mass system (Giordano et.al)
- the_car_and_the_goats.jl: Generatlized Monty Hall problem (Blom, Holst, Sandell)
- the_generous_king.jl: The Generous king (Blom, Holst, Sandell)
- thermostat.jl: Thermostat (Omega)
- titanic.jl: Bayesian data analys of the Titanic dataset
- titanic2.jl: Bayesian data analys of the Titanic dataset, here we split in training and test set
- tourist_with_a_short_memory.jl: Tourist with a short memory (Blom, Holst, Sandell)
- trip.jl: Trip (ProbLog)
- true_skill.jl: True Skill model (Borgstrom, etc.al)
- true_skill_simple_r2.jl: True Skill model (R2), data files: true_skill_simple_r2_games.csv, true_skill_simple_r2_players.csv
- true_skill_array_r2.jl: True Skill model, simulated data (R2)
- trueskill_poisson_binomial.jl: TrueSkill Poisson Binomial model (SPPL)
- tug_of_war.jl: Tug of war (Hakaru)
- tug_of_war_with_lazy.jl: Tug of war (with laziness) (Hakaru)
- two_children_problem.jl: Two children problem (Rob Eastaway)
- two_coins_r2.jl: Two coins problem (R2)
- two_dice.jl: Two dice problem
- two_dimensional_mixture_model.jl: Two dimensional mixture model (SPPL)
- two_model.jl: Example of two models in the same file
- uniform_ball.jl: Uniform ball (BLOG)
- uniformDraw.jl: Test of
UniformDraw
(DiscreteNonParametric
)
- urn_ball.jl: Urn balls problem (BLOG)
- urn_large_balls.jl: Urn large balls problem (BLOG)
- urn_model1.jl: Urn problem (Wolfram)
- urn_puzzle.jl: Urn puzzle
- urns_and_balls.jl: Urns and balls problem (Cplint)
- valves.jl: Valves controling the distribution of a fluid (BayesiaLab)
- viral_marketing.jl: Viral marketing (Cplint)
- where_is_my_bag.jl: Where is my bag? (Judea Pearl, Bayesia)
- wine.jl: Bayesian data analys of the Wine problem (data: wine.csv)
wine2.jl: Bayesian data analys of the Wine problem, different training and test sets (data: wine.csv)>
- wine_quality.jl: Bayesian data analys of the Wine quality problem (data: winequality-white.csv, winequality-red.csv)
Back to my homepage
Created by Hakan Kjellerstrand (hakank@gmail.com)