Base rate spading tool

This forum describes how to spade various things in the game. Go here to find helpful tips and tricks.

Base rate spading tool

Postby starwed » Mon Sep 19, 2011 1:38 am

After a conversation in AFHk clan, I finally got around to doing something I meant to do long ago -- coding up a tool to find the base drop rates of items, given a diverse set of observations.

The idea is that, for non-conditional items, we know that the drop rate is an integer. So we could just, by brute force, calculate the chance that a particular set of observations would occur given a particular base rate. Normalised, that translates into a % belief that the particular drop rate is the real one. (Since in the end everything is normalised, that means we just need to calculate something proportional to the probability, which is what the code actually does.)

>>Here is the tool.<<
>(Multi-drop version) <


You enter the data with one row for each set of observations at a particular +item find, in the format Drops Trials +Item. There's an example at the bottom of the page to hopefully make usage clear.

I've tried to check it to make sure the code is correct, but it would be awesome if people tried to find data that breaks the analysis. If it passes, it might be helpful in spading the base rates of items.
Attachments
superbayes.js
Main fail for multidrop
(4.25 KiB) Downloaded 188 times
CalculateBayes.js
Calculation for multidrop (called from webworker)
(6.89 KiB) Downloaded 173 times
bayes.js
Original script
(4.33 KiB) Downloaded 167 times
Last edited by starwed on Tue Aug 13, 2013 12:49 am, edited 4 times in total.
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby top1214 » Mon Sep 19, 2011 1:45 pm

Woo!

I'm breaking it with actual data! 17 wine-soaked bone chips from 108 skeletal sommeliers at +185% item drop. 17 will calculate for observations <100.

It looks like trials >100 is malformed data.
IGN: whore_moans
top1214
 
Posts: 336
Joined: Wed Mar 31, 2010 2:21 pm

Re: Base rate spading tool

Postby starwed » Mon Sep 19, 2011 2:03 pm

Heh, fixed. (Although I had to force refresh the page to load the new .js file.)

( I committed one of the classic js blunders -- after parsing the input, each value was still of type string. Since js autocasts, that mostly didn't matter. But when doing a sanity check to see if drops <= trials, it was comparing the strings alphabetically.)
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby clopedion » Mon Sep 19, 2011 4:00 pm

That's pretty neat!

A couple of bugs I found:
-- if your drop rate bonus is 0, it rejects the line as being malformed.
-- (Edit: Oops, I misunderstood the code the first time.)
The current version calculates that the droprate must be 100 based on the data
1 1 1
I think this has to do with setting max_ob=count/size; if you set max_ob=(count+1)/(size+2), this works fine.
clopedion
 
Posts: 43
Joined: Thu Nov 04, 2010 2:19 pm

Re: Base rate spading tool

Postby starwed » Mon Sep 19, 2011 5:43 pm

Ok, both issues fixed, I think. Although I did notice it will barf on blank lines, including an empty one after otherwise fine data, I'll fix that some time when I'm feeling more energetic...

(I fixed the second with a slightly different sort of hack than you did, by just special casing count==size. I think that whole section can be written more cleanly -- I was trying to reduce the chance of overflow, but I think the eventual solution I found means a lot of it is unnecessary.)
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby top1214 » Mon Sep 19, 2011 5:53 pm

It doesn't like negative item drop. It just ignores the negative.

Edit:
Also, I don;t suppose there's a way to do multiple drops, right? Things like pixels (solved) and the 2 boxing gloves (unsolved) bug me.
IGN: whore_moans
top1214
 
Posts: 336
Joined: Wed Mar 31, 2010 2:21 pm

Re: Base rate spading tool

Postby starwed » Mon Sep 19, 2011 6:31 pm

I can add negative modifiers, I suppose, in case it comes up (e: done)-- though they're the least useful for spading item drop rates, of course... :)



Multiple drops should certainly be do-able, but would require a bit more code/thought, as well as a more complicated interface.
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby clopedion » Mon Sep 19, 2011 7:29 pm

Okay, that sounds good. I'm a little uneasy about when count=0, because then you're dividing by zero to get a, but I think it doesn't matter.

I think you'll occasionally still run into overflows (for instance, if you run
100 900 0
800 900 0
you'll get no results because the probabilities underflow), but that's very unnatural data. The standard thing to do to avoid overflows is to use logarithms for all the probabilities, because you only ever have to multiply probabilities, but that might be overkill for a project like this.
clopedion
 
Posts: 43
Joined: Thu Nov 04, 2010 2:19 pm

Re: Base rate spading tool

Postby starwed » Mon Sep 19, 2011 7:42 pm

The standard thing to do to avoid overflows is to use logarithms for all the probabilities, because you only ever have to multiply probabilities, but that might be overkill for a project like this.

Ah, that would simplify the math quite a bit, I think, so not really overkill at all.
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby top1214 » Mon Sep 19, 2011 7:54 pm

9 10 -100 Gives a probability of 8.25% for 100% drop rate, which we know is incorrect.

Negative drops are not malformed data!

-9 3 -4000 has interesting predictions.
IGN: whore_moans
top1214
 
Posts: 336
Joined: Wed Mar 31, 2010 2:21 pm

Re: Base rate spading tool

Postby Fred Nefler » Mon Sep 19, 2011 8:12 pm

top1214 wrote:9 10 -100 Gives a probability of 8.25% for 100% drop rate, which we know is incorrect.

Negative drops are not malformed data!

-9 3 -4000 has interesting predictions.

9 10 isn't the pattern of a 100% drop though. It'd be 10 10. 9 10 -100 is just madness.
Fred Nefler
 
Posts: 172
Joined: Wed Oct 13, 2010 12:37 am

Re: Base rate spading tool

Postby top1214 » Mon Sep 19, 2011 8:16 pm

Fred Nefler wrote:
top1214 wrote:9 10 -100 Gives a probability of 8.25% for 100% drop rate, which we know is incorrect.

Negative drops are not malformed data!

-9 3 -4000 has interesting predictions.

9 10 isn't the pattern of a 100% drop though. It'd be 10 10. 9 10 -100 is just madness.


Well, yes. But in an effort to break the analysis, don't you throw in things that are madness? And at any item drop bonus >= -100, nothing should drop, unless it's a 100% drop.
IGN: whore_moans
top1214
 
Posts: 336
Joined: Wed Mar 31, 2010 2:21 pm

Re: Base rate spading tool

Postby Fred Nefler » Mon Sep 19, 2011 8:31 pm

top1214 wrote:
Fred Nefler wrote:
top1214 wrote:9 10 -100 Gives a probability of 8.25% for 100% drop rate, which we know is incorrect.

Negative drops are not malformed data!

-9 3 -4000 has interesting predictions.

9 10 isn't the pattern of a 100% drop though. It'd be 10 10. 9 10 -100 is just madness.


Well, yes. But in an effort to break the analysis, don't you throw in things that are madness? And at any item drop bonus >= -100, nothing should drop, unless it's a 100% drop.

True. That will require special handling, of course, but I don't imagine it will take too much extra coding. What should it spit out if it's fed 9 10 -100? "Madness"?

And you mean <= -100.
Fred Nefler
 
Posts: 172
Joined: Wed Oct 13, 2010 12:37 am

Re: Base rate spading tool

Postby starwed » Mon Sep 19, 2011 10:06 pm

Ok, I rewrote the analysis code to use logs -- it now handles clopedion's pathological data properly. AFICT all the results I've checked are consistent with the previous method, so hopefully I didn't muck anything up here.

I also added better checking of the input, to make sure purely nonsensical data isn't allowed. :) Hopefully it still lets through all valid data...
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby lostcalpolydude » Tue Sep 20, 2011 9:59 am

Moved this to a more appropriate forum. Unless we're spading how well the tool works.
lostcalpolydude
 
Posts: 135
Joined: Thu Mar 25, 2010 2:49 am

Re: Base rate spading tool

Postby starwed » Mon Sep 26, 2011 10:44 pm

So, I have now created a version that'll work with n copies of the same item. As before, it brute forces all possible combinations of base rates. Only now instead of 100, it's more like 100^n.

>> Here is the tool.

Rather than trying to parse stuff nicely, it wants the input as a JSON object, and does no sanity checking on the input. It'll take a little while to run for 3 duplicate drops -- theoretically the code will work for any value of n, but I imagine it would take a really long time.

A 'sparse' analysis only considers base drop rates of 1-10 or multiples of 5, to speed things up a bit.

I wrote the base code in CoffeeScript rather than js, since the CS compiler is better at writing optimal code than me. (Indeed, there was a noticeable speed up when I switched languages.)

I tested with the sum of all Yiab's pixel drop data, and it indeed preferred 80/70/60 using the sparse analysis, just as Hellion's method obtained.
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby Fred Nefler » Tue Sep 27, 2011 3:34 am

So by "1 pixel dropped" does the tool want "exactly 1 pixel dropped" or "1 or more pixels dropped"? Yiab used the latter (and that's what his 8-bit data uses), and I use the former (when listing data on wiki talk pages).
Fred Nefler
 
Posts: 172
Joined: Wed Oct 13, 2010 12:37 am

Re: Base rate spading tool

Postby starwed » Tue Sep 27, 2011 4:40 am

Fred Nefler wrote:So by "1 pixel dropped" does the tool want "exactly 1 pixel dropped" or "1 or more pixels dropped"? Yiab used the latter (and that's what his 8-bit data uses), and I use the former (when listing data on wiki talk pages).

The counts are the exact number of times that X pixels were observed to drop. (So, not like Yiab.) You can compare the example data at the bottom of the page to Yiab's white pixel data -- accounting for the different formats they should be the same.

The total of all identical pixel data for Yiab, in my format, is:
Code: Select all
YiabData =  [   
      {counts: [6, 51, 337, 541], boost: 20},
      {counts: [0, 2, 38, 179],    boost: 40},
      {counts: [0, 0, 6, 105],    boost: 50},
      {counts: [1, 48, 332, 606], boost: 20},
      {counts: [0, 0, 35, 160], boost: 40},
      {counts: [0,0,7,115], boost: 50   },
      {counts: [2, 45, 354, 536], boost: 20},
      {counts: [0, 0, 27, 192], boost: 40},
      {counts: [0, 0, 12, 105], boost: 50},
      {counts: [0, 41, 355, 567], boost: 20},
      {counts: [0, 1, 31, 184], boost: 40},
      {counts: [0, 0, 8, 107], boost: 50} ]

(You could totally optimize this by combining sets with the same item boost.)

If anyone actually plans on using this tool, and the format isn't convenient, just let me know how you want it parsed and I'll see what I can do. Or grab the source and edit it yourself, of course! :) Coffeescript was kind of fun to learn.
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby top1214 » Sat Jan 12, 2013 10:53 pm

starwed wrote:After a conversation in AFHk clan, I finally got around to doing something I meant to do long ago -- coding up a tool to find the base drop rates of items, given a diverse set of observations.

The idea is that, for non-conditional items, we know that the drop rate is an integer. So we could just, by brute force, calculate the chance that a particular set of observations would occur given a particular base rate. Normalised, that translates into a % belief that the particular drop rate is the real one. (Since in the end everything is normalised, that means we just need to calculate something proportional to the probability, which is what the code actually does.)

>>Here is the tool.<<
>(Multi-drop version) <


You enter the data with one row for each set of observations at a particular +item find, in the format Drops Trials +Item. There's an example at the bottom of the page to hopefully make usage clear.

I've tried to check it to make sure the code is correct, but it would be awesome if people tried to find data that breaks the analysis. If it passes, it might be helpful in spading the base rates of items.

It looks like these have recently gone away :(
IGN: whore_moans
top1214
 
Posts: 336
Joined: Wed Mar 31, 2010 2:21 pm

Re: Base rate spading tool

Postby starwed » Tue Aug 13, 2013 12:45 am

top1214 wrote:It looks like these have recently gone away :(


Here's the multidrop tool. Hosted on github this time, instead of my university account that, of course, eventually gets shut off after you graduate...
User avatar
starwed
 
Posts: 212
Joined: Sat May 22, 2010 6:29 pm

Re: Base rate spading tool

Postby Travethan » Wed Jul 05, 2017 8:08 am

Thanks for the tool!
Travethan
 
Posts: 1
Joined: Thu Jun 29, 2017 11:22 am


Return to The Spade's Textbook: How to Spade

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Install phpBB web hosting