
TensorFlow & Keras
Sequential API, Functional API, layers, callbacks, checkpoints, TensorBoard, model saving
1What is the main difference between Keras Sequential API and Functional API?
What is the main difference between Keras Sequential API and Functional API?
Answer
Sequential API allows creating models layer by layer in a linear fashion, where each layer has exactly one input and one output. Functional API offers more flexibility by enabling complex architectures: multiple inputs, multiple outputs, residual connections, and shared layer graphs. Use Sequential for simple architectures and Functional for more advanced cases.
2How to create a Sequential model with a 64-neuron Dense layer followed by a 10-neuron output layer?
How to create a Sequential model with a 64-neuron Dense layer followed by a 10-neuron output layer?
Answer
The standard method is to instantiate tf.keras.Sequential() then use model.add() to add layers one by one, or pass a list of layers directly to the constructor. Each Dense layer takes the number of units as parameter, and the first layer requires specifying input_shape to define the input data shape.
3What is the role of the 'softmax' activation function in an output layer?
What is the role of the 'softmax' activation function in an output layer?
Answer
The softmax function transforms logits (raw outputs) into probabilities that sum to 1, which is ideal for multi-class classification. Each output represents the probability of belonging to a class. It is typically used with categorical_crossentropy loss for one-hot labels or sparse_categorical_crossentropy for integer labels.
How to define a model with the Functional API having two distinct inputs?
Which callback to use to stop training when validation loss no longer improves?
+19 interview questions
Other Data Science & ML interview topics
Python Basics
Python Object-Oriented Programming
Python Data Structures
Git Fundamentals
SQL Basics
NumPy Fundamentals
Pandas Basics
Jupyter & Google Colab
SQL Joins & Advanced Queries
Advanced Pandas
Visualization with Matplotlib & Seaborn
Interactive Visualizations with Plotly
Descriptive Statistics
Inferential Statistics
Web Scraping
BigQuery & Cloud Data
Feature Engineering
Supervised ML: Regression
Supervised ML: Classification
Decision Trees & Ensembles
Unsupervised ML
ML Pipelines & Validation
Time Series & Forecasting
Deep Learning Fundamentals
CNN & Image Classification
RNN & Sequences
Transformers & Attention
NLP & Hugging Face
GenAI & LangChain
MLOps & Deployment
Master Data Science & ML for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free