필터 지우기
필터 지우기

sample from data according to a class with no replacement

조회 수: 1 (최근 30일)
MA
MA 2019년 9월 25일
답변: MA 2019년 9월 25일
Lets say that I have a matrix n*m where n represented the instances while m representing the attributes. I have another column vector which is n*1 where n represents the classes corresponding to the enstances of the matrix n*m. Now, I want to sample from the matrix n*m based on the classes vector n*1. So, that for instance I want K instances with no replacement belonging to the class L. Any one could help me in that.

채택된 답변

MA
MA 2019년 9월 25일
I just solve it. So, for anyone who is looking for an answer, it is the following:
new_sample= datasample(X(T==L,:),K,'replace',false);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by