-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Load kknn pkg on startup #4453
Load kknn pkg on startup #4453
Conversation
JorisGoosen
commented
Jan 25, 2021
- Fixes https://github.com/jasp-stats/INTERNAL-jasp/issues/1227 (K-nn and regression broken)
- Fixes jasp-stats/INTERNAL-jasp#1227 (K-nn and regression broken)
I can attest that this at least solves the problem. |
I think we can fix this inside jaspMachineLearning with something like contr.dummy <- kknn::contr.dummy all we need to ensure is that |
I think it might be more futureproof to just call |
I looked into it a bit and it turns out it's a bit more work than what I said above. It is doable to fix this within R though. The downside of [1] "contr.ordinal" "kknn" "kknn.dist2" "fast.table"
[5] "plot.train.kknn" "contr.metric" "train.kknn" "contr.int"
[9] "optKernel" "specClust" "print.train.kknn" "plot.specClust"
[13] "summary.train.kknn" "Laplacian" "AUC" "predict.train.kknn"
[17] "print.kknn" "mydist" "cv.kknn" "summary.kknn"
[21] "simulation" "getClosest" "contr.dummy" "kknn.dist"
[25] "predict.kknn" "prepare.Discrete" if we need another call to |
It depends on how you set it up I guess, but when we started, it was set up without namespace protection which is why I using library, dettach etc. |
Hmm, well... I think it would be best if I think putting the Would that work? |
There is already an open issue at the GitHub repo. It should be relatively straightforward to fix this in the package itself, I'll see if I can make a PR to the repo this week.
It's a bit more complicated. The core of this problem boils down to a poor design choice by R. R has this procedure to create a "model matrix". Basically it transforms this, let's call it
into something like this:
the second representation is useful for a lot of linear algebra. There are multiple ways to do this transformation though, for instance, most algorithms use a built in conversion that lumps These different ways are called "contrasts" and you can set these by Also, A solution (the only reasonable one I came up with actually) is to manually specify a contrast matrix as an attribute, i.e., we do |
So we can wait and see if you manage to fix kknn and otherwise we can always merge this to be able to release JASP with some working ML. |
Mind yourself though, the latest release of the |
It does seem to be under semi-active development if I peek at https://github.com/KlausVigo/kknn so at least the maintainer is alive. |
Okay so I've opened a PR at https://github.com/KlausVigo/kknn that should fix the problem. And now we wait... |
Depends on KlausVigo/kknn#24 |
So... It turns out this already sneaked into Anyhow, this PR can be closed because it really doesn't serbve much of a purpose anymore: b630d38 Once @vandenman hears back from Klaus we can always remove it. |