Skip to content

Instantly share code, notes, and snippets.

@akarsh-saxena
Last active May 21, 2020 21:35
Show Gist options
  • Save akarsh-saxena/1459b3a2e62c9c931a12f6dbdbbb8e21 to your computer and use it in GitHub Desktop.
Save akarsh-saxena/1459b3a2e62c9c931a12f6dbdbbb8e21 to your computer and use it in GitHub Desktop.
import numpy as np
def initialize_nn(X):
"""Initializes random weights and bias
Arguments
---------
X: array-like
Train Dataset
Returns
-------
dict
Contains the randomly initialized weights and bias arrays where-
shape(weights) = (X.Shape[0], 1)
bias = float value
The keys for weights and bias arrays in the dict is 'w' and 'b'
"""
np.random.seed(999)
w = np.random.randn(X.shape[1], 1) * 0.01
b = 0
return {'w': w, 'b': b}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment