MCPcopy Index your code
hub / github.com/clips/pattern / __init__

Method __init__

pattern/vector/svm/liblinear.py:100–120  ·  view source on GitHub ↗
(self, y, x, bias = -1)

Source from the content-addressed store, hash-verified

98 _fields_ = genFields(_names, _types)
99
100 def __init__(self, y, x, bias = -1):
101 if len(y) != len(x) :
102 raise ValueError("len(y) != len(x)")
103 self.l = l = len(y)
104 self.bias = -1
105
106 max_idx = 0
107 x_space = self.x_space = []
108 for i, xi in enumerate(x):
109 tmp_xi, tmp_idx = gen_feature_nodearray(xi)
110 x_space += [tmp_xi]
111 max_idx = max(max_idx, tmp_idx)
112 self.n = max_idx
113
114 self.y = (c_double * l)()
115 for i, yi in enumerate(y): self.y[i] = y[i]
116
117 self.x = (POINTER(feature_node) * l)()
118 for i, xi in enumerate(self.x_space): self.x[i] = xi
119
120 self.set_bias(bias)
121
122 def set_bias(self, bias):
123 if self.bias == bias:

Callers

nothing calls this directly

Calls 3

set_biasMethod · 0.95
lenFunction · 0.85
gen_feature_nodearrayFunction · 0.85

Tested by

no test coverage detected