967e77866ca63db25f5b688db4be5d55480a1102,mlxtend/classifier/softmax_regression.py,SoftmaxRegression,_softmax,#SoftmaxRegression#Any#,81

Before Change


        return (X.dot(W) + b)

    def _softmax(self, z):
        return (np.exp(z.T) / np.sum(np.exp(z), axis=1)).T

    def _cross_entropy(self, output, y_target):
        return - np.sum(np.log(output) * (y_target), axis=1)

After Change


        return (X.dot(W) + b)

    def _softmax(self, z):
        e_x = np.exp(z - z.max(axis=1, keepdims=True))
        out = e_x / e_x.sum(axis=1, keepdims=True)
        return out
        //return (np.exp(z.T) / np.sum(np.exp(z), axis=1)).T

    def _cross_entropy(self, output, y_target):
        return - np.sum(np.log(output) * (y_target), axis=1)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: rasbt/mlxtend
Commit Name: 967e77866ca63db25f5b688db4be5d55480a1102
Time: 2016-07-13
Author: mail@sebastianraschka.com
File Name: mlxtend/classifier/softmax_regression.py
Class Name: SoftmaxRegression
Method Name: _softmax


Project Name: rasbt/mlxtend
Commit Name: 967e77866ca63db25f5b688db4be5d55480a1102
Time: 2016-07-13
Author: mail@sebastianraschka.com
File Name: mlxtend/classifier/softmax_regression.py
Class Name: SoftmaxRegression
Method Name: _softmax


Project Name: allenai/allennlp
Commit Name: 83d0253cd1bcba18b9fe31961146a8e81c0eae8c
Time: 2017-10-12
Author: mattg@allenai.org
File Name: allennlp/nn/util.py
Class Name:
Method Name: masked_softmax


Project Name: rasbt/mlxtend
Commit Name: 967e77866ca63db25f5b688db4be5d55480a1102
Time: 2016-07-13
Author: mail@sebastianraschka.com
File Name: mlxtend/classifier/multilayerperceptron.py
Class Name: MultiLayerPerceptron
Method Name: _softmax