-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add distance/length and angle for events with end coordinates #413
Comments
They are not very well documented I think, but they should already exist. For example, as per this test, you should be able to do:
|
Hi, Thanks for clarifying this! There seems to be a bug in the implementation of the Also, the current implementation only allows to calculate Angle when the orientation is 'ACTION_EXECUTING_TEAM'. I could create a PR to
|
I would not be surprised if this indeed is broken, because I think this is very old functionality. @koenvo would you mind chiming in on this? I think having this functionality, as well as the delta x,y values makes sense would you agree? Also @probberechts |
Yes, it makes sense to fix any bugs and add a transformer to compute the distance. On the other hand, I've never used these attribute transformer myself. It's much more efficient to perform these feature computations in Pandas/Polars. Hence, personally, I don't think it's worth the effort to spend a lot of time on implementing more attribute transformers. |
Agree with Pieter. It would make more sense to implement those transformations as polars expressions, and add the columns right before returning the dataframe. Two reasons why it could make sense:
|
Hi, I think we indeed need the distance in meters (or another unit) to have meaningful results. Correct me if I am wrong, but I think that in the current implementation of the I must say that I don't have much experience with polars, but I could add the distance covered and angle_to_goal columns when returning the dataframe in pandas (right before returning the dataframe, so before this line). The coordinate system / pitch dimensions can also be taken into account. |
There are two possible workflows to compute features from the data:
The I like that kloppy supports both. Some features are indeed easier to compute from the object-oriented data model. Hence, sometimes they can be useful. However, typically, it is easier and more efficient to do the computation in Pandas / Polars. It is good that we have a few very standard |
Ok, then maybe I will just create a PR to fix the bug in the existing |
Would it be a good idea to add properties that can be derived from the start and end coordinates of an event?
I am thinking about two properties:
There could be multiple conventions/orientations for the angle but I think the following would be a good default.
Do you think it makes sense to add these properties in kloppy or not because these properties do not really add extra information since they can be derived from the already existing properties?
The text was updated successfully, but these errors were encountered: