fastknn icon indicating copy to clipboard operation
fastknn copied to clipboard

fastknn for regression

Open hutaohutc opened this issue 7 years ago • 6 comments

Hi , I want to ask can this fastknn funcion use for regression?

hutaohutc avatar Apr 09 '17 10:04 hutaohutc

I'm sorry but for now, unfortunately, fastknn works only for classification problems. I'm planning to include regression capabilities, but it can take a few weeks or months. Here it follows the to do list:

  • [x] implement the knnExtract() method for feature extraction and dimensionality reduction
  • [ ] add an automatic feature ranking procedure to the knnDecision() method
  • [ ] implement the knnStack() method to generate metafeatures from the original data that can be used in stacked models
  • [ ] implement the knnImpute() method for missing values imputation
  • [ ] extend the fastknn() method to work with regression problems

However, some methods like knnDecision() and knnExtract() cannot be extended to deal with regression problems. They require nominal target variables.

davpinto avatar Apr 09 '17 13:04 davpinto

when i run : knnDecision(x.tr, y.tr, x.te, y.te, k = 15) . Error in viridisLite::viridis(256, alpha, begin, end, direction, option) : unused argument (option)

yunxileo avatar Apr 15 '17 12:04 yunxileo

Hi @yunxileo,

I can't reproduce your problem. I need more details about your data. Have you tried the toy example in the documentation?

library(fastknn)

## Load toy data
data("spirals", package = "fastknn")

## Split data for training and test
set.seed(123)
tr.idx <- which(caTools::sample.split(Y = spirals$y, SplitRatio = 0.7))
x.tr   <- spirals$x[tr.idx, ]
x.te   <- spirals$x[-tr.idx, ]
y.tr   <- spirals$y[tr.idx]
y.te   <- spirals$y[-tr.idx]

## Plot decision boundary
knnDecision(x.tr, y.tr, x.te, y.te, k = 15)

Try it and let me know if the problem persists. In addition, check your version of the viridis package. It must be greater than 0.3.4.

davpinto avatar Apr 15 '17 14:04 davpinto

I am sorry ,but the problem persists . my Info: R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 and viridis_0.4.0

yunxileo avatar Apr 16 '17 09:04 yunxileo

Hi @yunxileo,

I'm not able to reproduce this problem on Ubuntu 16.04 x64, so I used devtools::build_win() to submit the package to winbuilder. Again, I'm not able to reproduce your problem. Here is the link to the report: test fastknn on Windows. It will expire in 3 days.

Note that all tests returned without error, including the tests for the knnDecision() method.

Unfortunately, I have no idea about the origin of your problem. Try to reinstall the viridis package.

If there is something else I can do to help you, please ask me! I hope you find a solution.

davpinto avatar Apr 16 '17 14:04 davpinto

Actually,after I reinstall the viridisLite package,the knnDecision() works.Thanks a lot for your help!

yunxileo avatar Apr 17 '17 06:04 yunxileo