Skip to content

Fix sorting actions#37

Open
e-dzia wants to merge 90 commits intoParrotPrediction:masterfrom
e-dzia:sort-fix
Open

Fix sorting actions#37
e-dzia wants to merge 90 commits intoParrotPrediction:masterfrom
e-dzia:sort-fix

Conversation

@e-dzia
Copy link
Contributor

@e-dzia e-dzia commented Nov 2, 2018

It is allowed for actions to be None, which sometimes can give errors while sorting them. This quick fix solves this issue giving the value of "-1" to actions which are not an int.
screenshot 2018-11-02 11-21-17

@e-dzia e-dzia changed the title Sort fixing actions Fix sorting actions Nov 2, 2018
knowledge_array = {i: 0.0 for i in range(all_actions)}

cll.sort(key=lambda cl: cl.action)
cll.sort(key=lambda cl: cl.action if isinstance(cl.action, int) else -1)
Copy link
Member

Choose a reason for hiding this comment

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

What causes that error?
It's a hack, but does not solve the cause of the problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It only happens when actions are None, but I don't know the cause of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

screenshot 2018-11-10 18-26-42
Even with this hack, there are sometimes other errors caused by action being None, so I guess this hack doesn't even solve the error.

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