def _make_poly_list(matr: Matrix, degree: int):
    matr = paste_ones_in_the_beginning(matr)
    map_list = list(
        map(lambda n: (matr.pow_matrix(n)).arr, range(1, degree + 1)))
    map_list = Matrix(map_list[0])

    return map_list
示例#2
0
    def predict(self, X: Matrix):
        X = paste_ones_in_the_beginning(X)
        y_pred = multiply_matrix_and_vector(X, self.b)

        return y_pred.arr
示例#3
0
    def fit(self, X: Matrix, y: Matrix):
        X = paste_ones_in_the_beginning(X)
        self.b = _find_coeff(X, y, self.alpha)

        return self