Skip to content

Instantly share code, notes, and snippets.

View AlexAndorra's full-sized avatar

Alexandre Andorra AlexAndorra

View GitHub Profile
@AlexAndorra
AlexAndorra / pymc_constrained_priors.ipynb
Last active March 27, 2022 16:12
Tutorial: Choosing priors under constraints with PyMC
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexAndorra
AlexAndorra / demo_aggregated_polls.csv
Last active March 8, 2023 11:18
Multinomial-Softmax Varying Effects Model -- How to improve predictions?
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 9. in line 7.
,type,dateelection,samplesize_agg,farleft_agg,left_agg,green_agg,center_agg,right_agg,farright_agg
0,president,2007-04-22,1513,2.642319739213243,23.87182150228697,0.7081341739052293,18.80659111617075,27.36192869136639,14.28224197910241
1,legislatives,2007-06-10,916,7.330430463707668,27.56734754232374,3.706149433560413,11.11857079713214,41.3225282850869,6.306121535983752
2,municipale,2008-03-09,755,3.587714919640731,44.51125588163963,5.78942009798018,8.098579044091164,32.74063560747641,2.18220604881888
3,europeennes,2009-06-07,2287,12.99453267007107,19.61478771495959,13.35153423532709,11.1684820808109,27.26258673414158,5.756322266063732
4,regionales,2010-03-14,907,9.82754276813801,28.9297161718842,13.58420361981117,4.684000265532882,28.93073792740683,9.083516463389802
5,president,2012-04-22,1400,13.68371418271063,27.6270407004019,2.529702829322754,10.3735479474175,26.783412051306,15.86246594485609
6,legislatives,2012-06-10,1193,7.973864868429566,32.11125265943151,5.070614112874637,2.775111578146919,33.68244436
@AlexAndorra
AlexAndorra / for_discourse.ipynb
Last active September 27, 2019 15:44
Improving sampling speed when sampling is already good but slow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexAndorra
AlexAndorra / bug_az_compare.ipynb
Created August 26, 2019 18:44
Log likelihood not present in sample_stats of ArviZ compare function
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexAndorra
AlexAndorra / X_full.json
Last active March 14, 2019 20:47
A try at modeling French elections results with a hierarchical model. Related Discourse thread: https://discourse.pymc.io/t/multinomial-hierarchical-regression-with-multiple-observations-per-group-bad-energy-issue/2755/15
{"departement":{"0":"ain","1":"ain","2":"ain","3":"ain","4":"ain","5":"ain","6":"ain","7":"ain","8":"ain","9":"ain","10":"ain","11":"ain","12":"ain","13":"ain","14":"ain","15":"ain","16":"ain","17":"ain","18":"ain","19":"ain","20":"aisne","21":"aisne","22":"aisne","23":"aisne","24":"aisne","25":"aisne","26":"aisne","27":"aisne","28":"aisne","29":"aisne","30":"aisne","31":"aisne","32":"aisne","33":"aisne","34":"aisne","35":"aisne","36":"aisne","37":"aisne","38":"aisne","39":"aisne","40":"aisne","41":"allier","42":"allier","43":"allier","44":"allier","45":"allier","46":"allier","47":"allier","48":"allier","49":"allier","50":"allier","51":"allier","52":"allier","53":"allier","54":"allier","55":"allier","56":"allier","57":"allier","58":"allier","59":"allier","60":"allier","61":"alpesdehauteprovence","62":"alpesdehauteprovence","63":"alpesdehauteprovence","64":"alpesdehauteprovence","65":"alpesdehauteprovence","66":"alpesdehauteprovence","67":"alpesdehauteprovence","68":"alpesdehauteprovence","69":"alpesdehautepro