Python Programming & ML Libraries Questions
Python programming language fundamentals (syntax, data structures, control flow, error handling) with practical usage of machine learning libraries such as NumPy, pandas, scikit-learn, TensorFlow, and PyTorch for data manipulation, model development, training, evaluation, and lightweight ML tasks.
MediumTechnical
24 practiced
Using TensorFlow Keras, write code to build a simple dense neural network for binary classification and configure callbacks: `EarlyStopping` on validation loss with patience=3 and `ModelCheckpoint` to save the best model. Show how to call `model.fit` with validation split and load the best weights after training.
EasyTechnical
21 practiced
Given a pandas DataFrame `df` with columns ['user_id','event','value'], write code to compute for each user the average `value` per event type and return a pivoted DataFrame where rows are user_id and columns are event types. Include handling for missing event types and show example input and output behavior.
MediumTechnical
23 practiced
A NumPy-based function you wrote runs slower than expected because of unnecessary copies and temporary arrays. Describe common causes for NumPy performance issues (copying, non-contiguous arrays, Python loops) and give specific code-level fixes for each cause.
EasyTechnical
19 practiced
Implement functions `precision(y_true, y_pred)` and `recall(y_true, y_pred)` in Python for binary classification (labels 0/1). Then implement `f1(y_true, y_pred)` using your functions and explain edge cases like zero-division when there are no positive predictions.
MediumTechnical
21 practiced
Describe grid search vs randomized search for hyperparameter tuning. Provide a short code example using `RandomizedSearchCV` with a custom scorer and explain when randomized search is more efficient than exhaustive grid search.
Unlock Full Question Bank
Get access to hundreds of Python Programming & ML Libraries interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.