Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials AI What are Neural Networks?
AI Intermediate FREE

What are Neural Networks?

Lesson 1 of 17 Intermediate Interactive

Neural networks are computing systems inspired by biological brains. They consist of layers of interconnected nodes (neurons).

Types

  • Feedforward — data flows one direction
  • Convolutional (CNN) — image processing
  • Recurrent (RNN) — sequential data
  • Transformer — attention-based (GPT)

Syntax

AI
import tensorflow as tf
from tensorflow import keras

model = keras.Sequential([
    keras.layers.Dense(64, activation='relu'),
    keras.layers.Dense(32, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy')
Neural Network from Scratch
PYTHON
import math

def sigmoid(x):
    return 1 / (1 + math.exp(-x))

def sigmoid_derivative(x):
    return x * (1 - x)

# Simple neural network
inputs = [0.5, 0.3]
weights = [0.4, 0.8]
bias = 0.1

# Forward pass
weighted_sum = sum(i * w for i, w in zip(inputs, weights)) + bias
output = sigmoid(weighted_sum)

print(f"Inputs: {inputs}")
print(f"Weighted sum: {weighted_sum:.4f}")
print(f"Output (sigmoid): {output:.4f}")

Practice

1
Exercise

Practice this concept.

Answer
Write the code as shown above.

Quick Quiz

1

What did you learn?

This covers the basics.

Interview Questions

It is a fundamental AI feature.