When a problem calls for genuinely deep networks, image/text/audio data, or GPU-accelerated training, scikit-learn's MLPClassifier gives way to dedicated deep learning frameworks — this lesson gives a conceptual orientation, not a full tutorial.
# Conceptual example using Keras (part of TensorFlow) — the general shape of deep learning code
import tensorflow as tf
from tensorflow import keras
model = keras.Sequential([
keras.layers.Dense(64, activation="relu", input_shape=(784,)),
keras.layers.Dense(32, activation="relu"),
keras.layers.Dense(10, activation="softmax"), # 10 output classes
])
model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
model.fit(X_train, y_train, epochs=10, batch_size=32, validation_split=0.2)
TensorFlow (with its high-level Keras API) and PyTorch are the two dominant deep learning frameworks — both let you define a network's architecture layer by layer, train it via backpropagation on a GPU for dramatically faster computation, and scale to the very large, very deep networks used in modern computer vision, natural language processing, and generative AI. Keras is generally considered friendlier for beginners and rapid prototyping; PyTorch is often preferred in research settings for its flexibility and more Python-native feel — both are capable, production-ready, and worth being comfortable reading even if you only use one day-to-day.
Beyond basic feedforward networks like the one shown above, specialized architectures handle specific kinds of data: CNNs (Convolutional Neural Networks) for images, exploiting spatial structure; RNNs/LSTMs and, more recently, Transformers for sequential data like text and time series — the architecture underlying modern large language models. epochs (how many full passes through the training data) and batch_size (how many examples are processed before each weight update) are core training hyperparameters, tuned similarly to the classical ML hyperparameters covered earlier in this notebook.
This notebook doesn't go deeper into deep learning itself — moving from scikit-learn to TensorFlow/PyTorch is a substantial enough jump in both scope and depth to warrant its own dedicated notebook. The most valuable takeaway here is knowing when to reach for deep learning (large datasets, unstructured data like images/text/audio, genuinely complex non-linear patterns) versus when classical methods from earlier in this notebook remain the better, simpler, faster choice (most structured/tabular business data, smaller datasets, situations where model interpretability actually matters).