Skip to content

Commit

Permalink
Update GD_regression
Browse files Browse the repository at this point in the history
  • Loading branch information
odasho committed Nov 18, 2020
1 parent 041754b commit 1689131
Show file tree
Hide file tree
Showing 30 changed files with 1,619 additions and 1,761 deletions.
Binary file modified .DS_Store
Binary file not shown.
1,335 changes: 0 additions & 1,335 deletions .ipynb_checkpoints/GD_Regression-checkpoint.ipynb

This file was deleted.

Binary file modified Figures/Algorithms.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_lr.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_lrs.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_momentum.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_particular_batch_size.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_particular_gamma.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_particular_lambda.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_particular_momentum.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_epochs_various_lr.pdf
Binary file not shown.
Binary file modified Figures/OLS_MSE_lrs_momentum_epochs_75.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_lrs_with_momentum_epochs_250.pdf
Binary file not shown.
Binary file added Figures/OLS_MSE_lrs_with_momentum_epochs_75.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Figures/OLS_MSE_mini_b_momentum.pdf
Binary file not shown.
Binary file added Figures/Ridge_MSE_epochs_overview.pdf
Binary file not shown.
Binary file added Figures/Ridge_MSE_epochs_particular_lambda.pdf
Binary file not shown.
Binary file added Figures/Ridge_MSE_epochs_various_lr.pdf
Binary file not shown.
1,260 changes: 1,260 additions & 0 deletions programs/.ipynb_checkpoints/GD_Regression-checkpoint.ipynb

Large diffs are not rendered by default.

778 changes: 354 additions & 424 deletions programs/GD_Regression.ipynb

Large diffs are not rendered by default.

Empty file added programs/__init__.py
Empty file.
Binary file modified programs/mylearn/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified programs/mylearn/__pycache__/linear_model.cpython-38.pyc
Binary file not shown.
Binary file modified programs/mylearn/__pycache__/ml_tools.cpython-38.pyc
Binary file not shown.
Binary file modified programs/mylearn/__pycache__/project_tools.cpython-38.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion programs/mylearn/linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def __init__(self, lmbda=0, eta=0.01, t0=5, t1=50, gamma=0.9,
self._batch_size = batch_size
self._fit_intercept = fit_intercept

def fit(self, X, y, weights="uniform", method="BGD"):
def fit(self, X, y, weights="uniform", seed_val=None, method="BGD"):
"""
Fit the model
----------
Expand All @@ -245,6 +245,9 @@ def fit(self, X, y, weights="uniform", method="BGD"):
self.target = y
self._method = method

if seed_val is not None:
np.random.seed(seed_val)

# check if X is 1D or 2D array
if len(self.data.shape) == 1: # find shape of array
# reshape takes all data with [-1] and makes it 2D
Expand Down
2 changes: 1 addition & 1 deletion programs/mylearn/project_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

# Set path to save the figures and data files
FIGURE_PATH = "./Figures"
FIGURE_PATH = "../Figures"


def fig_path(fig_id):
Expand Down

0 comments on commit 1689131

Please sign in to comment.