Полезная информация

В мире Mozilla происходит много интересных событий. Но вам не нужно постоянно посещать новостные сайты, чтобы быть в курсе всех изменений. Зайдите на ленту новостей Mozilla Россия.

№118-04-2023 12:19:11

Magnet12
Участник
 
Группа: Members
Зарегистрирован: 05-12-2022
Сообщений: 6
UA: Chrome 111.0

Deep Learning Interview Questions

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

Отредактировано Magnet12 (18-04-2023 12:20:41)

Отсутствует

 

Board footer

Powered by PunBB
Modified by Mozilla Russia
Copyright © 2004–2020 Mozilla Russia GitHub mark
Язык отображения форума: [Русский] [English]