Прошу об'яснить.
Code: Select all
scores = [3.0, 1.0, 0.2]
import numpy as np
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
x=np.asarray(x) # casting input into array
out=x # preparing function out format
c=0 #column index
for column in x.T:
out[:,c]=np.exp(column)/sum(np.exp(column))
c=c+1;
return out