Good day!
There is a function of two variables (decision function):
def dec_func(self, x, y): res = 0 for i, w in enumerate(self.W): res += w * self.F[i](Point(x, y)) return res It is necessary to plot this function when res = 0. That is, you need from the list X for each x to get such y, so that when the function is executed, the result is equal to 0.
UPD:
There is an implemented function that, according to given X, can get approximately true Y (with a certain accuracy):
def plot_data(self, start=-15, end=15, step=1): X = [i for i in range(start, end, step)] Y = [] x_to_remove = [] for x in X: k = 0 y_old = 0 step = 0.05 old_res = self.dec_func(x, y_old) while abs(old_res) > 0.01: if k > 3000: break k += 1 y = y_old + step res = self.dec_func(x, y) if abs(old_res) > abs(res): y_old = y step *= 1.2 else: y_old = y step = -step / 2 old_res = res if k > 3000: print(y_old, x, old_res) x_to_remove.append(x) else: Y.append(y_old) for x in x_to_remove: X.remove(x) return X, Y But the problem is that this implementation does not allow to get several values of y for one x.
self.Wobjectsself.Wandself.F?Pointis a class? What library is it from, or is it your own class or function? And what exactly you can not? - mkkik