Finding your ideal team, with math? (Destiny)

by ckamp, Friday, February 13, 2015, 18:39 (3820 days ago)
edited by ckamp, Friday, February 13, 2015, 18:56

So I was playing with Beardfade the other day and he had the idea to use Destiny's API to create a site/app or something that could compare your crucible performance as you played with various teammates. The end result would be a way to help you find your ideal teammate.

Great idea. But it has some challenges... How do you measure collaborative performance? I imagine it would use some sort of formula based upon a number of stats, but how do you construct that stat? Do you weight K/D? Combined (K/D) Maybe, but that may not account for teamwork, assists, etc. Do you weight wins? There is good reason to prioritize this category, but it doesn't help if the two of you are the good players on a team of randoms who are terrible.

Is there a way to use these stats in a way to generate a good picture of how you perform with various other players?

I was thinking of something like this:

Score range: 0-1. The closer to 1 the better.

1/3 is combined performance
1/3 is individual performance with that player
1/3 is based on win/loss stats

I know where some of the holes in the following formulas are, but it'd be helpful if there were other eyes on this so that you could spot any weak points or if you have different suggestions on how things could be weighted.

Combined Performance:

This is the spread of both of your total kills and deaths. Assists are ignored because this is a combined category so hopefully your assists with this person ended up in a kill for them (not perfect bc assists could go to other teammates, but...)

This is then run through an arctan function to normalize values between 0 and 1. A spread of 0 yields .5 Higher spreads push you closer to 0 or 1 depending on their value but you can never reach 0 or 1.

= (1/π)arctan[(player1kills-player1deaths)+(player2kills-player2deaths)]+0.5

Individual Performance:

This is your individual kill-death spread. This will differentiate your score from theirs. They could be great, and you could be less skilled so you may play best with them, but they may not play best with you or the other way around.

This is also run through the arctan function to normalize values.

*I'd like to add some weight to assists in this category but I don't know how to balance it.

= (1/π)arctan[player1kills-player1deaths]+0.5

Win/Loss factors:

Part of your score should reflect win/loss outcomes. I didn't want it to be entirely reflective of % (wins/totalgames) because this would bias people who've only played one game together (either full credit or no credit). I also didn't want it to be fully dependent on spread (wins-losses) because people who had more games together have a greater opportunity to increase this number). So I split it 50/50.

The first half rewards your immediate score giving it a range between 0 and 1. The second half rewards your score over time giving it a range between 0 and 1. These are both multiplied by 1/2 for a combined total between 0 and 1.

=(1/2)[2*wins/totalgames-1] + (1/2)(1/π)arctan[wins-losses]

Final formula:

Score =

1/3*((1/π)arctan[(player1kills-player1deaths)+(player2kills-player2deaths)]+0.5)
+
1/3*((1/π)arctan[player1kills-player1deaths]+0.5)
+
1/3*( (1/2)[2*wins/totalgames-1] + (1/2)(1/π)arctan[wins-losses])


Final thoughts:

The arctan function is used a lot to bring scores into a range between 0 and 1. It also gives more weight to changes that are closer to neutral than those on the extreme. ie it it is a lot easier to move from .5 to .6 than it is to move from .8 to .9. The formula has a heavy bias towards playing well together over time. For instance, if you play one game together and do well, you will still have a limit on the total k-d spread. But if you play well together over time, that # becomes bigger and bigger.

Are there other factors that should be accounted for? Should the weighting be different. Should the scale be larger (1-100) to make it more intelligible? How do we deal with the perception that 75% = C = average when this scale is neutral at 0.5? Does that matter?

And finally: would this type of information be valuable to you?

I'm definitely interested

by someotherguy, Hertfordshire, England, Friday, February 13, 2015, 19:34 (3820 days ago) @ ckamp

My 3am brain is of little help though, I'm afraid. I would say assists are definitely important enough to be included in the "personal score" section - is a straight-up K+A/D not viable? Or something similar but for spread, rather than ratio?

I'm definitely interested

by ckamp, Saturday, February 14, 2015, 01:22 (3820 days ago) @ someotherguy

My 3am brain is of little help though, I'm afraid.

I appreciate any and all feedback!

I would say assists are definitely important enough to be included in the "personal score" section - is a straight-up K+A/D not viable? Or something similar but for spread, rather than ratio?

There certainly isn't any harm in including assists in the spread (K+A)-D, other than that it potentially inflates this category's influence. As I posted to Beardfade, I try to stay away from variable ratios if possible because of divisions by zero and the intelligibility of the data, but perhaps I could work with that too.

Avatar

I'm definitely interested

by ZackDark @, Not behind you. NO! Don't look., Saturday, February 14, 2015, 08:49 (3819 days ago) @ ckamp

As I posted to Beardfade, I try to stay away from variable ratios if possible because of divisions by zero and the intelligibility of the data

IF (death==0): compatibility = 1

That way, the only stat that would influence is whether or not the team won. Which makes sense, imho.

Avatar

But that would awful in low-kill scenarios

by ZackDark @, Not behind you. NO! Don't look., Saturday, February 14, 2015, 08:52 (3819 days ago) @ ZackDark

Hmmmmmmmm

There's GOT to be a way to mix spreads and ratios together...

Avatar

Finding your ideal team, with math?

by BeardFade ⌂, Portland, OR, Friday, February 13, 2015, 21:38 (3820 days ago) @ ckamp
edited by BeardFade, Friday, February 13, 2015, 22:22

Setting aside the fact that I'm not certain this is possible*, I am curious why we're using a K/D spread and not a K/D ratio? For example, 5 kills and 4 deaths is the same spread as 20 kills and 19 deaths, but the ratios aren't the same.

Also, there is something to be said about simply the quantitative value of kills and deaths when playing with another person. For example, my average Kills per Match might be 11 when I play with randoms, but 18 when I play with you (ckamp) or 7 when I play with iconicbanana. As you (ckamp) pointed out the other night, a good crucible player will actually absorb more of the available kills and thus my quantity of kills be lower. So, we also need to make an algorithm that gives some weight to the quantity of kills and deaths that cannot be measured solely with a spread or ratio.

I think this also requires some adjustments made for match type. For example, captures lead to increased points per kill. Average captures per match could be useful, though of more use would be how many zones and duration of holding did you get? Not sure how these would way in, but 2 people could be great control partners, but horrible clash partners.

Lastly, what considerations would we need to make in order to make this work for relationships greater than 2? How would we do this between 3-6 players?

*What I need to find out (and I simply haven't looked yet) is if there is a way to pull in info for individual matches. If Bungie keeps stats of matches, great! I was thinking perhaps the best way to do this query would be to pull in an object of player 1's games and then search through that object for games that Player 2 participated in. Seems like a simple way to reduce the amount of data the query needs to process. Might be more challenging as we add Players 3-6. Once we're able to get which games are played together, we then need to evaluate performance separately and apply maths to quantify the relationship.

Avatar

Finding your ideal team, with math?

by iconicbanana, C2-H5-OH + NAD, Portland, OR, Friday, February 13, 2015, 23:54 (3820 days ago) @ BeardFade

Setting aside the fact that I'm not certain this is possible*, I am curious why we're using a K/D spread and not a K/D ratio? For example, 5 kills and 4 deaths is the same spread as 20 kills and 19 deaths, but the ratios aren't the same.

Also, there is something to be said about simply the quantitative value of kills and deaths when playing with another person. For example, my average Kills per Match might be 11 when I play with randoms, but 18 when I play with you (ckamp) or 7 when I play with iconicbanana. As you (ckamp) pointed out the other night, a good crucible player will actually absorb more of the available kills and thus my quantity of kills be lower. So, we also need to make an algorithm that gives some weight to the quantity of kills and deaths that cannot be measured solely with a spread or ratio.

I think this also requires some adjustments made for match type. For example, captures lead to increased points per kill. Average captures per match could be useful, though of more use would be how many zones and duration of holding did you get? Not sure how these would way in, but 2 people could be great control partners, but horrible clash partners.

Lastly, what considerations would we need to make in order to make this work for relationships greater than 2? How would we do this between 3-6 players?

*What I need to find out (and I simply haven't looked yet) is if there is a way to pull in info for individual matches. If Bungie keeps stats of matches, great! I was thinking perhaps the best way to do this query would be to pull in an object of player 1's games and then search through that object for games that Player 2 participated in. Seems like a simple way to reduce the amount of data the query needs to process. Might be more challenging as we add Players 3-6. Once we're able to get which games are played together, we then need to evaluate performance separately and apply maths to quantify the relationship.

Both bungie.net and destinytracker pull individual game data, so you could source from there. Although I personally find this data spurious, since it doesn't factor playing with ransoms versus playing with voice-enabled teammates, which matters.

And I'll be honest, I find this line of reasoning counterproductive. My mindset is to always excel in the role which my team requires; adapting to new challenges or teammates is part of what makes me a better player.

Finding your ideal team, with math?

by ckamp, Saturday, February 14, 2015, 01:05 (3820 days ago) @ iconicbanana

Both bungie.net and destinytracker pull individual game data, so you could source from there. Although I personally find this data spurious, since it doesn't factor playing with ransoms versus playing with voice-enabled teammates, which matters.

Good point. In my mind, this would be more of a player-initiated comparison where you choose who you are comparing yourself to. That will help self-select players as well.


And I'll be honest, I find this line of reasoning counterproductive. My mindset is to always excel in the role which my team requires; adapting to new challenges or teammates is part of what makes me a better player.

I get you. Part of me wonders if this would actually kill the joy of playing a bit. I love throwing math at things, so that is fun for me, but I would hate to think people would actually choose to not play with another person based on this number. My hope would be that this would just be an interesting factoid for people.

Avatar

Finding your ideal team, with math?

by iconicbanana, C2-H5-OH + NAD, Portland, OR, Saturday, February 14, 2015, 11:11 (3819 days ago) @ ckamp

I get you. Part of me wonders if this would actually kill the joy of playing a bit. I love throwing math at things, so that is fun for me, but I would hate to think people would actually choose to not play with another person based on this number. My hope would be that this would just be an interesting factoid for people.

As long as it was difficult to derive to the point where people weren't dumping out of matchmaking once they saw a 'bad' player was on their team, I don't see how this could hurt. (You could honestly do that now, if you felt like checking their destinytracker page). I wish we could take it a step further and try to determine proficiency specific to loadout (i.e. am I better with pistols or ARs?). That way, you could determine which loadouts were best with specific teammates, which might significantly improve your play.

Avatar

Finding your ideal team, with math?

by BeardFade ⌂, Portland, OR, Saturday, February 14, 2015, 01:06 (3820 days ago) @ iconicbanana

There's a slight distinction between what I know for certain the Bungie API can do and what I'm hoping it can do. I know that it can pull in info for an individual as a cumulation of all matches played, e.g. Player A has 2,603 kills in Clash mode with Suros Regime. We can keep very specific cumulative stats. What I need to know is if a match is stored as a data object, and if the match has some relationship to the people partaking in it. Without the match, there is no connecting point between the data objects which represent the individuals. Thus, if Bungie stores Match objects (or whatever they call them) and matches have guardian objects, I can find which matches have all guardians queried in their data model. This will give us the data necessary to measure Guardian synergy.

That being said, and I say this in response to your last paragraph iconicbanana, I think there are many intangibles that would be difficult to measure, such as "role". Playing a support role, such as laying cover fire, would not be measureable (as far as I know). So, while counterproductive would not be the word I would use, I can understand where your coming from.

At the end of the day, I would work on this for the fun of it. I would still play with you, even if the stats said we were bad for each other. You can't measure camaraderie. :)

Finding your ideal team, with math?

by ckamp, Saturday, February 14, 2015, 00:56 (3820 days ago) @ BeardFade

Setting aside the fact that I'm not certain this is possible*, I am curious why we're using a K/D spread and not a K/D ratio? For example, 5 kills and 4 deaths is the same spread as 20 kills and 19 deaths, but the ratios aren't the same.

Games are won by spread, not ratios. Well, that is kind of true, but the data is a bit easier to read, work with, and normalize with a spread. You add up all the spreads and you get the amount your team won by. You add up all the ratios and average them and you get ???? I see why you would like to use a ratio, but it can muck things up because then you have to account for divisions by zero, mapping the #'s onto something that is intelligible, etc. For instance (I'm thinking of 3 kills and 2 deaths or vice versa), most people don't know readily that .67 is the inverse score of 1.5, but they can tell that that +1 and -1 are related.

I'm fine with other solutions, but I'm curious as to what formula you would use to bring k/d into relationship with the other parts of the equation.

Also, there is something to be said about simply the quantitative value of kills and deaths when playing with another person. For example, my average Kills per Match might be 11 when I play with randoms, but 18 when I play with you (ckamp) or 7 when I play with iconicbanana. As you (ckamp) pointed out the other night, a good crucible player will actually absorb more of the available kills and thus my quantity of kills be lower. So, we also need to make an algorithm that gives some weight to the quantity of kills and deaths that cannot be measured solely with a spread or ratio.

Hopefully this is where the aggregate kills and deaths of the two of you will balance that out a bit. The win/loss category will also help account against this phenomena. I'd also like to add assists into the personal part of the equation which will offset kill-absorbing a bit.


I think this also requires some adjustments made for match type. For example, captures lead to increased points per kill. Average captures per match could be useful, though of more use would be how many zones and duration of holding did you get? Not sure how these would way in, but 2 people could be great control partners, but horrible clash partners.

Ooof. Good question. I hadn't even considered control zones. Hopefully that is accounted for in the win/loss category, but I don't know of a way to measure control zone efficiency. You could probably sort the ranking by gametype?

Lastly, what considerations would we need to make in order to make this work for relationships greater than 2? How would we do this between 3-6 players?

I hadn't really thought of that yet, as I was focused on single-person comparisons, but I suppose that in part 1 of the equation you could simply do a combined k-d spread for the team. Each player would have their own score because of the individual component.

*What I need to find out (and I simply haven't looked yet) is if there is a way to pull in info for individual matches. If Bungie keeps stats of matches, great! I was thinking perhaps the best way to do this query would be to pull in an object of player 1's games and then search through that object for games that Player 2 participated in. Seems like a simple way to reduce the amount of data the query needs to process. Might be more challenging as we add Players 3-6. Once we're able to get which games are played together, we then need to evaluate performance separately and apply maths to quantify the relationship.

Sounds solid, but I'm horribly inexeperienced with APIs and the way the Destiny databases are configured.

Avatar

Finding your ideal team, with math?

by Ragashingo ⌂, Official DBO Cryptarch, Saturday, February 14, 2015, 11:56 (3819 days ago) @ ckamp

Ooof. Good question. I hadn't even considered control zones. Hopefully that is accounted for in the win/loss category, but I don't know of a way to measure control zone efficiency. You could probably sort the ranking by gametype?

Control points might be a difficult number to factor in. Think about it, if your team usually totals one or two captures per person did you win or lose? Maybe you grabbed C and B on blind watch and held them to the entire game. Or maybe your team grabbed A... and was completely shut out. A relatively high number of captures, when combined with a good enough k/d might indicate a situational aware team player though...

I've got a math boner now. And it's pointed at you ;)

by Monochron, Friday, February 13, 2015, 21:45 (3820 days ago) @ ckamp

I would love to apply this to some stats, but I'm woefully under-experienced with web APIs. I'm interested to look into it though, maybe there is an interface to it that I would find more appealing.

Math should be exercised responsibly kids!

by ckamp, Saturday, February 14, 2015, 01:28 (3820 days ago) @ Monochron

I would love to apply this to some stats, but I'm woefully under-experienced with web APIs. I'm interested to look into it though, maybe there is an interface to it that I would find more appealing.

Yeah, I have very minimal experience with APIs. The only thing I've done is modify existing tools to extract data I want. I'm curious to learn though....

Avatar

Uh...

by ChaosSociety, Oregon, Friday, February 13, 2015, 23:56 (3820 days ago) @ ckamp

Avatar

Goddamnit, Chaos.

by iconicbanana, C2-H5-OH + NAD, Portland, OR, Friday, February 13, 2015, 23:58 (3820 days ago) @ ChaosSociety

You're supposed to be a f#+}% professor. This is goin to look terrible for our department review with ACICS.

Avatar

Goddamnit, Chaos.

by ChaosSociety, Oregon, Saturday, February 14, 2015, 00:01 (3820 days ago) @ iconicbanana

[image]

Finding your ideal team, with math?

by ckamp, Saturday, February 14, 2015, 09:58 (3819 days ago) @ ckamp

I just included assists in the second part of the equation.

Also, I just saw an error I forgot to correct last night.. I needlessly tried to shift the first part of the win/loss stat to fall within a range that doesn't make sense for the rest of the equation. The Win/Loss category should read as follows:

=(1/2)[wins/totalgames] + (1/2)(1/π)arctan[wins-losses]

rendering the final forumula:

Score=

1/3*((1/π)arctan[(player1kills-player1deaths)+(player2kills-player2deaths)]+0.5)
+
1/3*((1/π)arctan[player1kills+player1assists-player1deaths]+0.5)
+
1/3*( (1/2)[wins/totalgames] + (1/2)(1/π)arctan[wins-losses])

Finding your ideal team, with math?

by Claude Errera @, Saturday, February 14, 2015, 15:21 (3819 days ago) @ ckamp

I just included assists in the second part of the equation.

Also, I just saw an error I forgot to correct last night.. I needlessly tried to shift the first part of the win/loss stat to fall within a range that doesn't make sense for the rest of the equation. The Win/Loss category should read as follows:

=(1/2)[wins/totalgames] + (1/2)(1/π)arctan[wins-losses]

rendering the final forumula:

Score=

1/3*((1/π)arctan[(player1kills-player1deaths)+(player2kills-player2deaths)]+0.5)
+
1/3*((1/π)arctan[player1kills+player1assists-player1deaths]+0.5)
+
1/3*( (1/2)[wins/totalgames] + (1/2)(1/π)arctan[wins-losses])

All of this info is easily collectable at destinytracker... except for games with friends. Not sure how to get that.

Avatar

Finding your ideal team, with mind-numbing tedium.

by iconicbanana, C2-H5-OH + NAD, Portland, OR, Saturday, February 14, 2015, 17:46 (3819 days ago) @ Claude Errera

I just included assists in the second part of the equation.

Also, I just saw an error I forgot to correct last night.. I needlessly tried to shift the first part of the win/loss stat to fall within a range that doesn't make sense for the rest of the equation. The Win/Loss category should read as follows:

=(1/2)[wins/totalgames] + (1/2)(1/π)arctan[wins-losses]

rendering the final forumula:

Score=

1/3*((1/π)arctan[(player1kills-player1deaths)+(player2kills-player2deaths)]+0.5)
+
1/3*((1/π)arctan[player1kills+player1assists-player1deaths]+0.5)
+
1/3*( (1/2)[wins/totalgames] + (1/2)(1/π)arctan[wins-losses])


All of this info is easily collectable at destinytracker... except for games with friends. Not sure how to get that.

Well, full lists of players in every game are available on destinytracker...but it sure as hell wouldn't be easy to collect the data.

Avatar

DestinyTracker is one use of the API, maybe there's more.

by BeardFade ⌂, Portland, OR, Saturday, February 14, 2015, 17:58 (3819 days ago) @ iconicbanana

Right, destinytracker is using Bungie's API to get info. We know what it's capable of there, I'm wondering if there is more. I have the day off Monday for President's day. I think I will get an API key and see what I can do, no promises to anyone.

Avatar

Official API

by Beorn @, <End of Failed Timeline>, Saturday, February 14, 2015, 19:01 (3819 days ago) @ BeardFade

Right, destinytracker is using Bungie's API to get info. We know what it's capable of there, I'm wondering if there is more. I have the day off Monday for President's day. I think I will get an API key and see what I can do, no promises to anyone.

I was actually playing with the API a little bit earlier today. For those who don't know, but are interested in dabbling in the API, Bungie maintains an official API group. They've published the first official interface (https://www.bungie.net/en/Clan/Post/39966/85087279/0/0) and it's definitely worth a look.

Documentation is pretty sparse, but the endpoint descriptions are invaluable:
https://www.bungie.net/platform/user/help/
https://www.bungie.net/platform/destiny/help/

Now that they've solidified an API, I'm thinking we'll integrate some API-linked behavior into the forum.

*Edit: Just be careful with the Grimoire Card one… that thing just locked-up a couple of my code editors while trying to "prettify" the JSON so that I could read it. The response is 844KB of raw text. :D

Avatar

+1 for exposure

by iconicbanana, C2-H5-OH + NAD, Portland, OR, Saturday, February 14, 2015, 23:19 (3819 days ago) @ Beorn

Eat your hearts out, mathletes.

Avatar

DestinyTracker is one use of the API, maybe there's more.

by BeardFade ⌂, Portland, OR, Monday, February 16, 2015, 08:24 (3817 days ago) @ BeardFade

Got an API key this morning (although, I read that as of right now, you don't NEED an API key with every request. Interesting, they plan on making this required in the future, though). And I actually think this might be possible. There are a few endpoints that give me hope.

This page is a list of the API's endpoints for /destiny (there's also a forum and user platform). As you can see, there are a number of endpoints for stats including ones that require an activityId. This is what I was looking for. Since you are able to get the aggregate stats for a player you can get a list of activities they have done. Hopefully, a method can be created to filter one player's list of activities against another player's to then start calculating information.

Back to the forum index
RSS Feed of thread