Question: Complete all the todos? class LeastMeanSquares (LinearModel): Performs regression using least mean squares (gradient descent) attributes: w (np.ndarray): weight matrix alpha (float): learning rate or

    • Complete all the todos?


 class LeastMeanSquares (LinearModel): Performs regression using least mean squares (gradient descent)

class LeastMeanSquares (LinearModel): Performs regression using least mean squares (gradient descent) attributes: w (np.ndarray): weight matrix alpha (float): learning rate or step size epochs (int): Number of epochs to run for mini-batch gradient descent seed (int): Seed to be used for NumPy's RandomState class or universal seed np.random.seed() function. definit__(self, alpha: float, epochs: int, seed: int = None): super().__init__() self.w None self.alpha= alpha self.epochs self.seed seed def fit (self, X: np.ndarray, y: np.ndarray) -> None: """ Used to train our model to learn optimal weights. TODO: epochs Finish this method by adding code to perform LMS in order to learn the weights self.w`. def predict (self, X: np.ndarray) -> np.ndarray: """ Used to make a prediction using the learned weights. TODO: Finish this method by adding code to make a prediction given the learned weights 'self.w`. # TODO (REQUIRED) Add code below. # TODO (REQUIRED) Store predictions below by replacing np.ones() y_hat = | return y_hat

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the completed code for the fit and predict methods class LeastMeanSquaresLinearModel def init... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!