by Michael Stolzer | Nov 22, 2023 | How-To/Tips
A “List” is a built-in data structure in Python that stores all kinds of data (numerical as well as categorical). While working with large Lists in Python, sometimes it becomes difficult to check if the list contains a particular item or not. Therefore, Python offers...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
The Logistic sigmoid function is a well-known function because it can be utilized as an activation function in the neural network. It computes the connection between the outcome i.e. dependent variables and features i.e. independent variables. PyTorch provides various...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
PyTorch is a free-to-use machine-learning library for building/creating and training neural networks. Mean absolute error (MAE) is the average absolute dissimilarity between calculated values and actual values. It is used to estimate the regression model’s...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
Cosine similarity measures how similar two vectors are by computing the cosine of the angle between them — returning a value between -1 (opposite) and 1 (identical direction). PyTorch provides torch.nn.CosineSimilarity() in the torch.nn module and...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
The norm of a matrix or vector is a computation of its length/magnitude. In PyTorch, a vector is simply a 1D tensor that has only one dimension whereas a matrix is a 2D tensor that has two dimensions i.e. rows and columns. Sometimes, users may want to calculate the...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
Sine is a basic trigonometric function. While working with tensors in PyTorch, users may want to calculate the sine of each element in the specific tensor. PyTorch provides a “torch.sin()” method to perform this operation. This method accepts a specific input tensor...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
The normal distribution is often utilized in statistics and probability where data is symmetrically distributed around the mean. It shows that data near the mean more frequently occurred than data far from the mean. Sometimes, users may be required to generate random...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
In PyTorch, the “torchvision.transforms” module has a collection of classes and functions to apply different transformations on desired images including rotating, cropping, resizing, and many more. It provides the “RandomResizedCrop()” method to crop a random area of...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
Binary cross entropy is a logarithmic loss function utilized in machine learning. It computes the difference between the estimated probabilities of a model and actual labels of data. Sometimes, users may need to find/compute the binary cross entropy between two (input...
by Michael Stolzer | Nov 22, 2023 | How-To/Tips
In PyTorch, tensors are the fundamental data structure that can have multiple dimensions. Sometimes, users may want to determine the k-th and top “k” elements of a specific tensor in various machine learning, data analysis, and deep learning tasks. PyTorch provides...