fscmrmr output only zero scores, is it possible?

5 次查看(过去 30 天)
fscmrmr function outputs only zero score for all features. I don't know if this is the expected behaviour.
[idx, scores] = fscmrmr(features,Y);
results = [idx;scores];
disp(results)
%features is a matrix. In each row there is one observation. In each column there is one feature.
% Y is a logical vector (labels 1 and 0). It shows the same behaviour even if i use tables.
  4 个评论
John D'Errico
John D'Errico 2023-9-12
编辑:John D'Errico 2023-9-12
Without seeing the specific data posed, it is impossible to know. Can it return zero scores, yes, I would bet that is the case. In fact, I am even positive that is the case, since in a random test case I just tried, that was true. But that just means you are probably misunderstanding how the code should be used.
help fscmrmr
FSCMRMR Importance of features (predictors) for classification using MRMR algorithm. IDX=FSCMRMR(TBL,Y) ranks predictors for table TBL and class label Y. The ranks are learned using the Minimum Redundancy Maximum Relevance algorithm. TBL contains the predictor variables. Y can be any of the following: 1. An array of class labels. Y can be a categorical array, logical vector, numeric vector, string array or cell array of character vectors. 2. The name of a variable in TBL. This variable is used as the response Y, and the remaining variables in TBL are used as predictors. 3. A formula character vector such as 'y ~ x1 + x2 + x3' specifying that the variable y is to be used as the response, and the other variables in the formula are predictors. Any table variables not listed in the formula are not used. IDX=FSCMRMR(X,Y) is an alternative syntax that accepts X as an N-by-P matrix of predictors with one row per observation and one column per predictor. Y is the response and is an array of N class labels. IDX is a 1-by-P vector for P predictors. IDX are indices of columns in X ordered by importance, meaning IDX(1) is the index of the most important predictor. [IDX,SCORES]=FSCMRMR(...) also returns predictor scores SCORES, a 1-by-P array for P predictors. SCORES have the same order as predictors in the input data, meaning SCORES(1) is the score for the first predictor. Large score indicates important predictor. [...]=FSCMRMR(X,Y,'PARAM1',val1,'PARAM2',val2,...) specifies optional parameter name/value pairs: 'CategoricalPredictors' - List of categorical predictors. Pass 'CategoricalPredictors' as one of: * A numeric vector with indices between 1 and P, where P is the number of columns of X or variables in TBL. * A logical vector of length P, where a true entry means that the corresponding column of X or TBL is a categorical variable. * 'all', meaning all predictors are categorical. * A string array or cell array of character vectors, where each element in the array is the name of a predictor variable. The names must match variable names in table TBL. Default: for a matrix input X, no categorical predictors; for a table TBL, predictors are treated as categorical if they are strings, cell arrays of character vectors, logical, or unordered of type 'categorical'. 'ClassNames' - Array of class names. Use the data type that exists in Y. You can use this argument to select a subset of classes out of all classes in Y. Default: All class names in Y. 'Prior' - Prior probabilities for each class. Specify as one of: * A character vector: - 'empirical' determines class probabilities from class frequencies in Y - 'uniform' sets all class probabilities equal * A vector (one scalar value for each class) * A structure S with two fields: S.ClassProbs containing a vector of class probabilities, and S.ClassNames classes containing the class names and defining the ordering of classes used for the elements of this vector. If you pass numeric values, FSCMRMR normalizes them to add up to one. Default: 'empirical' 'UseMissing' - Logical value specifying whether missing values in the predictors must be used or discarded. When 'UseMissing' is set to true, FSCMRMR groups together missing values and uses them to compute mutual information between pairs of features and between each feature and the response variable. When 'UseMissing' is set to false, FSCMRMR omits missing values in each feature while computing the mutual information. Default: false 'Weights' - Vector of observation weights, one weight per observation. FSCMRMR normalizes the weights to add up to the value of the prior probability in the respective class. Default: ones(size(X,1),1). For an input table TBL, the 'Weights' value can be the name of a variable in TBL. 'Verbose' - Verbosity flag, a nonnegative integer: * 0 - FSCMRMR does not display any diagnostic messages (default). * 1 - FSCMRMR displays major diagnostic info. * >1 - FSCMRMR displays a lot of diagnostic info. Example: % Identify important predictors in the ionosphere dataset: load ionosphere [idx,scores] = fscmrmr(X,Y); bar(scores(idx)) xlabel('Predictor rank') ylabel('Predictor importance score') Documentation for fscmrmr doc fscmrmr
A quick run of the sample test problem they supply in the help shows this:
load ionosphere
[idx,scores] = fscmrmr(X,Y)
idx = 1×34
5 4 1 7 24 29 12 3 34 33 15 21 9 32 31 27 25 8 13 19 30 6 23 10 11 17 16 14 2 18
scores = 1×34
0.0662 0 0.0214 0.0756 0.2905 0.0068 0.0345 0.0085 0.0128 0.0063 0.0023 0.0274 0.0079 0.0007 0.0145 0.0014 0.0018 0 0.0073 0 0.0141 0 0.0066 0.0310 0.0086 0 0.0098 0 0.0280 0.0072
Anyway, in order to understand what you did wrong to get the results you got, you need to show the data you tried to pass into that code.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model Building and Assessment 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by