scikit-learn estimators and pipelines, PyTorch tensors, autograd, nn.Module, DataLoader, and Keras layers.
39 cards · basic cards · AI-written, checked twice. Edit anything.
- What is an estimator in scikit-learn?
Show answer
An object that learns patterns from data through fit() and can make predictions via predict().
- What does the fit() method do in scikit-learn?
Show answer
Trains the estimator on training data by learning patterns and parameters from it.
- What does the predict() method do in scikit-learn?
Show answer
Uses the trained estimator to make predictions on new, unseen data.
- What is a pipeline in scikit-learn?
Show answer
A sequence of transformers followed by an estimator, chaining preprocessing and modeling steps together.
- What is cross-validation used for in scikit-learn?
Show answer
To evaluate model performance by splitting data into multiple folds and training on different subsets.
- What does transform() do in a scikit-learn transformer?
Show answer
Applies learned transformations to data, such as scaling or encoding.
- What is a train/test split used for?
Show answer
Dividing data into separate training and testing sets to evaluate model performance on unseen data.
- What is standardization in machine learning?
Show answer
Scaling features to have mean 0 and standard deviation 1, making them comparable.
- What does a scaler do in scikit-learn?
Show answer
Transforms features to a consistent scale, often between 0 and 1 or with zero mean and unit variance.
- What is GridSearchCV used for?
Show answer
Exhaustively searching over specified hyperparameter values to find the best combination for a model.
- What is a PyTorch tensor?
Show answer
A multi-dimensional array similar to a NumPy array, optimized for deep learning and can run on GPUs.
- How do you create a tensor in PyTorch?
Show answer
Using torch.tensor(), torch.zeros(), torch.ones(), torch.randn(), or converting from NumPy arrays.
- What devices can a PyTorch tensor be moved to?
Show answer
CPU or GPU (CUDA device), using .to(device) or .cpu()/.cuda() methods.
- What does the shape attribute tell you about a tensor?
Show answer
The dimensions of the tensor, such as (batch_size, height, width, channels) for images.
- How do you reshape a tensor in PyTorch?
Show answer
Using .reshape(), .view(), or .unsqueeze()/.squeeze() to change its dimensions.