ContentsFoundations to FrontierBezhig

graduate_code/starters/ml.py

All lab code. Download this file.

# Exercise scaffold. Reference implementation is in a separate directory.
"""G12: from-scratch binary logistic regression; no external dependencies."""
import math

def validate_xy(X, y):
    raise NotImplementedError('Implement this contract from the book.')

def sigmoid(z):
    raise NotImplementedError('Implement this contract from the book.')

def logit_loss(z, y):
    raise NotImplementedError('Implement this contract from the book.')

def loss_gradient(w, b, X, y, lam=0.0):
    raise NotImplementedError('Implement this contract from the book.')

def fit(X, y, lam=0.01, rate=0.1, steps=400):
    raise NotImplementedError('Implement this contract from the book.')

def predict(model, X):
    raise NotImplementedError('Implement this contract from the book.')