フィルターのクリア

To separate a set of data into two groups

5 ビュー (過去 30 日間)
Anusha
Anusha 2013 年 8 月 23 日
コメント済み: Walter Roberson 2015 年 6 月 26 日
Assume we have the following array as declared in the following example: x(1)=1 x(2)=2 x(3)=3 x(4)=4 x(5)=5 . up to . . x(100)=100 Assume we have already read this array (i.e stored already in x(i)) how can write a MATLAB code to select 30% of the observation x(i).How can form two groups ,1st containing 30% and 2nd containing 70%
  1 件のコメント
Image Analyst
Image Analyst 2013 年 8 月 23 日
How do you want to select them? Randomly? By taking there value into account somehow? There are several ways that you could use to either select two groups (randomly, by percentiles, etc.) or to classify your data into two groups (e.g. kmeans, SVM, fuzzy c-means, etc.)

サインインしてコメントする。

採用された回答

UJJWAL
UJJWAL 2013 年 8 月 23 日
You need to mention whether you want data to be divided randomly or is there a certain sequence or rule following which you want the division to be carried out.
In case , there is a certain rule or pattern you need to mention it and the associated difficulty therein so that we can answer accurately. If the division is to be carried out randomly, then the very first things that come to my mind are :-
a) Use randsample to randomly sample 30 values out of the 100 values and take it in one group and the rest of the elements in the other group.
b) Use k-fold validation (see cvpartition in matlab).
Depending on the particular application you have in your mind use the relevant function. If you have any further queries, put it in clear words and I would be happy to help
Ujjwal
  1 件のコメント
Anusha
Anusha 2013 年 8 月 24 日
Actually I want to do Bayesian classifier.The data set is a 500x2 matrix and I want to select randomly 70% of this data as training data and 30% as testing data.How can I do this using matlab code..please reply..

サインインしてコメントする。

その他の回答 (1 件)

carenar
carenar 2015 年 6 月 26 日
I have a similar problem in that I am trying to split my data into two parts (ie at the max y value and its corresponding x value). how would I do so?
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 26 日
[maxy, maxyidx] = max(y);
x1 = x(1:maxyidx);
x2 = x(maxyidx+1:end);
y1 = y(1:maxyidx);
y2 = y(maxyidx+1:end);
You were not specific about whether the maximum itself should go into the first set or the second set.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by