dimanche 5 février 2023

Linear regression using nimpy

im running this code but im getting no output....can anyone tell me where im wrong

import numpy as np

def generate_data(σ, n, m):
    β = np.random.rand(m+1)
    X = np.random.rand(n, m)
    X = np.hstack([np.ones((n, 1)), X])
    e = np.random.normal(0, σ, n).reshape(-1, 1)
    Y = X @ β.reshape(-1, 1) + e
    return X, Y, β

I tried running this code in google colab but the cell is not running Im just getting a green tick......want to know how to make it work




Aucun commentaire:

Enregistrer un commentaire