InterviewStack.io LogoInterviewStack.io

Basic ML Concepts in Code Questions

Introductory machine learning concepts explained with practical, code-oriented examples. Covers data preprocessing, model training loops, gradient descent optimization, loss functions, regularization, evaluation metrics, and common algorithms at a beginner-to-intermediate level to help engineers implement ML in real projects.

MediumTechnical
63 practiced
Create a minimal Flask API that loads a serialized scikit-learn Pipeline and serves batch predictions via a POST JSON endpoint. Include code for model loading at startup, request parsing, batching, and returning JSON responses, and describe thread-safety concerns.
EasyTechnical
95 practiced
Write a minimal PyTorch training loop for one epoch that trains a provided nn.Module on a DataLoader. Include device handling (CPU/GPU), zeroing gradients, loss.backward, optimizer.step, model.train call, and basic logging of batch loss.
HardTechnical
47 practiced
Design and implement a lightweight model monitoring script in Python that runs alongside a serving process, computes rolling metrics such as latency distribution, request size, prediction distribution, and pushes those metrics to Prometheus via a /metrics endpoint or pushgateway. Include thresholds for alerting and discuss sampling strategies.
HardTechnical
63 practiced
Write Python code to run a small hyperparameter sweep in parallel using concurrent.futures or multiprocessing. Sweep learning rate, weight decay, and batch size across a grid, run training jobs in parallel processes, collect results in a CSV, and pick the best setting. Discuss reproducibility and resource management concerns.
MediumTechnical
96 practiced
Write a TensorFlow tf.data pipeline in code that reads TFRecord files, parses serialized examples, shuffles, batches, applies a simple map transform, and prefetches for improved training throughput. Mention common performance knobs.

Unlock Full Question Bank

Get access to hundreds of Basic ML Concepts in Code interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.