フィルターのクリア

resampling an unbalanced dataset

3 ビュー (過去 30 日間)
Ege
Ege 2015 年 1 月 3 日
コメント済み: Image Analyst 2015 年 1 月 3 日
Hi, I have a dataset which has 2 classes(churn='False.' and churn='True.'). It is unbalanced because 700 of the 5000 sample is churn='False.' Is there a way to balance that distribution? Thank you in advance.

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 3 日
Throw out all but 700 items where churn = true??? Then you'd have 700 false ones and 700 true ones. If not, then tell us in more detail what "balance" means to you.
  3 件のコメント
Ege
Ege 2015 年 1 月 3 日
I have 700 churn=False which means remaining 4300 belongs to the other class (churn=True). so do you mean I should do it manually like delete the 3600 of the 4300 and create 700 & 700 balanced data?
Image Analyst
Image Analyst 2015 年 1 月 3 日
Uh, sure, if that's what you want. If it's in a table, you can automate it somewhat, like
% Find out which rows are true.
trueRows = find(t.churn);
% Take only the first 700:
trueRows = trueRows(1:max([length(trueRows), 700]));
% Find out which rows are false - we want to keep all those.
falseRows = find(t.churn == false);
% Combine the false and true rows into one list of indexes.
rowsToExtract = sort([falseRows, trueRows]);
% Now extract only the first 700 true, but all the false.
t = t(rowsToExtract );
or something like that. You might have to debug it some.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by