Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pitch Count Heatmap #68

Open
kruser opened this issue Apr 17, 2014 · 16 comments
Open

Pitch Count Heatmap #68

kruser opened this issue Apr 17, 2014 · 16 comments

Comments

@kruser
Copy link
Owner

kruser commented Apr 17, 2014

I wanted to see where a pitcher was throwing most of their fastballs this year compared to last and discovered that we don't have a simple pitch count heatmap.

I think we should!

@patrickjmcd
Copy link

Would this be broken out by pitch type?

@kruser
Copy link
Owner Author

kruser commented Apr 17, 2014

All of the heatmaps can be filtered by 1..* pitch types using the table right above it.

For example, here are swing rates on fastballs for a pitcher.

image

@albertlyu
Copy link
Contributor

The denominator for all the pitch zones would have to be all pitches, regardless of which / how many pitch types are filtered. Problem I see with this is that rare pitches are going to show all blue no matter what. We may have to create a scatter charts for 'Pitch Selection' charts. All of our heatmaps right now are rates.

@kruser
Copy link
Owner Author

kruser commented Apr 17, 2014

@albertlyu, we have a denominator in the calculation in the Zone.js only, but in reality it just needs to return a number and highcharts will plot everything relative to each other. So I think the Zone.js function would just need to return pitches.length.

@albertlyu
Copy link
Contributor

Right, so I suppose what I meant to say was that the denominator for each pitch zone would be all pitches in that pitch zone, which would be the same across all combination of pitch types for that particular zone. But an additional concern is if a pitcher throws a lot of fastballs up in the zone, all other pitch types will be skewed because there will be a large pitches.length up in the zone. It would not show a good estimate of where a pitcher tends to throw his curve ball -- showing pitch selection would have to deviate from our current set of heatmaps, in my opinion.

So for example, a pitcher could throw the same exact number of curve balls in the same exact locations in year 2012 vs year 2013, but if has a very different distribution of fastballs between both years, the curve ball % heatmap would look completely different even if the curve ball selection behavior was the same between the years.

@kruser
Copy link
Owner Author

kruser commented Apr 17, 2014

Yes, I agree. I think the chart would get useful though if the user checks pitch types in the table above.

@albertlyu
Copy link
Contributor

But if the use case of a pitch selection chart is to determine where a pitcher's fastball location has changed from one year to the next, then we would have to use a scatter chart or a heatmap like here http://www.fangraphs.com/blogs/riveras-cutters-working-the-count/ which calculates the z-axis (heat) through kernel density estimation. Unless I may be misunderstanding what you're looking for here?

@albertlyu
Copy link
Contributor

OHhhhhh pitches.length = total number of fastballs if only fastballs are checked... not total number of pitches inside that zone regardless of pitch type. My apologies.

@kruser
Copy link
Owner Author

kruser commented Apr 17, 2014

The Zones.js are compiled based on pitch types selected (or all if none are selected). So there is no need to bother the Zone.js function creator with those details.

@albertlyu
Copy link
Contributor

Alright, in that case, would you want to add another collapsible panel to the accordion on the left? We may want to come up with additional pitch count heatmaps if so.

@patrickjmcd
Copy link

Forgive my ignorance, but could this also lead into a study of pitch selection based on count? For instance, for a selected pitcher, given a certain count, what pitch would he be most likely to throw?

@kruser
Copy link
Owner Author

kruser commented Apr 18, 2014

Yep, probably not presented in a heat map, but yes we should show that data
soon.

I have a task open on the atbat-mongodb project to add balls and strikes to
the pitch data. Right now our db isn't ready. I'll try to get that ready
within two weeks.
On Apr 17, 2014 11:01 PM, "patrickjmcd" [email protected] wrote:

Forgive my ignorance, but could this also lead into a study of pitch
selection based on count? For instance, for a selected pitcher, given a
certain count, what pitch would he be most likely to throw?

Reply to this email directly or view it on GitHubhttps://github.com//issues/68#issuecomment-40785225
.

@patrickjmcd
Copy link

Is there anything on the DB side I can do to assist?

@albertlyu
Copy link
Contributor

Yup, pitch selection based on count would be a great addition to the heatmaps, e.g. first pitch, behind in the count, ahead in the count, and two strike scenarios. We'd be filtering for pitch type, then by count (and potentially base-out situation, etc.), not the other way around (which is what the filters currently allow). The issue in atbat-mongodb is here: kruser/atbat-mongodb#5

@kruser
Copy link
Owner Author

kruser commented Apr 18, 2014

@patrickjmcd, I'm looking at a lot of other modeling changes in that atbat-mongodb project that will require a from-scratch ETL, so I don't have anything at the top of mind to do there. For this project, let's just keep encapsulating our functionality properly, like we do with the Pitch.js methods.

I think this issue can be completed without any ETL changes though if anybody wants it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants