MCPcopy Index your code
hub / github.com/ujjwalkarn/DataSciencePython / get_p

Function get_p

Logistic-Regression/citreo_code_v2.py:50–54  ·  view source on GitHub ↗
(x, w)

Source from the content-addressed store, hash-verified

48# OUTPUT:
49# probability of p(y = 1 | x; w)
50def get_p(x, w):
51 wTx = 0.
52 for i in x: # do wTx
53 wTx += w[i] * 1. # w[i] * x[i], but if i in x we got x[i] = 1.
54 return 1. / (1. + exp(-max(min(wTx, 20.), -20.))) # bounded sigmoid
55
56
57# D. Update given model

Callers 1

citreo_code_v2.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected