• + 0 comments
    from sklearn import linear_model
    
    X = []
    y = []
    shape = list(map(int, input().split()))
    new_X = []
    
    for _ in range(shape[1]):
        parts = list(map(float, input().split()))
        X.append(parts[:shape[0]])
        y.append(parts[-1])
        
    for _ in range(int(input())):
        new_X.append(list(map(float, input().split())))
        
    lm = linear_model.LinearRegression()
    lm.fit(X, y)
    y_hat = lm.predict(new_X)
    for y in y_hat:
        print(f'{y:.2f}')