| 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 |