Create python code to matlab ?

1 Ansicht (letzte 30 Tage)
Oman Wisni
Oman Wisni am 16 Nov. 2018
Kommentiert: Adam am 16 Nov. 2018
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 Kommentare
Oman Wisni
Oman Wisni am 16 Nov. 2018
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 am 16 Nov. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by