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

Ordered treated as numbers #63

Open
xrobin opened this issue Oct 6, 2019 · 3 comments
Open

Ordered treated as numbers #63

xrobin opened this issue Oct 6, 2019 · 3 comments
Labels
api-change bug

Comments

@xrobin
Copy link
Owner

@xrobin xrobin commented Oct 6, 2019

> text.levels <- aSAH$wfns
> head(text.levels)
[1] 1 1 1 1 3 2
Levels: 1 < 2 < 3 < 4 < 5
> levels(text.levels)
[1] "1" "2" "3" "4" "5"
> levels(text.levels) <- c("very low", "low", "medium", "high", "very high")
> head(text.levels)
[1] very low very low very low very low medium   low     
Levels: very low < low < medium < high < very high
> r <- roc(aSAH$outcome, text.levels)
> r$thresholds
[1] -Inf  1.5  2.5  3.5  4.5  Inf

Only makes sense if ordered values are actually 1, 2, ... n

Steps to reproduce:

text.levels <- aSAH$wfns
levels(text.levels) <- c("very low", "low", "medium", "high", "very high")
r <- roc(aSAH$outcome, text.levels)
r$thresholds
@xrobin
Copy link
Owner Author

@xrobin xrobin commented Oct 6, 2019

Allowing textual thresholds seems to break a lot of assumptions. Initial work in separate ordered_fix branch breaks horribly many tests. Coordinates are converted to text (with transpose=TRUE). It might be better to just warn the user.

@xrobin xrobin added the bug label Oct 30, 2019
@xrobin
Copy link
Owner Author

@xrobin xrobin commented Nov 29, 2019

Previous commit is a workaround to convert through a character vector if possible (keeping numeric values if the ordered values are numbers). There is now a warning in case of a conversion to integer values.

@xrobin xrobin added the api-change label Dec 3, 2019
@xrobin
Copy link
Owner Author

@xrobin xrobin commented Dec 8, 2019

The 1.16 release will have the previous workaround to use the correct numbers (if actually numbers) or warn the user.

Once we return a data.frame by default, and transpose becomes deprecated, it will be possible to return character thresholds in coords, and revisit this issue. Until then it will be on hold.

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

No branches or pull requests

1 participant