MCPcopy Create free account
hub / github.com/WenDesi/lihang_book_algorithm / predict_

Method predict_

softmax/softmax.py:51–59  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

49 return -x*(first-second) + self.weight_lambda*self.w[j]
50
51 def predict_(self, x):
52 result = np.dot(self.w,x)
53 row, column = result.shape
54
55 # 找最大值所在的列
56 _positon = np.argmax(result)
57 m, n = divmod(_positon, column)
58
59 return m
60
61 def train(self, features, labels):
62 self.k = len(set(labels))

Callers 1

predictMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected