how to split a dataset for training and testing in matlab?
20 views (last 30 days)
Show older comments
i have a dataset in .mat format with variables having different dimensions. i want to used this dataset to train the machine learning algorithm. Before training , first i need to split the data into two- one for training and one for testing. Can someone please help me out with this problem?
2 Comments
Sargondjani
on 22 Jan 2023
Please be more precie what your problem is. I mean, can you import the data? And when you import the data how do you want to split the data set? Basically you just have to split your matrix in two. What is your problem there?
Accepted Answer
the cyclist
on 22 Jan 2023
randsample, cvpartition, and randperm can all be useful for creating training/test splits. As @Sargondjani mentions, we need more info to give a more specific solution.
2 Comments
the cyclist
on 22 Jan 2023
I did look at the data on the github repo. (For the sake of anyone else here, I have attached a screenshot of what the variable workspace looks like.)
Please think about this from our perspective. You have 27 variables, we have no idea what they all mean. (Of course, we can guess a little bit from the variable names and the github repo name.)
Unless you can be a lot more specific about exactly what you are trying to do, there is no chance that we can help you. We don't know what you are trying to predict. We don't know what the features are. (This would sometimes be called the response and explanatory variables.)
It is unusual that some of the variables are close -- but not exactly -- the same dimension. We can't figure that out for you.
If you just have one specific variable that you are trying to split into training and test sets, that is easy. But it seems you need more help than just that.
More Answers (0)
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!