>Форум Mozilla Россия http://forum.mozilla-russia.org/index.php >Разработка http://forum.mozilla-russia.org/viewforum.php?id=18 >Deep Learning Interview Questions http://forum.mozilla-russia.org/viewtopic.php?id=78309 |
Magnet12 > 18-04-2023 12:19:11 |
I'm having difficulty understanding some of the deep-learning interview questions I've come across from an online resource. Specifically, I'm having trouble with some of the code examples. I'm hoping someone can provide some insight into how to approach these questions. I've included some of the code examples below for reference. Any help would be greatly appreciated. Example 1: Выделить код Код:def deepLearningModel(data): # Initialize weights weights = np.random.rand(len(data[0])) # Initialize bias bias = 0 # Hyperparameters learningRate = 0.1 numEpochs = 2000 # Train the model for epoch in range(numEpochs): # Calculate predicted values preds = np.dot(data, weights) + bias # Calculate gradients gradients = 2 * np.dot(data.T, (preds - data[:,-1])) weights -= learningRate * gradients bias -= learningRate * np.sum(preds - data[:,-1]) return weights, bias Example 2: Выделить код Код:def deepLearningModel(X, Y): # Initialize weights weights = np.random.rand(X.shape[1]) # Initialize bias bias = 0 # Hyperparameters learningRate = 0.1 numEpochs = 2000 # Train the model for epoch in range(numEpochs): # Calculate predicted values preds = np.dot(X, weights) + bias # Calculate gradients gradients = 2 * np.dot(X.T, (preds - Y)) weights -= learningRate * gradients bias -= learningRate * np.sum(preds - Y) return weights, bias |