logisticRegressionInterface {ClassifyR} | R Documentation |
logisticRegressionTrainInterface
generates a multinomial logistic regression model trained on some
training data and logisticRegressionPredictInterface
makes class predictions for samples in
the test data set.
## S4 method for signature 'matrix' logisticRegressionTrainInterface(measurements, classes, ...) ## S4 method for signature 'DataFrame' logisticRegressionTrainInterface(measurements, classes, ..., verbose = 3) ## S4 method for signature 'MultiAssayExperiment' logisticRegressionTrainInterface(measurements, targets = names(measurements), ...) ## S4 method for signature 'mnlogit,matrix' logisticRegressionPredictInterface(model, test, ...) ## S4 method for signature 'mnlogit,DataFrame' logisticRegressionPredictInterface(model, test, classes = NULL, verbose = 3) ## S4 method for signature 'mnlogit,MultiAssayExperiment' logisticRegressionPredictInterface(model, test, targets = names(test), ...)
measurements |
Either a |
classes |
Either a vector of class labels of class |
test |
An object of the same class as |
targets |
If |
model |
A fitted model as returned by |
... |
Variables not used by the |
verbose |
Default: 3. A number between 0 and 3 for the amount of progress messages to give. This function only prints progress messages if the value is 3. |
If measurements
is an object of class MultiAssayExperiment
, the factor of
sample classes must be stored in the DataFrame accessible by the colData
function
with column name "class"
.
This wrapper works with individual-specific variables. If more a complex experimental design is utilised, such as a market research data set with both individual-specific and alternative-specific variables, then this wrapper is not suitable to classify it.
For logisticRegressionTrainInterface
, a fitted multinomial logistic regression model.
For logisticRegressionPredictInterface
, a factor
vector with class predictions for
the samples in the test set.
Dario Strbenac
if(require(mnlogit)) { variables <- c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width") trainSamples <- c(1:45, 51:95, 101:145) testSamples <- c(46:50, 96:100, 146:150) trained <- logisticRegressionTrainInterface(DataFrame(iris[trainSamples, variables]), iris[trainSamples, "Species"]) predicted <- logisticRegressionPredictInterface(trained, DataFrame(iris[testSamples, variables])) }