1. Home
  2. Explore
  3. Computer Science
  4. Neural Networks Intro

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Neural Networks Intro

  • 30Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Fundamentals of Neural Networks

What is an artificial neural network (ANN) and what is it inspired by?

30 questions

  1. 1

    What is an artificial neural network (ANN) and what is it inspired by?

    Model answer

    An ANN is a mathematical model for learning inspired by biological neural networks in the brain.

    Explanation

    The structure of biological neurons—connected units that receive, process, and propagate signals—motivated the design of ANNs as computational models.

  2. 2

    In a simple neural network, what does a unit (artificial neuron) compute?

    Model answer

    It computes a weighted sum of its inputs plus a bias, then passes the result through an activation function to produce an output.

    Explanation

    The output is g(w0+∑iwixi)g(w_0 + \sum_i w_i x_i)g(w0​+∑i​wi​xi​), where ggg is the activation function, w0w_0w0​ is the bias, wiw_iwi​ are weights, and xix_ixi​ are inputs.

  3. 3

    Describe three common activation functions used in neural networks.

    Model answer

    Step function: outputs 1 if input ≥ 0, else 0. Sigmoid: S-shaped curve outputting values between 0 and 1. ReLU: outputs the maximum of input and 0.

    Explanation

    Step gives binary output; sigmoid provides a probability-like real number; ReLU sets negative inputs to 0 and leaves positives unchanged, aiding gradient flow.

  4. 4

    Give the mathematical expression for the hypothesis function of a simple neural network with inputs x1x_1x1​ and x2x_2x2​, weights w1w_1w1​, w2w_2w2​, bias w0w_0w0​, and activation function ggg.

    Model answer

    h(x1,x2)=g(w0+w1x1+w2x2)h(x_1, x_2) = g(w_0 + w_1 x_1 + w_2 x_2)h(x1​,x2​)=g(w0​+w1​x1​+w2​x2​)

    Explanation

    This linear combination of inputs plus bias is passed through activation function ggg to produce the output.

  5. 5

    What is the limitation of a single perceptron (a single unit with binary classification)?

    Model answer

    It can only learn linearly separable decision boundaries.

    Explanation

    A perceptron computes a linear combination of inputs and applies a threshold, so it can only separate classes with a straight line (or hyperplane) and fails for non-linearly separable data like XOR.

  6. 6

    Using a step activation function, find weights and bias for a neural network that computes the OR function.

    Model answer

    Weights: w1=1w_1 = 1w1​=1, w2=1w_2 = 1w2​=1, bias w0=−1w_0 = -1w0​=−1.

    Explanation

    For input (0,0): 0+0−1=−10+0-1=-10+0−1=−1 → step → 0. For (1,0): 1+0−1=01+0-1=01+0−1=0 → step → 1. For (1,1): 1+1−1=11+1-1=11+1−1=1 → step → 1. So it models OR correctly.

  7. 7

    Using a step activation function, find weights and bias for a neural network that computes the AND function.

    Model answer

    Weights: w1=1w_1 = 1w1​=1, w2=1w_2 = 1w2​=1, bias w0=−2w_0 = -2w0​=−2.

    Explanation

    For (0,0): 0+0−2=−20+0-2=-20+0−2=−2 → 0; (0,1): 0+1−2=−10+1-2=-10+1−2=−1 → 0; (1,0): 1+0−2=−11+0-2=-11+0−2=−1 → 0; (1,1): 1+1−2=01+1-2=01+1−2=0 → step → 1. So only both 1 gives output 1.

  8. 8

    What is gradient descent and what is its purpose in training neural networks?

    Model answer

    Gradient descent is an algorithm that minimizes loss by iteratively updating weights in the direction of the negative gradient of the loss function.

    Explanation

    The gradient indicates the steepest ascent; moving opposite to it reduces loss. The update rule is w:=w−α∇Lw := w - \alpha \nabla Lw:=w−α∇L, where α\alphaα is the learning rate.

  9. 9

    What is the main computational expense in standard gradient descent, and how do stochastic and mini-batch gradient descent address it?

    Model answer

    Standard gradient descent uses all data points to compute the gradient, which is expensive. Stochastic gradient descent uses one random point per update, and mini-batch uses a small batch, both making computation faster at the cost of noisier gradients.

    Explanation

    All-data gradient descent requires a full pass over the dataset each iteration; stochastic uses one point, mini-batch uses a small subset, offering a trade-off between accuracy and speed.

  10. 10

    How does backpropagation enable training of multilayer neural networks?

    Model answer

    Backpropagation computes the gradient of the loss with respect to each weight by propagating the error backward from the output layer through hidden layers.

    Explanation

    It uses the chain rule to calculate how much each weight contributed to the output error, allowing gradient descent to update all layers even when only output errors are known.

  11. 11

    What is dropout and why is it used?

    Model answer

    Dropout is a regularization technique that randomly removes a fraction of units (with their connections) during training to prevent overfitting by reducing reliance on any single unit.

    Explanation

    By temporarily dropping units, the network learns more robust features and generalizes better to unseen data.

  12. 12

    Define a deep neural network.

    Model answer

    A deep neural network is an artificial neural network with multiple hidden layers between the input and output layers.

    Explanation

    Depth allows the model to learn hierarchical representations, from simple features in early layers to complex abstractions in later layers.

  13. 13

    What is computer vision?

    Model answer

    Computer vision is the field of computational methods for analyzing and understanding images.

    Explanation

    It involves tasks like object recognition, facial recognition, and handwriting recognition by extracting meaningful information from visual data.

  14. 14

    Explain image convolution and its purpose.

    Model answer

    Image convolution applies a kernel (filter) to an image by sliding it over every region, computing the sum of element-wise multiplications to produce a feature map that extracts features like edges or textures.

    Explanation

    Convolution preserves spatial structure and can detect patterns such as edges, corners, or curves, which are useful for higher-level analysis.

  15. 15

    What is a kernel matrix in image convolution?

    Model answer

    A kernel matrix is a small grid of numbers (e.g., 3x3) that defines how to weight a pixel and its neighbors when computing the convolution output for a region.

    Explanation

    The kernel is applied to each local patch of the image; its values determine what feature is detected, e.g., an edge-detection kernel has a central high value and negative neighbors.

  16. 16

    What is a feature map?

    Model answer

    A feature map is the output image produced by applying a filter (kernel) to an input image via convolution, highlighting regions where the filter's pattern is present.

    Explanation

    Each filter produces one feature map; multiple filters generate multiple maps capturing different features.

  17. 17

    Describe the kernel used for edge detection in the provided example and explain why it works.

    Model answer

    The kernel is a 3x3 matrix with 8 in the center and -1 in all eight neighbors. It produces a high output when the center pixel differs significantly from its neighbors (indicating an edge), and zero when all pixels are equal.

    Explanation

    The sum of the kernel values is 0, so uniform regions cancel out; a large positive value indicates the center is brighter than its surroundings, detecting edges.

  18. 18

    What is pooling and what are two common types?

    Model answer

    Pooling reduces the spatial size of a feature map by summarizing regions, typically using max-pooling (taking the maximum value) or average-pooling (taking the average).

    Explanation

    Pooling downsamples the representation, making it more compact and invariant to small translations, and reduces the number of parameters for the next layers.

  19. 19

    Explain the typical architecture of a convolutional neural network (CNN).

    Model answer

    A CNN typically consists of convolution layers (to extract features), pooling layers (to reduce dimensions), a flattening step, and then one or more fully connected (dense) layers for classification.

    Explanation

    Convolution and pooling are often repeated multiple times to learn low-level then high-level features, after which dense layers perform the final prediction.

  20. 20

    What is the MNIST dataset and how is it commonly used?

    Model answer

    MNIST is a dataset of 28x28 grayscale images of handwritten digits (0-9), used to train and evaluate image classification models.

    Explanation

    It contains 60,000 training and 10,000 test samples, serving as a benchmark for digit recognition tasks.

  21. 21

    How does a convolutional neural network learn what filters to use?

    Model answer

    During training with backpropagation, the CNN learns the values of the kernel (filter) weights that minimize the loss on the training data.

    Explanation

    The filters are treated as trainable parameters, and gradient descent adjusts them to extract the most discriminative features for the task.

  22. 22

    What is the key difference between a feed-forward neural network and a recurrent neural network (RNN)?

    Model answer

    In a feed-forward network, connections go only from input to output (one direction), while an RNN has connections that feed output back into itself as input for future steps, allowing it to maintain state.

    Explanation

    Feed-forward networks have fixed-size inputs/outputs and no memory of past inputs; RNNs can process sequences by using internal state that evolves over time.

  23. 23

    Why are RNNs particularly useful for processing sequences of data?

    Model answer

    RNNs can handle variable-length sequences by processing one element at a time and passing information from previous steps to the current step via a hidden state.

    Explanation

    This allows them to capture temporal dependencies and patterns across time steps, making them suitable for tasks like language modeling, video analysis, and time series prediction.

  24. 24

    Give an example of a one-to-many RNN architecture and a task it solves.

    Model answer

    Image captioning: one input (an image) produces a sequence of words (caption). The network first encodes the image, then generates one word at a time feeding previous output back as input.

    Explanation

    Microsoft's CaptionBot uses such an architecture: it takes an image and outputs a sentence describing it.

  25. 25

    Give an example of a many-to-one RNN architecture and a task it solves.

    Model answer

    Sentiment classification: a sequence of words (movie review) is processed, and the final output is a single classification (positive/negative).

    Explanation

    The RNN reads the entire sequence and uses the final hidden state to make the decision.

  26. 26

    Give an example of a many-to-many RNN architecture and a task it solves.

    Model answer

    Machine translation: a sequence in one language is read entirely (encoding phase) and then the network generates a sequence in another language (decoding phase).

    Explanation

    This seq2seq architecture handles different input/output lengths and word order differences between languages.

  27. 27

    What is an LSTM and its advantage over a basic RNN?

    Model answer

    LSTM (Long Short-Term Memory) is a type of RNN designed to learn long-term dependencies by using gating mechanisms to control information flow, mitigating the vanishing gradient problem.

    Explanation

    Basic RNNs struggle with long sequences due to vanishing gradients; LSTMs maintain a cell state and use input, forget, and output gates to remember information over many time steps.

  28. 28

    In the MNIST handwriting recognition example, why is a convolutional neural network used instead of a simple feed-forward network?

    Model answer

    CNNs leverage spatial structure in images via convolution and pooling, learning local features like edges and shapes, which is more effective than treating all pixels as independent inputs in a feed-forward net.

    Explanation

    CNNs reduce the number of parameters and incorporate translation invariance, improving performance on image data.

  29. 29

    In the handwriting.py code, what does the softmax activation function do in the output layer?

    Model answer

    Softmax converts the output vector into a probability distribution over the 10 digit classes, where the values sum to 1.

    Explanation

    It exponentiates each output and normalizes by the sum, making them interpretable as probabilities for multi-class classification.

  30. 30

    Describe the role of the validation set in choosing hyperparameters like number of hidden layers or units.

    Model answer

    The validation set is used to evaluate model performance during training and to tune hyperparameters by selecting the configuration that yields the best validation accuracy, helping to avoid overfitting.

    Explanation

    It provides an unbiased estimate of model performance on unseen data, guiding decisions without touching the test set.

1 of 30
Question 1 of 30

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent