indices to column vectros of a matrix using “crossvalind”

1 Ansicht (letzte 30 Tage)
laplace laplace
laplace laplace am 7 Jun. 2013
i got a 3x50 matrix. i would like to obtain the 50 3x1 column vectors and assign to them indices using the crossvalind command seen above
Indices = crossvalind('Kfold',N, 10);
so lets hypotheticaly say that i had a 3x3 matrix named "input" :
input=[1 2 3;4 5 6;7 8 9]
how can I imply an index generation for the vector columns of my "input" matrix using crossvalind?
A=[1;4;7]
B=[2;5;9]
C=[3;6;9]
**the reason i wanna do it is so i can after apply cross validation while having as train/test set these column vectors

Antworten (3)

Azzi Abdelmalek
Azzi Abdelmalek am 7 Jun. 2013
  3 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 7 Jun. 2013
What are your feeling about this?
A=[1;4;7]
Indices = arrayfun(@(x) crossvalind('Kfold',x, 10),A,'un',0);
laplace laplace
laplace laplace am 10 Jun. 2013
can you explain me the command you wrote :D maybe its correct and i am doing smth wrong :(

Melden Sie sich an, um zu kommentieren.


laplace laplace
laplace laplace am 10 Jun. 2013
Bearbeitet: laplace laplace am 10 Jun. 2013
inputs is the 3x50 matrix
C = num2cell(inputs,1);
Indices = cellfun(@(C) crossvalind('Kfold',C, 10),C,'un',0);
Indices =
Columns 1 through 9
[3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double]
Columns 10 through 18
[3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double]
Columns 19 through 27
[3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double]
Columns 28 through 36
[3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double]
Columns 37 through 45
[3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double]
Columns 46 through 50
[3x1 double] [3x1 double] [3x1 double] [3x1 double] [3x1 double]
what i wanted to get was just indices for each column vector... any thoughts?

laplace laplace
laplace laplace am 16 Jun. 2013
noone?:D

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by