How to make code to split, compute mean, apply Softmax

I have 90 datasets (9 data x 10 labels)
1. split the dataset into support(80dataset) and query(10dataset)
2. Compute each mean of examples(9 means)
3. Compute the Euclidean distance between each mean and query(10dataset)
4. apply Softmax and calculate probabilities
5. compute accuracy

 採用された回答

Gaurav Garg
Gaurav Garg 2020 年 3 月 20 日
編集済み: Gaurav Garg 2020 年 3 月 20 日

0 投票

Hi,
You can use splitapply function to split your whole data into 9 groups and apply the mean function to each group. It would return you an array of 9 elements, where each element is a mean to one group. You can now, carry on with the third step to compute the Euclidean distance between each mean and the query set, and proceed with steps 4 and 5.
Algo:
Y=splitapply (mean, X, G); % G is a vector of group numbers, X is the whole data
for i=1:8
% compute Euclidean distance between Y[i] and query dataset
end
% Steps 4 and 5

3 件のコメント

Kong
Kong 2020 年 3 月 20 日
編集済み: Kong 2020 年 3 月 20 日
Thank you so much.
Could you let me know how to find Group (G)?
I have a dataset (90 x 2857), The last column (2857) is class.
Sindar
Sindar 2020 年 3 月 23 日
If your dataset is X and the last column is not part of the data:
G = findgroups(X(:,end));
Y = splitapply(mean, X(:,1:end-1), G);
Gaurav Garg
Gaurav Garg 2020 年 3 月 23 日
Hi Kong,
Kindly go through the link here.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

質問済み:

2020 年 3 月 16 日

コメント済み:

2020 年 3 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by