Computer Science > CODING SOLUTION > CS 4641 Machine Learning- NN.py Import numpy as np ''' We are going to use the diabetes dataset (All)
import numpy as np ''' We are going to use the diabetes dataset provided by sklearn https://scikit-learn.org/stable/datasets/toy_dataset.html#diabetes-dataset to train a 2 fully connected layer ne ... ural net. We are going to build the neural network from scratch. ''' class dlnet: def __init__(self, x, y, lr = 0.01, batch_size=64, momentum=0.5, use_dropout=True, dropout_prob=0.3): ''' This method initializes the class, it is implemented for you. Args: x: data y: labels Yh: predicted labels dims: dimensions of different layers alpha: slope coefficient for leaky relu param: dictionary of different layers parameters ch: Cache dictionary to store forward parameters that are used in backpropagation loss: list to store loss values lr: learning rate sam: number of training samples we have momentum: coefficient for momentum-based update step change: dict of previous changes for each layer ''' self.X=x # features self.Y=y # ground truth labels self.Yh=np.zeros((1,self.Y.shape[1])) # estimated labels self.dims = [10, 15, 1] # dimensions of different layers self.alpha = 0.05 self.use_dropout = use_dropout self.dropout_prob = dropout_prob self.param = {} # dictionary for different layer variables self.ch = {} # cache for holding variables during forward propagation to use them in back prop self.loss = [] # list to store loss values self.batch_y = [] # [Show More]
Last updated: 1 year ago
Preview 2 out of 8 pages
Loading document previews ...
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 23, 2023
Number of pages
8
Written in
All
This document has been written for:
Uploaded
Apr 23, 2023
Downloads
0
Views
143
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·