MCPcopy Create free account
hub / github.com/bgrimstad/splinter / add_sample

Method add_sample

python/splinter/datatable.py:40–52  ·  view source on GitHub ↗
(self, x, y)

Source from the content-addressed store, hash-verified

38
39 # "Public" methods (for use by end user of the library)
40 def add_sample(self, x, y):
41 if not isinstance(x, list):
42 x = [x]
43
44 if self.__x_dim is None:
45 self.__x_dim = len(x)
46
47 if self.__x_dim != len(x):
48 raise Exception("Dimension of the new sample disagrees with the dimension of previous samples!\nPrevious: " + str(self.__x_dim) + ", new: " + str(len(x)))
49
50 self.__samples += list(x)
51 self.__samples += [y]
52 self.__num_samples += 1
53
54 def get_num_variables(self):
55 return self.__x_dim

Callers 1

__init__Method · 0.95

Calls 1

ExceptionClass · 0.85

Tested by

no test coverage detected