Changing 'double' to 'dataset'
16 views (last 30 days)
Show older comments
Hello guys, I'm up for a Multivariate Statistics and Pattern Recognition exam on Monday, and I am in trouble. I'm supposed to start off by doing Leave-one-out cross validation on a dataset I have acquired (<http://archive.ics.uci.edu/ml/datasets/seeds> that one), but I can't even seem to get started.
I believe LOOCV builds a test and a trainingset, and so far I have looked at the 'crossval' and 'cvpartition' classes, but I can't figure out what to feed them.
Additionally, as I've been going through our notes for this class, it seems the simplest code wont work on my dataset, because it is a 'double' instead of a 'dataset' - can someone tell me how to change that?
Thank you for your time.
0 Comments
Answers (4)
Azzi Abdelmalek
on 11 Jan 2013
Edited: Azzi Abdelmalek
on 11 Jan 2013
x=1:20
out=dataset(x)
0 Comments
Peter Perkins
on 11 Jan 2013
Mads, "doing Leave-one-out cross validation on a dataset" is way too vague to understand what statistical model or method you're trying to cross-validate, but as far as creating a dataset array from a text file, it's a simple call to the constructor:
ds = dataset('File','seeds_dataset.txt','ReadVarNames',false, ...
'VarNames',{'Area' 'Perimeter' 'Compactness' 'Length' 'Width' 'Asymmetry' 'Groove','Variety'})
Of course, it turns out that the file is tab-delimited but has some double tabs in it, which you'll have to clean up in a text editor.
Actually, I can't tell from your description if your problem is that you want to create a dataset array, or if you already have one and want to create a double matrix from it. If the latter is what you need to do, then it's just
x = double(ds)
Hope this helps.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!