Create python code to matlab ?

Hi, I have code Python like below :
probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True)
Then, I write to matlab code
probs = exp_scores/sum(exp_scores);
My question is, my code above is correct in matlab ? Thanks

3 件のコメント

Adam
Adam 2018 年 11 月 16 日
編集済み: Adam 2018 年 11 月 16 日
Surely you can just look at the result and compare it to the python result. It depends what exp_scores is. If it is non-scalar then you would likely need to use
./
Oman Wisni
Oman Wisni 2018 年 11 月 16 日
I'm not use Python sir, so I don't know what the result from Python.
exp_scores is matrix with 220x11 dimension.
In code Python I write above contain with axis=1, what is mean. Should I add in my matlab code too?
Adam
Adam 2018 年 11 月 16 日
axis = 1
in python means sum along dimension 1, but python indexes from 0 whereas Matlab indexes from 1 so I would think that you need
sum( exp_scores, 2 )
in Matlab.

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

回答 (0 件)

カテゴリ

タグ

質問済み:

2018 年 11 月 16 日

コメント済み:

2018 年 11 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by