gastonstat / discriminer Goto Github PK
View Code? Open in Web Editor NEWR package DiscriMiner
R package DiscriMiner
There is an error in linDA() when priors are specified and validation = "crossval" is specified.
set.seed(1)
num_class <- length(unique(iris$Species))
# Works
DiscriMiner::linDA(variables = iris[1:4], group = iris$Species, prior = rep(1/num_class, num_class))
# Error
DiscriMiner::linDA(variables = iris[1:4], group = iris$Species, prior = rep(1/num_class, num_class), validation = "crossval")
# Error: object 'props' not found
In looking at the source code for linDA() the problem seems to be that in the validation == "crossval" section of the code it references the object props
(line 154), but if priors are specified (lines 101-111) the object props is not created, unlike if prior is no specified (lines 111-115). I did some testing and adding
props = prior
at line 111 seems to resolve the issue. See my pull request to resolve the issue.
The commands written in the installation section didn't work:
install_github('DiscriMiner', username='gastonstat')
gave an error "Invalid git repo specification: 'DiscriMiner'"The command that did work was:
install_github('gastonstat/DiscriMiner')
On R 4.2.3 with devtools 2.4.5
Dear Dr. Gaston Sanchez:
Do you know the discriminant Q2 (DQ2) which is taken as an improvement for the Q2 value used in the validation of PLSDA models (http://link.springer.com/article/10.1007%2Fs11306-008-0126-2). Can this method be added into package DiscriMiner?
Best regards!
Bo
set.seed(3)
data(Sonar)
data = Sonar
class.col = 61
trainIds = sample(seq_row(data), size=0.66*nrow(data))
model = plsDA(variables=data[trainIds,-class.col], group=data[trainIds,class.col])
#Error in Wh[, i] : incorrect number of dimensions.
Depending on the seed it sometimes also works without problems.
Dear Gaston,
I'm trying to use the function "plsDA" of your package, using the following command :
model <- plsDA(data[,-1],data[, 1],autosel = TRUE, cv = "LKO", k=10)
where the first column of "data" contains the groups (two groups).
But I get the following error message :
Error in if (sum(w.dif^2) < 1e-06 || iter == 100) break :
missing value where TRUE/FALSE needed
Could you help me to find out what the problem is ?
Kind regards,
Arnaud.
quaDA(..., prob = TRUE)
doesn't seem to have an influence on the result of classify
Hi,
When I run the following example code in DiscriMiner package:
data(iris)
my_pls1 = plsDA(iris[,1:4], iris$Species, autosel=FALSE, comps=2)
The Q2 output is below:
my_pls1$Q2
Q2.setosa Q2.versicolor Q2.virginica Q2.global
t1 0.8594805 0.03936045 0.5009850 0.46660863
t2 0.2133430 0.16897758 0.1028906 -0.01269048
When I try to fit a model using only one variable I receive an error message. This happens for linDA, quaDA, geoDA, plsDA.
set.seed(1)
DiscriMiner::linDA(variables = iris[1], group = iris$Species)
# Error in matrix(0, ng, ncol(X)) : non-numeric matrix extent
DiscriMiner::quaDA(variables = iris[1], group = iris$Species)
# Error in matrix(0, ng, ncol(X)) : non-numeric matrix extent
DiscriMiner::geoDA(variables = iris[1], group = iris$Species)
# Error in matrix(0, ng, ncol(X)) : non-numeric matrix extent
DiscriMiner::plsDA(variables = iris[1], group = iris$Species, autosel = F, comps = 2)
# Error in if (nc == n) nc = n - 1 : argument is of length zero
In geoDA.R, lines 99-102:
if (any(learn) <= 0 || any(learn) > n)
stop("\nsubscript out of bounds in 'learn' set")
if (any(test) <= 0 || any(test) > n)
stop("\nsubscript out of bounds in 'test' set")
It should be any(learn <= 0) || any(learn > n)
and similarly any(test <= 0) || any(test > n)
. The parentheses are wrong.
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.