ncordon / imbalance Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://ncordon.github.io/imbalance
License: GNU General Public License v2.0
Home Page: https://ncordon.github.io/imbalance
License: GNU General Public License v2.0
The documentation of the rwo
function claims it can handle every type of dataset. Indeed, the 2nd part of the method adds noise to numeric features and samples from the existing values for all other types of features. However, it can fail earlier because it attempts to convert all features/columns to numeric (which IMO is not necessary in this algorithm, but probably just copy-pasted, as it also exists at the beginning of the other oversampling methods [and makes sense there]). For example, if we have a factor which has non-numeric levels, rwo
throws an error when executing dataset <- toNumeric(dataset, exclude = classAttr)
.
# Does work
imbalance::rwo(data.frame(test1 = rnorm(10), test2 = rnorm(10), class = factor(sample(c("a", "b"), 10, T))), numInstances = 5, classAttr = "class")
# Error
imbalance::rwo(data.frame(test1 = rnorm(10), test2 = factor(sample(c("a", "b"), 10, T)), class = factor(sample(c("a", "b"), 10, T))), numInstances = 5, classAttr = "class")
In racog
the new generated samples are being returned as list, whereas in rwo are been returned as a data.frame
.
Sample code below to illustrate the issue. Documentation says that ratio can be between 0 and 1. However, oversample() gives an error if the ratio specified is really close to 1, and also error for ratio = 1. How can a user work around this?
newDataset <- oversample(glass0, ratio = 0.9, method = "SMOTE") #No problem
newDataset <- oversample(glass0, ratio = 1, method = "SMOTE")
Error in sample.int(length(x), size, replace, prob) :
cannot take a sample larger than the population when 'replace = FALSE'
newDataset <- oversample(glass0, ratio = 1.0, method = "SMOTE")
Error in sample.int(length(x), size, replace, prob) :
cannot take a sample larger than the population when 'replace = FALSE'
newDataset <- oversample(glass0, ratio = 0.95, method = "SMOTE")
newDataset <- oversample(glass0, ratio = 0.99, method = "SMOTE")
Error in sample.int(length(x), size, replace, prob) :
cannot take a sample larger than the population when 'replace = FALSE'
newDataset <- oversample(glass0, ratio = 0.98, method = "SMOTE")
Error in sample.int(length(x), size, replace, prob) :
cannot take a sample larger than the population when 'replace = FALSE'
newDataset <- oversample(glass0, ratio = 0.97, method = "SMOTE") #No error for ratio = 0.97
Checking with cars
data:
Error in check.data(x, allowed.types = c(discrete.data.types, continuous.data.types)) :
variable safety must have at least two levels.
Currently a naive mechanism is being used, provided that we know that best bandwidth is going to be O(Silverman's rule of thumb).
for(double v = 0.25; v < 1.5; v = v + 0.05){
possible_bwidth.push_back(v * silverman_bandwidth);
}
Find a better way to adapt the parameter. Maybe a simulated annealing (?).
Current build on CRAN is showing problems with Solaris compatibility with respect to the use of C++ calls such as:
sqrt(int)
Documented in https://cran.r-project.org/doc/manuals/r-patched/R-exts.html#Portable-C-and-C_002b_002b-code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.