diff --git a/data_files.proto b/data_files.proto index e7a6fc708..e7fd62e85 100644 --- a/data_files.proto +++ b/data_files.proto @@ -147,5 +147,6 @@ message QuizQuestionTronche { repeated int32 geography_b = 2; repeated int32 stat = 3; // probability within tronche - repeated int32 neg_log_prob_x100 = 4; + int32 neg_log_prob_x10_basis = 4; + repeated int32 neg_log_prob_x10_minus_basis = 5; } diff --git a/juxtastat_version.json b/juxtastat_version.json index 838372933..b61a8f1d8 100644 --- a/juxtastat_version.json +++ b/juxtastat_version.json @@ -1 +1 @@ -[["233aac30904fe0c4907b18f22929c861a16df196d8f4db7088d26b551d5a2d13", 0]] \ No newline at end of file +[["233aac30904fe0c4907b18f22929c861a16df196d8f4db7088d26b551d5a2d13", 0], ["35134d491aa5dd59abcc70973e69c58562dae1cb7a900fd885304c6e21654f3a", 1]] \ No newline at end of file diff --git a/react/src/components/quiz-panel.tsx b/react/src/components/quiz-panel.tsx index b4e854efd..f9b4067a8 100644 --- a/react/src/components/quiz-panel.tsx +++ b/react/src/components/quiz-panel.tsx @@ -90,7 +90,7 @@ function QuizPanelNoResets(props: { quizDescriptor: QuizDescriptor, todayName?: setQuestions([...questions, ...newQuestions.filter((question): question is QuizQuestion => question !== undefined)]) }).catch((err: unknown) => { console.error('Error fetching questions', err) - setWaitingForNextQuestion(false) + // setWaitingForNextQuestion(false) }) } diff --git a/react/src/data/quiz_infinite.ts b/react/src/data/quiz_infinite.ts index 73dc1aa45..ab8972e77 100644 --- a/react/src/data/quiz_infinite.ts +++ b/react/src/data/quiz_infinite.ts @@ -2560,901 +2560,345 @@ export default { [ { path: 'quiz_sampling_info/q1/0.gz', - totalP: 0.36763808131217957, + totalP: 0.13598239421844482, }, { path: 'quiz_sampling_info/q1/1.gz', - totalP: 0.14989237487316132, + totalP: 0.09757756441831589, }, { path: 'quiz_sampling_info/q1/2.gz', - totalP: 0.10560750216245651, + totalP: 0.08843813836574554, }, { path: 'quiz_sampling_info/q1/3.gz', - totalP: 0.08263063430786133, + totalP: 0.10184188187122345, }, { path: 'quiz_sampling_info/q1/4.gz', - totalP: 0.06859887391328812, + totalP: 0.11853096634149551, }, { path: 'quiz_sampling_info/q1/5.gz', - totalP: 0.057545579969882965, + totalP: 0.08597700297832489, }, { path: 'quiz_sampling_info/q1/6.gz', - totalP: 0.047207415103912354, + totalP: 0.12596189975738525, }, { path: 'quiz_sampling_info/q1/7.gz', - totalP: 0.03805355355143547, + totalP: 0.10355039685964584, }, { path: 'quiz_sampling_info/q1/8.gz', - totalP: 0.030540455132722855, + totalP: 0.12694931030273438, }, { path: 'quiz_sampling_info/q1/9.gz', - totalP: 0.02261381782591343, - }, - { - path: 'quiz_sampling_info/q1/10.gz', - totalP: 0.015053078532218933, - }, - { - path: 'quiz_sampling_info/q1/11.gz', - totalP: 0.009389333426952362, - }, - { - path: 'quiz_sampling_info/q1/12.gz', - totalP: 0.00476258946582675, - }, - { - path: 'quiz_sampling_info/q1/13.gz', - totalP: 0.0004650745540857315, - }, - { - path: 'quiz_sampling_info/q1/14.gz', - totalP: 7.2928855843201745e-06, + totalP: 0.015190508216619492, }, ], [ { path: 'quiz_sampling_info/q2/0.gz', - totalP: 0.4221111834049225, + totalP: 0.14673025906085968, }, { path: 'quiz_sampling_info/q2/1.gz', - totalP: 0.144798144698143, + totalP: 0.09321416169404984, }, { path: 'quiz_sampling_info/q2/2.gz', - totalP: 0.10500156879425049, + totalP: 0.1077500656247139, }, { path: 'quiz_sampling_info/q2/3.gz', - totalP: 0.08139652758836746, + totalP: 0.09002871066331863, }, { path: 'quiz_sampling_info/q2/4.gz', - totalP: 0.06533225625753403, + totalP: 0.17028813064098358, }, { path: 'quiz_sampling_info/q2/5.gz', - totalP: 0.05145053565502167, + totalP: 0.06415405124425888, }, { path: 'quiz_sampling_info/q2/6.gz', - totalP: 0.03889142721891403, + totalP: 0.12868370115756989, }, { path: 'quiz_sampling_info/q2/7.gz', - totalP: 0.029904885217547417, + totalP: 0.1306871622800827, }, { path: 'quiz_sampling_info/q2/8.gz', - totalP: 0.022507870569825172, - }, - { - path: 'quiz_sampling_info/q2/9.gz', - totalP: 0.01605394296348095, - }, - { - path: 'quiz_sampling_info/q2/10.gz', - totalP: 0.010748544707894325, - }, - { - path: 'quiz_sampling_info/q2/11.gz', - totalP: 0.006527494173496962, - }, - { - path: 'quiz_sampling_info/q2/12.gz', - totalP: 0.0034534395672380924, - }, - { - path: 'quiz_sampling_info/q2/13.gz', - totalP: 0.0014064143178984523, - }, - { - path: 'quiz_sampling_info/q2/14.gz', - totalP: 0.00043018540600314736, + totalP: 0.06846379488706589, }, ], [ { path: 'quiz_sampling_info/q3/0.gz', - totalP: 0.3903525173664093, + totalP: 0.11694368720054626, }, { path: 'quiz_sampling_info/q3/1.gz', - totalP: 0.1401928812265396, + totalP: 0.11449010670185089, }, { path: 'quiz_sampling_info/q3/2.gz', - totalP: 0.10026836395263672, + totalP: 0.08648458868265152, }, { path: 'quiz_sampling_info/q3/3.gz', - totalP: 0.07981663197278976, + totalP: 0.0778813287615776, }, { path: 'quiz_sampling_info/q3/4.gz', - totalP: 0.06511034071445465, + totalP: 0.12422139942646027, }, { path: 'quiz_sampling_info/q3/5.gz', - totalP: 0.05217471346259117, + totalP: 0.11182024329900742, }, { path: 'quiz_sampling_info/q3/6.gz', - totalP: 0.04064515233039856, + totalP: 0.03959804028272629, }, { path: 'quiz_sampling_info/q3/7.gz', - totalP: 0.03220118582248688, + totalP: 0.04810687154531479, }, { path: 'quiz_sampling_info/q3/8.gz', - totalP: 0.025197135284543037, + totalP: 0.11842415481805801, }, { path: 'quiz_sampling_info/q3/9.gz', - totalP: 0.019486891105771065, + totalP: 0.1262359768152237, }, { path: 'quiz_sampling_info/q3/10.gz', - totalP: 0.015053939074277878, - }, - { - path: 'quiz_sampling_info/q3/11.gz', - totalP: 0.011607799679040909, - }, - { - path: 'quiz_sampling_info/q3/12.gz', - totalP: 0.008898304775357246, - }, - { - path: 'quiz_sampling_info/q3/13.gz', - totalP: 0.006385310553014278, - }, - { - path: 'quiz_sampling_info/q3/14.gz', - totalP: 0.00415657926350832, - }, - { - path: 'quiz_sampling_info/q3/15.gz', - totalP: 0.0028153664898127317, - }, - { - path: 'quiz_sampling_info/q3/16.gz', - totalP: 0.002071874449029565, - }, - { - path: 'quiz_sampling_info/q3/17.gz', - totalP: 0.001479493803344667, - }, - { - path: 'quiz_sampling_info/q3/18.gz', - totalP: 0.0010244218865409493, - }, - { - path: 'quiz_sampling_info/q3/19.gz', - totalP: 0.0007064173696562648, - }, - { - path: 'quiz_sampling_info/q3/20.gz', - totalP: 0.0004209323669783771, - }, - { - path: 'quiz_sampling_info/q3/21.gz', - totalP: 8.05334002507152e-06, + totalP: 0.03579362481832504, }, ], [ { path: 'quiz_sampling_info/q4/0.gz', - totalP: 0.38750115036964417, + totalP: 0.10969769209623337, }, { path: 'quiz_sampling_info/q4/1.gz', - totalP: 0.1254192590713501, + totalP: 0.12897737324237823, }, { path: 'quiz_sampling_info/q4/2.gz', - totalP: 0.09075488150119781, + totalP: 0.08638643473386765, }, { path: 'quiz_sampling_info/q4/3.gz', - totalP: 0.07341223955154419, + totalP: 0.10407009720802307, }, { path: 'quiz_sampling_info/q4/4.gz', - totalP: 0.06335493177175522, + totalP: 0.12337031215429306, }, { path: 'quiz_sampling_info/q4/5.gz', - totalP: 0.05458942428231239, + totalP: 0.0716659277677536, }, { path: 'quiz_sampling_info/q4/6.gz', - totalP: 0.04462672024965286, + totalP: 0.08976385742425919, }, { path: 'quiz_sampling_info/q4/7.gz', - totalP: 0.035467155277729034, + totalP: 0.031971629709005356, }, { path: 'quiz_sampling_info/q4/8.gz', - totalP: 0.028291698545217514, + totalP: 0.032241206616163254, }, { path: 'quiz_sampling_info/q4/9.gz', - totalP: 0.022018076851963997, + totalP: 0.08614720404148102, }, { path: 'quiz_sampling_info/q4/10.gz', - totalP: 0.016690203920006752, + totalP: 0.07542141526937485, }, { path: 'quiz_sampling_info/q4/11.gz', - totalP: 0.01217847689986229, - }, - { - path: 'quiz_sampling_info/q4/12.gz', - totalP: 0.008624359965324402, - }, - { - path: 'quiz_sampling_info/q4/13.gz', - totalP: 0.006238069850951433, - }, - { - path: 'quiz_sampling_info/q4/14.gz', - totalP: 0.0047327252104878426, - }, - { - path: 'quiz_sampling_info/q4/15.gz', - totalP: 0.0038146318402141333, - }, - { - path: 'quiz_sampling_info/q4/16.gz', - totalP: 0.003191667376086116, - }, - { - path: 'quiz_sampling_info/q4/17.gz', - totalP: 0.002712230198085308, - }, - { - path: 'quiz_sampling_info/q4/18.gz', - totalP: 0.0023088508751243353, - }, - { - path: 'quiz_sampling_info/q4/19.gz', - totalP: 0.0020233767572790384, - }, - { - path: 'quiz_sampling_info/q4/20.gz', - totalP: 0.0018026038305833936, - }, - { - path: 'quiz_sampling_info/q4/21.gz', - totalP: 0.001603159704245627, - }, - { - path: 'quiz_sampling_info/q4/22.gz', - totalP: 0.0013904363149777055, - }, - { - path: 'quiz_sampling_info/q4/23.gz', - totalP: 0.0011930236360058188, - }, - { - path: 'quiz_sampling_info/q4/24.gz', - totalP: 0.0010382027830928564, - }, - { - path: 'quiz_sampling_info/q4/25.gz', - totalP: 0.000894309428986162, - }, - { - path: 'quiz_sampling_info/q4/26.gz', - totalP: 0.0007795034325681627, - }, - { - path: 'quiz_sampling_info/q4/27.gz', - totalP: 0.0006922086467966437, - }, - { - path: 'quiz_sampling_info/q4/28.gz', - totalP: 0.0006188106490299106, - }, - { - path: 'quiz_sampling_info/q4/29.gz', - totalP: 0.0005400435766205192, - }, - { - path: 'quiz_sampling_info/q4/30.gz', - totalP: 0.00046228215796872973, - }, - { - path: 'quiz_sampling_info/q4/31.gz', - totalP: 0.000387054547900334, - }, - { - path: 'quiz_sampling_info/q4/32.gz', - totalP: 0.00029496935894712806, - }, - { - path: 'quiz_sampling_info/q4/33.gz', - totalP: 4.763996912515722e-05, + totalP: 0.06028646603226662, }, ], [ { path: 'quiz_sampling_info/q5/0.gz', - totalP: 0.2279743105173111, + totalP: 0.024335427209734917, }, { path: 'quiz_sampling_info/q5/1.gz', - totalP: 0.06766337156295776, + totalP: 0.027490895241498947, }, { path: 'quiz_sampling_info/q5/2.gz', - totalP: 0.05435597896575928, + totalP: 0.027777355164289474, }, { path: 'quiz_sampling_info/q5/3.gz', - totalP: 0.046791866421699524, + totalP: 0.02645501121878624, }, { path: 'quiz_sampling_info/q5/4.gz', - totalP: 0.041232381016016006, + totalP: 0.027246614918112755, }, { path: 'quiz_sampling_info/q5/5.gz', - totalP: 0.03724168241024017, + totalP: 0.031373098492622375, }, { path: 'quiz_sampling_info/q5/6.gz', - totalP: 0.03378044068813324, + totalP: 0.012537983246147633, }, { path: 'quiz_sampling_info/q5/7.gz', - totalP: 0.030765725299715996, + totalP: 0.018217990174889565, }, { path: 'quiz_sampling_info/q5/8.gz', - totalP: 0.028227318078279495, + totalP: 0.01148033607751131, }, { path: 'quiz_sampling_info/q5/9.gz', - totalP: 0.026138845831155777, + totalP: 0.0190809965133667, }, { path: 'quiz_sampling_info/q5/10.gz', - totalP: 0.024363918229937553, + totalP: 0.02057676762342453, }, { path: 'quiz_sampling_info/q5/11.gz', - totalP: 0.02278042584657669, + totalP: 0.023251129314303398, }, { path: 'quiz_sampling_info/q5/12.gz', - totalP: 0.021333670243620872, + totalP: 0.021215511485934258, }, { path: 'quiz_sampling_info/q5/13.gz', - totalP: 0.019990617409348488, + totalP: 0.021803798153996468, }, { path: 'quiz_sampling_info/q5/14.gz', - totalP: 0.01880929432809353, + totalP: 0.020011184737086296, }, { path: 'quiz_sampling_info/q5/15.gz', - totalP: 0.017789116129279137, + totalP: 0.029656967148184776, }, { path: 'quiz_sampling_info/q5/16.gz', - totalP: 0.016873473301529884, + totalP: 0.028625892475247383, }, { path: 'quiz_sampling_info/q5/17.gz', - totalP: 0.01603289321064949, + totalP: 0.024535421282052994, }, { path: 'quiz_sampling_info/q5/18.gz', - totalP: 0.015240936540067196, + totalP: 0.039453402161598206, }, { path: 'quiz_sampling_info/q5/19.gz', - totalP: 0.014481969177722931, + totalP: 0.06428781896829605, }, { path: 'quiz_sampling_info/q5/20.gz', - totalP: 0.0137752341106534, + totalP: 0.01753440499305725, }, { path: 'quiz_sampling_info/q5/21.gz', - totalP: 0.01312382984906435, + totalP: 0.017197761684656143, }, { path: 'quiz_sampling_info/q5/22.gz', - totalP: 0.012488673441112041, + totalP: 0.025435293093323708, }, { path: 'quiz_sampling_info/q5/23.gz', - totalP: 0.011862924322485924, + totalP: 0.019321205094456673, }, { path: 'quiz_sampling_info/q5/24.gz', - totalP: 0.01125122420489788, + totalP: 0.01782405935227871, }, { path: 'quiz_sampling_info/q5/25.gz', - totalP: 0.01065963227301836, + totalP: 0.009560183621942997, }, { path: 'quiz_sampling_info/q5/26.gz', - totalP: 0.010091898031532764, + totalP: 0.045571789145469666, }, { path: 'quiz_sampling_info/q5/27.gz', - totalP: 0.009536824189126492, + totalP: 0.045103639364242554, }, { path: 'quiz_sampling_info/q5/28.gz', - totalP: 0.00899641402065754, + totalP: 0.00801666360348463, }, { path: 'quiz_sampling_info/q5/29.gz', - totalP: 0.008468342013657093, + totalP: 0.01090974546968937, }, { path: 'quiz_sampling_info/q5/30.gz', - totalP: 0.007972761988639832, + totalP: 0.04098346084356308, }, { path: 'quiz_sampling_info/q5/31.gz', - totalP: 0.007520751561969519, + totalP: 0.008972760289907455, }, { path: 'quiz_sampling_info/q5/32.gz', - totalP: 0.007069980259984732, + totalP: 0.007798986975103617, }, { path: 'quiz_sampling_info/q5/33.gz', - totalP: 0.006664663553237915, + totalP: 0.008513270877301693, }, { path: 'quiz_sampling_info/q5/34.gz', - totalP: 0.006281593814492226, + totalP: 0.009423915296792984, }, { path: 'quiz_sampling_info/q5/35.gz', - totalP: 0.005884514190256596, + totalP: 0.009462327696383, }, { path: 'quiz_sampling_info/q5/36.gz', - totalP: 0.005494019947946072, + totalP: 0.03476234897971153, }, { path: 'quiz_sampling_info/q5/37.gz', - totalP: 0.005114319734275341, + totalP: 0.02697318233549595, }, { path: 'quiz_sampling_info/q5/38.gz', - totalP: 0.004744821693748236, + totalP: 0.02597339078783989, }, { path: 'quiz_sampling_info/q5/39.gz', - totalP: 0.00438907602801919, + totalP: 0.03484708070755005, }, { path: 'quiz_sampling_info/q5/40.gz', - totalP: 0.004052479285746813, - }, - { - path: 'quiz_sampling_info/q5/41.gz', - totalP: 0.0037338300608098507, - }, - { - path: 'quiz_sampling_info/q5/42.gz', - totalP: 0.0034263816196471453, - }, - { - path: 'quiz_sampling_info/q5/43.gz', - totalP: 0.0031237576622515917, - }, - { - path: 'quiz_sampling_info/q5/44.gz', - totalP: 0.0028206282295286655, - }, - { - path: 'quiz_sampling_info/q5/45.gz', - totalP: 0.0025311594363301992, - }, - { - path: 'quiz_sampling_info/q5/46.gz', - totalP: 0.0022778050042688847, - }, - { - path: 'quiz_sampling_info/q5/47.gz', - totalP: 0.002054124139249325, - }, - { - path: 'quiz_sampling_info/q5/48.gz', - totalP: 0.0018651338759809732, - }, - { - path: 'quiz_sampling_info/q5/49.gz', - totalP: 0.00170260074082762, - }, - { - path: 'quiz_sampling_info/q5/50.gz', - totalP: 0.0015463801100850105, - }, - { - path: 'quiz_sampling_info/q5/51.gz', - totalP: 0.0013832623371854424, - }, - { - path: 'quiz_sampling_info/q5/52.gz', - totalP: 0.0012284719850867987, - }, - { - path: 'quiz_sampling_info/q5/53.gz', - totalP: 0.0011031108442693949, - }, - { - path: 'quiz_sampling_info/q5/54.gz', - totalP: 0.0010035482700914145, - }, - { - path: 'quiz_sampling_info/q5/55.gz', - totalP: 0.0009316039504483342, - }, - { - path: 'quiz_sampling_info/q5/56.gz', - totalP: 0.0008761294884607196, - }, - { - path: 'quiz_sampling_info/q5/57.gz', - totalP: 0.0008280539768747985, - }, - { - path: 'quiz_sampling_info/q5/58.gz', - totalP: 0.0007799062295816839, - }, - { - path: 'quiz_sampling_info/q5/59.gz', - totalP: 0.0007298595737665892, - }, - { - path: 'quiz_sampling_info/q5/60.gz', - totalP: 0.0006808063481003046, - }, - { - path: 'quiz_sampling_info/q5/61.gz', - totalP: 0.0006303310510702431, - }, - { - path: 'quiz_sampling_info/q5/62.gz', - totalP: 0.0005805731052532792, - }, - { - path: 'quiz_sampling_info/q5/63.gz', - totalP: 0.0005423340480774641, - }, - { - path: 'quiz_sampling_info/q5/64.gz', - totalP: 0.00051063799764961, - }, - { - path: 'quiz_sampling_info/q5/65.gz', - totalP: 0.00047875012387521565, - }, - { - path: 'quiz_sampling_info/q5/66.gz', - totalP: 0.0004398627206683159, - }, - { - path: 'quiz_sampling_info/q5/67.gz', - totalP: 0.00039760518120601773, - }, - { - path: 'quiz_sampling_info/q5/68.gz', - totalP: 0.00037025389610789716, - }, - { - path: 'quiz_sampling_info/q5/69.gz', - totalP: 0.0003520796890370548, - }, - { - path: 'quiz_sampling_info/q5/70.gz', - totalP: 0.00033822303521446884, - }, - { - path: 'quiz_sampling_info/q5/71.gz', - totalP: 0.00032498405198566616, - }, - { - path: 'quiz_sampling_info/q5/72.gz', - totalP: 0.00031013425905257463, - }, - { - path: 'quiz_sampling_info/q5/73.gz', - totalP: 0.0002927598834503442, - }, - { - path: 'quiz_sampling_info/q5/74.gz', - totalP: 0.0002761373471003026, - }, - { - path: 'quiz_sampling_info/q5/75.gz', - totalP: 0.0002608700597193092, - }, - { - path: 'quiz_sampling_info/q5/76.gz', - totalP: 0.00024903888697735965, - }, - { - path: 'quiz_sampling_info/q5/77.gz', - totalP: 0.00023906651767902076, - }, - { - path: 'quiz_sampling_info/q5/78.gz', - totalP: 0.00023011832672636956, - }, - { - path: 'quiz_sampling_info/q5/79.gz', - totalP: 0.00022226884902920574, - }, - { - path: 'quiz_sampling_info/q5/80.gz', - totalP: 0.00021587393712252378, - }, - { - path: 'quiz_sampling_info/q5/81.gz', - totalP: 0.00021003936126362532, - }, - { - path: 'quiz_sampling_info/q5/82.gz', - totalP: 0.00020474276971071959, - }, - { - path: 'quiz_sampling_info/q5/83.gz', - totalP: 0.00019960464851465076, - }, - { - path: 'quiz_sampling_info/q5/84.gz', - totalP: 0.00019435521971900016, - }, - { - path: 'quiz_sampling_info/q5/85.gz', - totalP: 0.00018915545661002398, - }, - { - path: 'quiz_sampling_info/q5/86.gz', - totalP: 0.00018433544028084725, - }, - { - path: 'quiz_sampling_info/q5/87.gz', - totalP: 0.00017981528071686625, - }, - { - path: 'quiz_sampling_info/q5/88.gz', - totalP: 0.00017519299581181258, - }, - { - path: 'quiz_sampling_info/q5/89.gz', - totalP: 0.00017079028475563973, - }, - { - path: 'quiz_sampling_info/q5/90.gz', - totalP: 0.0001667415490373969, - }, - { - path: 'quiz_sampling_info/q5/91.gz', - totalP: 0.00016284757293760777, - }, - { - path: 'quiz_sampling_info/q5/92.gz', - totalP: 0.00015947746578603983, - }, - { - path: 'quiz_sampling_info/q5/93.gz', - totalP: 0.00015633358270861208, - }, - { - path: 'quiz_sampling_info/q5/94.gz', - totalP: 0.00015321407408919185, - }, - { - path: 'quiz_sampling_info/q5/95.gz', - totalP: 0.0001501574442954734, - }, - { - path: 'quiz_sampling_info/q5/96.gz', - totalP: 0.00014711373660247773, - }, - { - path: 'quiz_sampling_info/q5/97.gz', - totalP: 0.00014415118494071066, - }, - { - path: 'quiz_sampling_info/q5/98.gz', - totalP: 0.00014149573689792305, - }, - { - path: 'quiz_sampling_info/q5/99.gz', - totalP: 0.00013916331226937473, - }, - { - path: 'quiz_sampling_info/q5/100.gz', - totalP: 0.00013694640074390918, - }, - { - path: 'quiz_sampling_info/q5/101.gz', - totalP: 0.00013464769290294498, - }, - { - path: 'quiz_sampling_info/q5/102.gz', - totalP: 0.00013209524331614375, - }, - { - path: 'quiz_sampling_info/q5/103.gz', - totalP: 0.0001292396045755595, - }, - { - path: 'quiz_sampling_info/q5/104.gz', - totalP: 0.00012648937990888953, - }, - { - path: 'quiz_sampling_info/q5/105.gz', - totalP: 0.00012409412011038512, - }, - { - path: 'quiz_sampling_info/q5/106.gz', - totalP: 0.00012199542834423482, - }, - { - path: 'quiz_sampling_info/q5/107.gz', - totalP: 0.00012005538155790418, - }, - { - path: 'quiz_sampling_info/q5/108.gz', - totalP: 0.00011824323155451566, - }, - { - path: 'quiz_sampling_info/q5/109.gz', - totalP: 0.00011667785292956978, - }, - { - path: 'quiz_sampling_info/q5/110.gz', - totalP: 0.00011536679812707007, - }, - { - path: 'quiz_sampling_info/q5/111.gz', - totalP: 0.00011419081420172006, - }, - { - path: 'quiz_sampling_info/q5/112.gz', - totalP: 0.0001130150121753104, - }, - { - path: 'quiz_sampling_info/q5/113.gz', - totalP: 0.00011176573752891272, - }, - { - path: 'quiz_sampling_info/q5/114.gz', - totalP: 0.00011040732351830229, - }, - { - path: 'quiz_sampling_info/q5/115.gz', - totalP: 0.0001089806028176099, - }, - { - path: 'quiz_sampling_info/q5/116.gz', - totalP: 0.00010750948422355577, - }, - { - path: 'quiz_sampling_info/q5/117.gz', - totalP: 0.0001059841233654879, - }, - { - path: 'quiz_sampling_info/q5/118.gz', - totalP: 0.00010441015911055729, - }, - { - path: 'quiz_sampling_info/q5/119.gz', - totalP: 0.0001028495462378487, - }, - { - path: 'quiz_sampling_info/q5/120.gz', - totalP: 0.00010137914068764076, - }, - { - path: 'quiz_sampling_info/q5/121.gz', - totalP: 9.997698361985385e-05, - }, - { - path: 'quiz_sampling_info/q5/122.gz', - totalP: 9.865064930636436e-05, - }, - { - path: 'quiz_sampling_info/q5/123.gz', - totalP: 9.741337271407247e-05, - }, - { - path: 'quiz_sampling_info/q5/124.gz', - totalP: 9.62299236562103e-05, - }, - { - path: 'quiz_sampling_info/q5/125.gz', - totalP: 9.50491230469197e-05, - }, - { - path: 'quiz_sampling_info/q5/126.gz', - totalP: 9.379146649735048e-05, - }, - { - path: 'quiz_sampling_info/q5/127.gz', - totalP: 9.23351472010836e-05, - }, - { - path: 'quiz_sampling_info/q5/128.gz', - totalP: 9.050010703504086e-05, - }, - { - path: 'quiz_sampling_info/q5/129.gz', - totalP: 8.813266322249547e-05, - }, - { - path: 'quiz_sampling_info/q5/130.gz', - totalP: 8.587531192461029e-05, - }, - { - path: 'quiz_sampling_info/q5/131.gz', - totalP: 8.346755930688232e-05, - }, - { - path: 'quiz_sampling_info/q5/132.gz', - totalP: 8.079258259385824e-05, - }, - { - path: 'quiz_sampling_info/q5/133.gz', - totalP: 7.504474342567846e-05, - }, - { - path: 'quiz_sampling_info/q5/134.gz', - totalP: 4.6936984290368855e-05, - }, - { - path: 'quiz_sampling_info/q5/135.gz', - totalP: 9.601603778719436e-06, + totalP: 0.05640159174799919, }, ], ], - juxtaVersion: 0, + juxtaVersion: 1, } as const diff --git a/react/src/quiz/infinite.tsx b/react/src/quiz/infinite.tsx index 1727d4332..d603921fd 100644 --- a/react/src/quiz/infinite.tsx +++ b/react/src/quiz/infinite.tsx @@ -28,11 +28,11 @@ function sampleChunk(rng: seedrandom.PRNG, chunks: QuizQuestionChunks): string { throw new Error('Invalid chunk distribution') } -function sampleTroncheIndex(rng: seedrandom.PRNG, negLogProbX100: number[]): number { +function sampleTroncheIndex(rng: seedrandom.PRNG, negLogProbX10: number[]): number { const probeP = rng() let totalP = 0 - for (let i = 0; i < negLogProbX100.length; i++) { - totalP += Math.exp(-negLogProbX100[i] / 100) + for (let i = 0; i < negLogProbX10.length; i++) { + totalP += Math.exp(-negLogProbX10[i] / 10) if (probeP < totalP) { return i } @@ -57,7 +57,7 @@ export async function sampleRandomQuestion(seed: string, index: number): Promise const chunk = sampleChunk(rng, chunks satisfies QuizQuestionChunks) const tronche = await loadProtobuf(chunk, 'QuizQuestionTronche') const data = await loadQuizSamplingData() - const troncheIdx = sampleTroncheIndex(rng, tronche.negLogProbX100) + const troncheIdx = sampleTroncheIndex(rng, tronche.negLogProbX10MinusBasis.map(x => x + tronche.negLogProbX10Basis)) let geoA = tronche.geographyA[troncheIdx] let geoB = tronche.geographyB[troncheIdx] if (rng() < 0.5) { diff --git a/react/src/utils/protos.d.ts b/react/src/utils/protos.d.ts index 83451608d..9e3cba385 100644 --- a/react/src/utils/protos.d.ts +++ b/react/src/utils/protos.d.ts @@ -2529,8 +2529,11 @@ export interface IQuizQuestionTronche { /** QuizQuestionTronche stat */ stat?: (number[]|null); - /** QuizQuestionTronche negLogProbX100 */ - negLogProbX100?: (number[]|null); + /** QuizQuestionTronche negLogProbX10Basis */ + negLogProbX10Basis?: (number|null); + + /** QuizQuestionTronche negLogProbX10MinusBasis */ + negLogProbX10MinusBasis?: (number[]|null); } /** Represents a QuizQuestionTronche. */ @@ -2551,8 +2554,11 @@ export class QuizQuestionTronche implements IQuizQuestionTronche { /** QuizQuestionTronche stat. */ public stat: number[]; - /** QuizQuestionTronche negLogProbX100. */ - public negLogProbX100: number[]; + /** QuizQuestionTronche negLogProbX10Basis. */ + public negLogProbX10Basis: number; + + /** QuizQuestionTronche negLogProbX10MinusBasis. */ + public negLogProbX10MinusBasis: number[]; /** * Creates a new QuizQuestionTronche instance using the specified properties. diff --git a/react/src/utils/protos.js b/react/src/utils/protos.js index f2939919d..ce6a2ceaf 100644 --- a/react/src/utils/protos.js +++ b/react/src/utils/protos.js @@ -6352,7 +6352,8 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { * @property {Array.|null} [geographyA] QuizQuestionTronche geographyA * @property {Array.|null} [geographyB] QuizQuestionTronche geographyB * @property {Array.|null} [stat] QuizQuestionTronche stat - * @property {Array.|null} [negLogProbX100] QuizQuestionTronche negLogProbX100 + * @property {number|null} [negLogProbX10Basis] QuizQuestionTronche negLogProbX10Basis + * @property {Array.|null} [negLogProbX10MinusBasis] QuizQuestionTronche negLogProbX10MinusBasis */ /** @@ -6367,7 +6368,7 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { this.geographyA = []; this.geographyB = []; this.stat = []; - this.negLogProbX100 = []; + this.negLogProbX10MinusBasis = []; if (properties) for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6399,12 +6400,20 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { QuizQuestionTronche.prototype.stat = $util.emptyArray; /** - * QuizQuestionTronche negLogProbX100. - * @member {Array.} negLogProbX100 + * QuizQuestionTronche negLogProbX10Basis. + * @member {number} negLogProbX10Basis * @memberof QuizQuestionTronche * @instance */ - QuizQuestionTronche.prototype.negLogProbX100 = $util.emptyArray; + QuizQuestionTronche.prototype.negLogProbX10Basis = 0; + + /** + * QuizQuestionTronche negLogProbX10MinusBasis. + * @member {Array.} negLogProbX10MinusBasis + * @memberof QuizQuestionTronche + * @instance + */ + QuizQuestionTronche.prototype.negLogProbX10MinusBasis = $util.emptyArray; /** * Creates a new QuizQuestionTronche instance using the specified properties. @@ -6448,10 +6457,12 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { writer.int32(message.stat[i]); writer.ldelim(); } - if (message.negLogProbX100 != null && message.negLogProbX100.length) { - writer.uint32(/* id 4, wireType 2 =*/34).fork(); - for (let i = 0; i < message.negLogProbX100.length; ++i) - writer.int32(message.negLogProbX100[i]); + if (message.negLogProbX10Basis != null && Object.hasOwnProperty.call(message, "negLogProbX10Basis")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.negLogProbX10Basis); + if (message.negLogProbX10MinusBasis != null && message.negLogProbX10MinusBasis.length) { + writer.uint32(/* id 5, wireType 2 =*/42).fork(); + for (let i = 0; i < message.negLogProbX10MinusBasis.length; ++i) + writer.int32(message.negLogProbX10MinusBasis[i]); writer.ldelim(); } return writer; @@ -6522,14 +6533,18 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { break; } case 4: { - if (!(message.negLogProbX100 && message.negLogProbX100.length)) - message.negLogProbX100 = []; + message.negLogProbX10Basis = reader.int32(); + break; + } + case 5: { + if (!(message.negLogProbX10MinusBasis && message.negLogProbX10MinusBasis.length)) + message.negLogProbX10MinusBasis = []; if ((tag & 7) === 2) { let end2 = reader.uint32() + reader.pos; while (reader.pos < end2) - message.negLogProbX100.push(reader.int32()); + message.negLogProbX10MinusBasis.push(reader.int32()); } else - message.negLogProbX100.push(reader.int32()); + message.negLogProbX10MinusBasis.push(reader.int32()); break; } default: @@ -6588,12 +6603,15 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { if (!$util.isInteger(message.stat[i])) return "stat: integer[] expected"; } - if (message.negLogProbX100 != null && message.hasOwnProperty("negLogProbX100")) { - if (!Array.isArray(message.negLogProbX100)) - return "negLogProbX100: array expected"; - for (let i = 0; i < message.negLogProbX100.length; ++i) - if (!$util.isInteger(message.negLogProbX100[i])) - return "negLogProbX100: integer[] expected"; + if (message.negLogProbX10Basis != null && message.hasOwnProperty("negLogProbX10Basis")) + if (!$util.isInteger(message.negLogProbX10Basis)) + return "negLogProbX10Basis: integer expected"; + if (message.negLogProbX10MinusBasis != null && message.hasOwnProperty("negLogProbX10MinusBasis")) { + if (!Array.isArray(message.negLogProbX10MinusBasis)) + return "negLogProbX10MinusBasis: array expected"; + for (let i = 0; i < message.negLogProbX10MinusBasis.length; ++i) + if (!$util.isInteger(message.negLogProbX10MinusBasis[i])) + return "negLogProbX10MinusBasis: integer[] expected"; } return null; }; @@ -6631,12 +6649,14 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { for (let i = 0; i < object.stat.length; ++i) message.stat[i] = object.stat[i] | 0; } - if (object.negLogProbX100) { - if (!Array.isArray(object.negLogProbX100)) - throw TypeError(".QuizQuestionTronche.negLogProbX100: array expected"); - message.negLogProbX100 = []; - for (let i = 0; i < object.negLogProbX100.length; ++i) - message.negLogProbX100[i] = object.negLogProbX100[i] | 0; + if (object.negLogProbX10Basis != null) + message.negLogProbX10Basis = object.negLogProbX10Basis | 0; + if (object.negLogProbX10MinusBasis) { + if (!Array.isArray(object.negLogProbX10MinusBasis)) + throw TypeError(".QuizQuestionTronche.negLogProbX10MinusBasis: array expected"); + message.negLogProbX10MinusBasis = []; + for (let i = 0; i < object.negLogProbX10MinusBasis.length; ++i) + message.negLogProbX10MinusBasis[i] = object.negLogProbX10MinusBasis[i] | 0; } return message; }; @@ -6658,8 +6678,10 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { object.geographyA = []; object.geographyB = []; object.stat = []; - object.negLogProbX100 = []; + object.negLogProbX10MinusBasis = []; } + if (options.defaults) + object.negLogProbX10Basis = 0; if (message.geographyA && message.geographyA.length) { object.geographyA = []; for (let j = 0; j < message.geographyA.length; ++j) @@ -6675,10 +6697,12 @@ export const QuizQuestionTronche = $root.QuizQuestionTronche = (() => { for (let j = 0; j < message.stat.length; ++j) object.stat[j] = message.stat[j]; } - if (message.negLogProbX100 && message.negLogProbX100.length) { - object.negLogProbX100 = []; - for (let j = 0; j < message.negLogProbX100.length; ++j) - object.negLogProbX100[j] = message.negLogProbX100[j]; + if (message.negLogProbX10Basis != null && message.hasOwnProperty("negLogProbX10Basis")) + object.negLogProbX10Basis = message.negLogProbX10Basis; + if (message.negLogProbX10MinusBasis && message.negLogProbX10MinusBasis.length) { + object.negLogProbX10MinusBasis = []; + for (let j = 0; j < message.negLogProbX10MinusBasis.length; ++j) + object.negLogProbX10MinusBasis[j] = message.negLogProbX10MinusBasis[j]; } return object; }; diff --git a/react/test/quiz_infinite_test.ts b/react/test/quiz_infinite_test.ts index 116d87b15..c3df17a7a 100644 --- a/react/test/quiz_infinite_test.ts +++ b/react/test/quiz_infinite_test.ts @@ -61,7 +61,7 @@ async function completeCorrectAnswerSequence(t: TestController, alreadyKnownAnsw return correctAnswers } -const param = '#mode=infinite&seed=deadbeef00&v=0' +const param = '#mode=infinite&seed=deadbeef00&v=1' urbanstatsFixture('generate link', `${target}/quiz.html${param}`) let correctAnswerSequence: string[] diff --git a/urbanstats/games/infinite/data.py b/urbanstats/games/infinite/data.py index d4cd4f0ed..f09fdd15c 100644 --- a/urbanstats/games/infinite/data.py +++ b/urbanstats/games/infinite/data.py @@ -22,18 +22,20 @@ def output_tronche(tronche_vqq, tronche_p, tronche_path): tronche_total_p = tronche_p.sum() tronche_p = tronche_p / tronche_total_p - binned_probs = -(np.log(tronche_p) / 0.01).round().astype(np.int64) + binned_probs = -(np.log(tronche_p) / 0.1).round().astype(np.int64) tronche_proto = data_files_pb2.QuizQuestionTronche() tronche_proto.geography_a.extend(tronche_vqq.geography_index_a) tronche_proto.geography_b.extend(tronche_vqq.geography_index_b) tronche_proto.stat.extend(tronche_vqq.stat_indices) - tronche_proto.neg_log_prob_x100.extend(binned_probs) + tronche_proto.neg_log_prob_x10_basis = int(binned_probs.min()) + tronche_proto.neg_log_prob_x10_minus_basis.extend(binned_probs - binned_probs.min()) write_gzip(tronche_proto, tronche_path) return tronche_total_p def output_quiz_question(q, p, site_folder, question_folder): - idxs = np.argsort(-p) + idxs = compute_order(q) + tronche_descriptors = [] for idx, start in tqdm.tqdm( list(enumerate(range(0, p.shape[0], tronche_size))), @@ -64,9 +66,34 @@ def output_quiz_sampling_data(site_folder, subfolder): write_gzip(qfd, os.path.join(site_folder, subfolder, "data.gz")) +def filter_for_prob_over_threshold(q, p, *, threshold): + sorted_p = np.sort(p[:]) + [[idx, *_]] = np.where(np.cumsum(sorted_p) > threshold) + thresh = sorted_p[idx] + mask = p >= thresh + q, p = q[mask], p[mask].copy() + p /= p.sum() + return q, p + + +def compute_order(q): + sort_keys = ( + q.stat_indices, + q.geography_index_a, + q.geography_index_b, + ) + basis = 1 + order_value = 0 + for key in sort_keys[::-1]: + order_value += basis * key + basis *= key.max() + 1 + idxs = np.argsort(order_value) + return idxs + + def output_quiz_sampling_probabilities(site_folder, subfolder): ps, qqp = quiz_data() - hash_value = stable_hash((ps, qqp)) + hash_value = stable_hash((ps, qqp, "v1")) info = get_juxta_version_info() if hash_value not in dict(get_juxta_version_info()): info.append((hash_value, len(info))) @@ -75,6 +102,7 @@ def output_quiz_sampling_probabilities(site_folder, subfolder): juxta_version = dict(info)[hash_value] descriptors = [] for i, (q, p) in enumerate(zip(qqp.questions_by_number, ps), start=1): + q, p = filter_for_prob_over_threshold(q, p, threshold=0.05) descriptors.append( output_quiz_question(q, p, site_folder, os.path.join(subfolder, f"q{i}")) ) diff --git a/urbanstats/protobuf/data_files_pb2.py b/urbanstats/protobuf/data_files_pb2.py index daa31c3f7..ec844235c 100644 --- a/urbanstats/protobuf/data_files_pb2.py +++ b/urbanstats/protobuf/data_files_pb2.py @@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x10\x64\x61ta_files.proto"j\n\x0cStatisticRow\x12\x0f\n\x07statval\x18\x01 \x01(\x02\x12\x1b\n\x13ordinal_by_universe\x18\x02 \x03(\x05\x12,\n$percentile_by_population_by_universe\x18\x04 \x03(\x05"W\n\x0b\x46irstOrLast\x12\x17\n\x0f\x61rticle_row_idx\x18\x01 \x01(\x05\x12\x1d\n\x15\x61rticle_universes_idx\x18\x02 \x01(\x05\x12\x10\n\x08is_first\x18\x03 \x01(\x08"F\n\rRelatedButton\x12\x10\n\x08longname\x18\x01 \x01(\t\x12\x11\n\tshortname\x18\x02 \x01(\t\x12\x10\n\x08row_type\x18\x03 \x01(\t"L\n\x0eRelatedButtons\x12\x19\n\x11relationship_type\x18\x01 \x01(\t\x12\x1f\n\x07\x62uttons\x18\x02 \x03(\x0b\x32\x0e.RelatedButton">\n\tHistogram\x12\x0f\n\x07\x62in_min\x18\x01 \x01(\x02\x12\x10\n\x08\x62in_size\x18\x02 \x01(\x02\x12\x0e\n\x06\x63ounts\x18\x03 \x03(\x05"\x1c\n\nTimeSeries\x12\x0e\n\x06values\x18\x01 \x03(\x02"w\n\x0e\x45xtraStatistic\x12"\n\thistogram\x18\x01 \x01(\x0b\x32\n.HistogramH\x00\x88\x01\x01\x12$\n\ntimeseries\x18\x02 \x01(\x0b\x32\x0b.TimeSeriesH\x01\x88\x01\x01\x42\x0c\n\n_histogramB\r\n\x0b_timeseries"\x9b\x02\n\x07\x41rticle\x12\x11\n\tshortname\x18\x01 \x01(\t\x12\x10\n\x08longname\x18\x02 \x01(\t\x12\x0e\n\x06source\x18\x03 \x01(\t\x12\x14\n\x0c\x61rticle_type\x18\x04 \x01(\t\x12 \n\x18statistic_indices_packed\x18\t \x01(\x0c\x12\x1b\n\x04rows\x18\x05 \x03(\x0b\x32\r.StatisticRow\x12+\n\x15overall_first_or_last\x18\n \x03(\x0b\x32\x0c.FirstOrLast\x12 \n\x07related\x18\x06 \x03(\x0b\x32\x0f.RelatedButtons\x12\x11\n\tuniverses\x18\x07 \x03(\t\x12$\n\x0b\x65xtra_stats\x18\x08 \x03(\x0b\x32\x0f.ExtraStatistic"&\n\nCoordinate\x12\x0b\n\x03lon\x18\x01 \x01(\x02\x12\x0b\n\x03lat\x18\x02 \x01(\x02"#\n\x04Ring\x12\x1b\n\x06\x63oords\x18\x01 \x03(\x0b\x32\x0b.Coordinate"\x1f\n\x07Polygon\x12\x14\n\x05rings\x18\x01 \x03(\x0b\x32\x05.Ring"*\n\x0cMultiPolygon\x12\x1a\n\x08polygons\x18\x01 \x03(\x0b\x32\x08.Polygon"|\n\x07\x46\x65\x61ture\x12\x1b\n\x07polygon\x18\x01 \x01(\x0b\x32\x08.PolygonH\x00\x12%\n\x0cmultipolygon\x18\x02 \x01(\x0b\x32\r.MultiPolygonH\x00\x12\r\n\x05zones\x18\x03 \x03(\x05\x12\x12\n\ncenter_lon\x18\x04 \x01(\x02\x42\n\n\x08geometry"\x1e\n\nStringList\x12\x10\n\x08\x65lements\x18\x01 \x03(\t"3\n\x0bSearchIndex\x12\x10\n\x08\x65lements\x18\x01 \x03(\t\x12\x12\n\npriorities\x18\x02 \x03(\r"\x1f\n\tOrderList\x12\x12\n\norder_idxs\x18\x01 \x03(\x05"8\n\x08\x44\x61taList\x12\r\n\x05value\x18\x01 \x03(\x02\x12\x1d\n\x15population_percentile\x18\x02 \x03(\x05"@\n\nOrderLists\x12\x11\n\tstatnames\x18\x01 \x03(\t\x12\x1f\n\x0border_lists\x18\x02 \x03(\x0b\x32\n.OrderList"=\n\tDataLists\x12\x11\n\tstatnames\x18\x01 \x03(\t\x12\x1d\n\ndata_lists\x18\x02 \x03(\x0b\x32\t.DataList"\x19\n\x08\x41llStats\x12\r\n\x05stats\x18\x01 \x03(\x02"A\n\x12\x43onsolidatedShapes\x12\x11\n\tlongnames\x18\x01 \x03(\t\x12\x18\n\x06shapes\x18\x02 \x03(\x0b\x32\x08.Feature"Y\n\x16\x43onsolidatedStatistics\x12\x11\n\tlongnames\x18\x01 \x03(\t\x12\x12\n\nshortnames\x18\x02 \x03(\t\x12\x18\n\x05stats\x18\x03 \x03(\x0b\x32\t.AllStats" \n\x0fQuizDataForStat\x12\r\n\x05stats\x18\x01 \x03(\x02"/\n\x0cQuizFullData\x12\x1f\n\x05stats\x18\x01 \x03(\x0b\x32\x10.QuizDataForStat"h\n\x13QuizQuestionTronche\x12\x13\n\x0bgeography_a\x18\x01 \x03(\x05\x12\x13\n\x0bgeography_b\x18\x02 \x03(\x05\x12\x0c\n\x04stat\x18\x03 \x03(\x05\x12\x19\n\x11neg_log_prob_x100\x18\x04 \x03(\x05\x62\x06proto3' + b'\n\x10\x64\x61ta_files.proto"j\n\x0cStatisticRow\x12\x0f\n\x07statval\x18\x01 \x01(\x02\x12\x1b\n\x13ordinal_by_universe\x18\x02 \x03(\x05\x12,\n$percentile_by_population_by_universe\x18\x04 \x03(\x05"W\n\x0b\x46irstOrLast\x12\x17\n\x0f\x61rticle_row_idx\x18\x01 \x01(\x05\x12\x1d\n\x15\x61rticle_universes_idx\x18\x02 \x01(\x05\x12\x10\n\x08is_first\x18\x03 \x01(\x08"F\n\rRelatedButton\x12\x10\n\x08longname\x18\x01 \x01(\t\x12\x11\n\tshortname\x18\x02 \x01(\t\x12\x10\n\x08row_type\x18\x03 \x01(\t"L\n\x0eRelatedButtons\x12\x19\n\x11relationship_type\x18\x01 \x01(\t\x12\x1f\n\x07\x62uttons\x18\x02 \x03(\x0b\x32\x0e.RelatedButton">\n\tHistogram\x12\x0f\n\x07\x62in_min\x18\x01 \x01(\x02\x12\x10\n\x08\x62in_size\x18\x02 \x01(\x02\x12\x0e\n\x06\x63ounts\x18\x03 \x03(\x05"\x1c\n\nTimeSeries\x12\x0e\n\x06values\x18\x01 \x03(\x02"w\n\x0e\x45xtraStatistic\x12"\n\thistogram\x18\x01 \x01(\x0b\x32\n.HistogramH\x00\x88\x01\x01\x12$\n\ntimeseries\x18\x02 \x01(\x0b\x32\x0b.TimeSeriesH\x01\x88\x01\x01\x42\x0c\n\n_histogramB\r\n\x0b_timeseries"\x9b\x02\n\x07\x41rticle\x12\x11\n\tshortname\x18\x01 \x01(\t\x12\x10\n\x08longname\x18\x02 \x01(\t\x12\x0e\n\x06source\x18\x03 \x01(\t\x12\x14\n\x0c\x61rticle_type\x18\x04 \x01(\t\x12 \n\x18statistic_indices_packed\x18\t \x01(\x0c\x12\x1b\n\x04rows\x18\x05 \x03(\x0b\x32\r.StatisticRow\x12+\n\x15overall_first_or_last\x18\n \x03(\x0b\x32\x0c.FirstOrLast\x12 \n\x07related\x18\x06 \x03(\x0b\x32\x0f.RelatedButtons\x12\x11\n\tuniverses\x18\x07 \x03(\t\x12$\n\x0b\x65xtra_stats\x18\x08 \x03(\x0b\x32\x0f.ExtraStatistic"&\n\nCoordinate\x12\x0b\n\x03lon\x18\x01 \x01(\x02\x12\x0b\n\x03lat\x18\x02 \x01(\x02"#\n\x04Ring\x12\x1b\n\x06\x63oords\x18\x01 \x03(\x0b\x32\x0b.Coordinate"\x1f\n\x07Polygon\x12\x14\n\x05rings\x18\x01 \x03(\x0b\x32\x05.Ring"*\n\x0cMultiPolygon\x12\x1a\n\x08polygons\x18\x01 \x03(\x0b\x32\x08.Polygon"|\n\x07\x46\x65\x61ture\x12\x1b\n\x07polygon\x18\x01 \x01(\x0b\x32\x08.PolygonH\x00\x12%\n\x0cmultipolygon\x18\x02 \x01(\x0b\x32\r.MultiPolygonH\x00\x12\r\n\x05zones\x18\x03 \x03(\x05\x12\x12\n\ncenter_lon\x18\x04 \x01(\x02\x42\n\n\x08geometry"\x1e\n\nStringList\x12\x10\n\x08\x65lements\x18\x01 \x03(\t"3\n\x0bSearchIndex\x12\x10\n\x08\x65lements\x18\x01 \x03(\t\x12\x12\n\npriorities\x18\x02 \x03(\r"\x1f\n\tOrderList\x12\x12\n\norder_idxs\x18\x01 \x03(\x05"8\n\x08\x44\x61taList\x12\r\n\x05value\x18\x01 \x03(\x02\x12\x1d\n\x15population_percentile\x18\x02 \x03(\x05"@\n\nOrderLists\x12\x11\n\tstatnames\x18\x01 \x03(\t\x12\x1f\n\x0border_lists\x18\x02 \x03(\x0b\x32\n.OrderList"=\n\tDataLists\x12\x11\n\tstatnames\x18\x01 \x03(\t\x12\x1d\n\ndata_lists\x18\x02 \x03(\x0b\x32\t.DataList"\x19\n\x08\x41llStats\x12\r\n\x05stats\x18\x01 \x03(\x02"A\n\x12\x43onsolidatedShapes\x12\x11\n\tlongnames\x18\x01 \x03(\t\x12\x18\n\x06shapes\x18\x02 \x03(\x0b\x32\x08.Feature"Y\n\x16\x43onsolidatedStatistics\x12\x11\n\tlongnames\x18\x01 \x03(\t\x12\x12\n\nshortnames\x18\x02 \x03(\t\x12\x18\n\x05stats\x18\x03 \x03(\x0b\x32\t.AllStats" \n\x0fQuizDataForStat\x12\r\n\x05stats\x18\x01 \x03(\x02"/\n\x0cQuizFullData\x12\x1f\n\x05stats\x18\x01 \x03(\x0b\x32\x10.QuizDataForStat"\x93\x01\n\x13QuizQuestionTronche\x12\x13\n\x0bgeography_a\x18\x01 \x03(\x05\x12\x13\n\x0bgeography_b\x18\x02 \x03(\x05\x12\x0c\n\x04stat\x18\x03 \x03(\x05\x12\x1e\n\x16neg_log_prob_x10_basis\x18\x04 \x01(\x05\x12$\n\x1cneg_log_prob_x10_minus_basis\x18\x05 \x03(\x05\x62\x06proto3' ) _globals = globals() @@ -76,6 +76,6 @@ _globals["_QUIZDATAFORSTAT"]._serialized_end = 1670 _globals["_QUIZFULLDATA"]._serialized_start = 1672 _globals["_QUIZFULLDATA"]._serialized_end = 1719 - _globals["_QUIZQUESTIONTRONCHE"]._serialized_start = 1721 - _globals["_QUIZQUESTIONTRONCHE"]._serialized_end = 1825 + _globals["_QUIZQUESTIONTRONCHE"]._serialized_start = 1722 + _globals["_QUIZQUESTIONTRONCHE"]._serialized_end = 1869 # @@protoc_insertion_point(module_scope) diff --git a/urbanstats/protobuf/data_files_pb2.pyi b/urbanstats/protobuf/data_files_pb2.pyi index 5e99d6b79..723e72529 100644 --- a/urbanstats/protobuf/data_files_pb2.pyi +++ b/urbanstats/protobuf/data_files_pb2.pyi @@ -314,19 +314,28 @@ class QuizFullData(_message.Message): ) -> None: ... class QuizQuestionTronche(_message.Message): - __slots__ = ("geography_a", "geography_b", "stat", "neg_log_prob_x100") + __slots__ = ( + "geography_a", + "geography_b", + "stat", + "neg_log_prob_x10_basis", + "neg_log_prob_x10_minus_basis", + ) GEOGRAPHY_A_FIELD_NUMBER: _ClassVar[int] GEOGRAPHY_B_FIELD_NUMBER: _ClassVar[int] STAT_FIELD_NUMBER: _ClassVar[int] - NEG_LOG_PROB_X100_FIELD_NUMBER: _ClassVar[int] + NEG_LOG_PROB_X10_BASIS_FIELD_NUMBER: _ClassVar[int] + NEG_LOG_PROB_X10_MINUS_BASIS_FIELD_NUMBER: _ClassVar[int] geography_a: _containers.RepeatedScalarFieldContainer[int] geography_b: _containers.RepeatedScalarFieldContainer[int] stat: _containers.RepeatedScalarFieldContainer[int] - neg_log_prob_x100: _containers.RepeatedScalarFieldContainer[int] + neg_log_prob_x10_basis: int + neg_log_prob_x10_minus_basis: _containers.RepeatedScalarFieldContainer[int] def __init__( self, geography_a: _Optional[_Iterable[int]] = ..., geography_b: _Optional[_Iterable[int]] = ..., stat: _Optional[_Iterable[int]] = ..., - neg_log_prob_x100: _Optional[_Iterable[int]] = ..., + neg_log_prob_x10_basis: _Optional[int] = ..., + neg_log_prob_x10_minus_basis: _Optional[_Iterable[int]] = ..., ) -> None: ... diff --git a/urbanstats/protobuf/data_files_pb2_hash.py b/urbanstats/protobuf/data_files_pb2_hash.py index b5ced067b..071df9fd5 100644 --- a/urbanstats/protobuf/data_files_pb2_hash.py +++ b/urbanstats/protobuf/data_files_pb2_hash.py @@ -1 +1 @@ -proto_hash = "a9b49aaa1c4ff3ffa6a8784dc2272a2e4bccc754a8ed16276a5d70dc581346f4" +proto_hash = "59317a7af13a6889fe40620d5eaa68f887b905220a92ec6f679024dec8f40138" diff --git a/urbanstats/protobuf/utils.py b/urbanstats/protobuf/utils.py index 6b49296a7..fcb34e3d3 100644 --- a/urbanstats/protobuf/utils.py +++ b/urbanstats/protobuf/utils.py @@ -26,11 +26,15 @@ def save_ordered_list(ordered_list, path): write_gzip(res, path) -def write_gzip(proto, path): +def ensure_writeable(path): folder = os.path.dirname(path) try: os.makedirs(folder) except FileExistsError: pass + + +def write_gzip(proto, path): + ensure_writeable(path) with gzip.GzipFile(path, "wb", mtime=0) as f: f.write(proto.SerializeToString())