Browse by Topic

Popular

Latest

Latest Python Posts

Diagram of a PyTorch computational graph showing gradient flow backward from a loss node to parameter nodes.
Python

Python PyTorch Autograd: requires_grad and backward

Understand how PyTorch's autograd engine uses requires_grad and backward() to compute gradients, including graph construction, detach(), no_grad(), and common pitfalls.

PyTorchautogradrequires_gradbackward
Illustration of a tensor moving from a CPU chip to a GPU chip in PyTorch with a CUDA device indicator.
Python

Managing CUDA Devices and GPU Tensors in PyTorch

Learn how PyTorch manages CUDA devices and GPU tensors: check availability, move tensors with .to(), write device-agnostic code, handle multiple GPUs, and avoid device mismatch errors.

PyTorchCUDAGPUTensor
A visual representation of a PyTorch tensor being converted to a NumPy array with indexing and slicing operations shown as connecting blocks.
Python

PyTorch Tensor Creation, Indexing, and NumPy Conversion

Learn how to create PyTorch tensors, index and slice them effectively, and convert between tensors and NumPy arrays while avoiding common memory-sharing pitfalls.

PyTorchTensorNumPyMachine Learning
A visual comparison of Python pickle and joblib serialization paths, showing a numpy array being stored as a separate memory-mapped file in joblib.
Python

python joblib vs pickle: Choosing the Right Serializer

Compare Python's pickle and joblib for object serialization. Learn how joblib handles large NumPy arrays, compression, memory mapping, and when to choose each serializer.

joblibpickleserializationnumpy
Diagram showing a Python loop being split into parallel tasks across multiple processes using joblib.
Python

Using joblib Parallel and delayed with multiprocessing

Learn how to parallelize Python loops with joblib's Parallel and delayed, how they relate to multiprocessing, and how to avoid common pitfalls.

joblibparallel processingmultiprocessingPython performance
Illustration of saving and loading a scikit-learn model with joblib in Python
Python

Saving and Loading Scikit-Learn Models With Joblib in Python

Learn how to save and load scikit-learn models with joblib, including dump/load syntax, compression, version compatibility, and when joblib is a better choice than pickle.

joblibscikit-learnmodel persistenceserialization
Illustration of a random seed controlling reproducible results in scikit-learn experiments
Python

Python sklearn random_state Reproducibility

Learn how random_state in scikit-learn controls randomness and how to set it for data splits, estimators, pipelines, and cross-validation to make experiments reproducible.

scikit-learnrandom_statereproducibilitydeterministic
Illustration of a balanced scale with many small shapes on one side and one large shape on the other, representing imbalanced classes, with a subtle Python code background.
Python

Python sklearn Class Imbalance Handling: Practical Strategies

Practical techniques for handling imbalanced datasets with Python and sklearn: class_weight, resampling with imbalanced-learn, SMOTE, and evaluation metrics.

class imbalancesklearnimbalanced-learnSMOTE
A diagram showing a trained scikit-learn model being serialized to a file with joblib and restored for prediction.
Python

Save and Load sklearn Models with Joblib

python sklearn save and load models with joblib: Save trained scikit-learn models with joblib.dump and restore them with joblib.load, including compression, version co...

scikit-learnjoblibmodel persistencePython
A visual representation of regression metrics MSE, RMSE, and R² in scikit-learn, showing predicted vs actual values.
Python

MSE, RMSE, and R²: Regression Metrics with scikit-learn in Python

Learn how to compute and interpret MSE, RMSE, and R² for regression models using scikit-learn. Includes code examples and practical guidance for choosing the right metric.

scikit-learnregression metricsMSERMSE