gc5
gc5

Reputation: 9898

Using mRMRe for feature selection with Categorical target variable

I am trying to use the mRMRe package in R to do a feature selection on a gene expression dataset.

My target variable is a categorical variable, i.e. each sample is associated to a class, which is used as target variable.

However, by using the mRMRe package, I get the following error when I try to load the data:

data <- mRMR.data(data = data)

Error in .local(.Object, ...): data columns must be either of numeric, ordered factor or Surv type
Traceback:

1. mRMR.data(data = data)
2. new("mRMRe.Data", ...)
3. initialize(value, ...)
4. initialize(value, ...)
5. .local(.Object, ...)
6. stop("data columns must be either of numeric, ordered factor or Surv type")

The first column has categorical labels, e.g. "Class1", "Class2", etc. When I use str(data) I get that the first column is of Factor type. However, it cannot be ordered because it is categorical.

Could it be possible that mRMRe cannot handle categorical data?

Upvotes: 3

Views: 1925

Answers (2)

gc5
gc5

Reputation: 9898

I received an answer from the developers and:

The target variable can be categorical only if ordered. In the case of 2 categories, the order is arbitrary. For more categories that are not logically ordered (multicategorical classification) mRMRe is not adapted.

So in this case I cannot use it since my labels are categorical.

Upvotes: 4

RajaSekhar
RajaSekhar

Reputation: 61

The column has to be converted into ordered factor by ordered(data$variable1) str(data) should look like Ord.factor

Upvotes: 1

Related Questions