How to compute several means for same class
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello.
I want to use prototypical networks using an average of the same class.
This link is very useful for me, but I didn't find a specific answer. (Thank you so much. Ameer Hamza)
https://www.mathworks.com/matlabcentral/answers/514912-how-to-use-calculate-the-several-means-of-same-class
Each class has 10 data (rows), I want to select 5 rows randomly and compute the mean of selected rows.
Finally, I hope to get several rows for same class.
For example,
1 row : the first mean of class 1 (randomly selected 5 rows)
2 row : the second mean of class 1 (randomly selected 5 rows)
......................
Could I get great idea to fix this code?
data = csvread('outfile.csv');
values = data(:,1:end-1);
labels = data(:,end);
avg = splitapply(@(x) {mean(x,1)}, values, labels+1);
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!