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

Move model code into new repo and some bug fixes #21

Merged
merged 2 commits into from
Aug 19, 2017
Merged

Move model code into new repo and some bug fixes #21

merged 2 commits into from
Aug 19, 2017

Conversation

llllllllll
Copy link
Owner

@llllllllll llllllllll commented Aug 10, 2017

EDIT: this pr now moves the model into a new repo instead of adding the new model

slider/curve.py Outdated
@@ -131,10 +125,28 @@ def __call__(self, t):
class Passthrough(Curve):
kinds = 'P'

def __init__(self, points, req_length):
def __new__(cls, points, req_length):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this module are actually unrelated and should probably have been pulled out. ping @blimmo

@llllllllll
Copy link
Owner Author

This is actually producing interesting results now! I am not sure how I am going to support training for users when the upload files, but I can figure that out later.

@blimmo when you get a chance, can you review the new curve module changes in here?

Copy link
Collaborator

@blimmo blimmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the changes, especially the get_center rewrite (I was going to get to it eventually I swear!). I'll happily make the changes I've suggested myself but I probably won't be able to until Saturday as I'm still away (no keyboard 😢 )

slider/curve.py Outdated
for kind in cls.kinds:
cls._kind_dispatch[kind] = cls


class Bezier(Curve):
kinds = 'L'
kinds = ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be an empty string to be consistent with the other kinds?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I normally use the unit tuple for empty sequences. Strings are used elsewhere because they have the nice property that they are iterables of characters. To be more clear we could make the other kinds tuples as well. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather use the empty string here so we can continue to use multicharacter strings for multiple types but if we were going to move the curve type choice logic up into from_kind_and_points anyway isn't this going to be removed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I guess we should just have a map internally there, no need for this registration magic

slider/curve.py Outdated
@@ -128,13 +123,42 @@ def __call__(self, t):
return self._curves[bi]((t - pre_t) / (post_t - pre_t))


class Passthrough(Curve):
kinds = 'P'
class LinearMetaCurve(MetaCurve):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this possible? Don't all multi curve sliders use 'B'?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the source of osu! it appears that the Linear curve splits into subcurves between each point: https://github.com/ppy/osu/blob/7fbbe74b65e7e399072c198604e9db09fb729626/osu.Game/Rulesets/Objects/SliderCurve.cs#L30

The particular slider that I saw this was and old favorite: https://osu.ppy.sh/s/19789

For the new lstm stuff I ran through all of my maps and collected stats about all of the locations and the old interpretation here would cause positions on the scale of 1e23.

slider/curve.py Outdated
kinds = 'P'

def __new__(cls, points, req_length):
if len(points) != 3:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit weird to be returning a bezier instance when you called the perfect constructor. Wouldn't it be better to put this logic in the from_kind_and_points method? Then the user could forcibly get a perfect curve if they called the perfect constructor and would get a valueerror of the points were bad.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, I will lift this up there.

slider/curve.py Outdated
0.5 * (p1.y + p2.y) - t * (p2.x - p1.x),
)
if np.isclose([a_squared, b_squared, c_squared], 0).any():
raise ValueError()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do allow the user to see this error by calling the perfect constructor then this should probably have a little more description.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. These checks guard against collinear points, I will put that in the error message with the coordinates.

slider/curve.py Outdated
def _init(self, points, req_length, center):
self.points = points
self.req_length = req_length
self._center = center
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that this isn't being flipped in HR. I think we should just add a hard_rock attribute here to compute this so the code in Slider can just call that.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: this could cause training noise on hr maps

@blimmo
Copy link
Collaborator

blimmo commented Aug 16, 2017

I do think that the model code should be in a separate library. I'm using slider in a program that I use cx_freeze on so I try to minimize my dependencies and it feels weird to have all this model code (even if most of it isn't actually there). Mainly I just think it makes more sense tbh although I might be being biased because I don't understand it :P. Eh, ignore all that, I vote take it out but feel free to ignore me.

@llllllllll
Copy link
Owner Author

I suspected that people would feel that way. I will break out just the bug fixes from this PR and move all of the model code to combine so that it is still easily accessible.

@llllllllll llllllllll changed the title ENH: Add LSTM model and implement big model refactor. Move model code into new repo and some bug fixes Aug 17, 2017
@llllllllll
Copy link
Owner Author

llllllllll commented Aug 17, 2017

I think I addressed your feedback, does everything look good?

This pr mostly changed to just rip the models out and cleanup some bugs found while really poring through all of my replay data.

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

Successfully merging this pull request may close these issues.

2 participants