Found 1204 Articles for Numpy

Compute the inner product of vectors for-D arrays using NumPy in Python

Niharika Aitam
Updated on 07-Aug-2023 17:44:42

89 Views

Inner product is one of the most important operations in the linear algebra mathematical operations, which takes two vectors as input and gives the scalar value as the output. It is also known as the Dot product or the scalar product. The inner product of the two vectors is given as follows. a . b = ||a|| ||b|| cos(Ø) Where, ||a|| and ||b|| are the magnitudes of the vectors a and b respectively Ø is the angle between the vectors a and b a . b is the dot product of a and b Calculating Inner ... Read More

Compute the histogram of nums against the bins using NumPy

Niharika Aitam
Updated on 07-Aug-2023 17:41:41

57 Views

In python, for creating histograms we have the numpy, matplotlib and seaborn libraries. In Numpy, we have the function namely histogram() to work with the histogram data. The input argument for the histogram() function is the nums and bins. The nums are used to create the numerical data. Before proceeding with the examples first of all let us understand what is histogram. What is histogram Histogram is the graphical representation of the dataset distribution. It represents the data in the form of series of bars, where the range of data values represented by each bar and height of the bar ... Read More

Compute the histogram of a set of data using NumPy in Python

Niharika Aitam
Updated on 07-Aug-2023 17:39:36

74 Views

A Histogram is the graphical representation of the dataset distribution. It represents the data in the form of series of bars, where the range of data values represented by each bar and height of the bar represents the frequency of the data values defined within the range. These are mainly used to represent the distribution of the numerical data like grades in a class, distribution of the population or distribution of the incomes of the employees etc. In histogram, x-axis represents the range of data values, divided into intervals and the y-axis represents the frequency of the range of data ... Read More

Compute the factor of a given array by Singular Value Decomposition using NumPy

Niharika Aitam
Updated on 07-Aug-2023 17:36:42

88 Views

Singular Value Decomposition (SVD) is the matrix factorization technique which divides the matrix into three parts namely left singular matrix, a diagonal singular matrix and right singular matrix. SVD is powerful tool used in linear algebra and it has number of applications in data analysis, machine Learning and signal processing. This is mainly used to compute the rank of the matrix, as well as to perform the linear equations and performing the image compression and many more operations. Calculating Singular Value Decomposition If we compose a real or complex matrix A with the size m x n, then ... Read More

Compute the covariance matrix of two given NumPy arrays

Niharika Aitam
Updated on 07-Aug-2023 17:32:38

371 Views

Covariance is the measure of two variables that defines how they are related to each other. In other words, it measures the extent to which one variable is associated with the changes in the other variable. When the covariance of the variables is positive, it implies that both variables are moving in the same direction i.e. if one variable tends to increase, as a result, the value of the other variable also increases. When the covariance of the variables is negative then it represents the two variables are moving in opposite direction i.e. if one variable increases the value ... Read More

Comparing and Filtering NumPy array

Niharika Aitam
Updated on 07-Aug-2023 15:51:58

247 Views

The NumPy library has a wide range of tools which perform the comparison and filtering of the arrays. The comparison of arrays will be done element by element in row wise and column wise based on the dimension of the array. When we want to retrieve a particular array element, then we can apply the filtering. NumPy is abbreviated as Numerical python, which is used to perform mathematical and scientific calculations on multidimensional arrays and matrices. There are different functions and methods available in NumPy to perform the filtering and comparison of the arrays. Comparing NumPy Arrays Following are ... Read More

Singular Value Decomposition

Jaisshree
Updated on 07-Aug-2023 15:27:02

201 Views

Machine learning uses the mathematical approach of Singular value decomposition to comprehend huge and complicated data sets. In this mathematical approach, a Unique Valued matrix A is factorized into three matrices via decomposition. In terms of the components of A, the Singular value decomposition of matrix A can be written as A=UDVT. In this case, S denotes A's singular values, whereas U and V stand for A's left and right singular vectors, respectively. Mathematical Algorithm Given Matrix A find the Transpose of matrix A that is (AT). Find A*AT Find the Eigen Vector of A*AT ... Read More

How to Convert 1D Array of Tuples to 2D Numpy Array?

Mukul Latiyan
Updated on 04-Aug-2023 16:54:09

4K+ Views

When working with data in Python, it is often necessary to transform and manipulate arrays to facilitate analysis and computations. One common scenario is converting a 1D array of tuples into a 2D Numpy array. This conversion allows for easier indexing, slicing, and applying array operations. In this article, our focus will be on the conversion process of transforming a 1D array of tuples into a Numpy array. 1D Array of Tuple A 1D array of tuples refers to a data structure in which tuples are arranged sequentially in a one−dimensional array. For example, consider the following 1D array of ... Read More

How to Convert a Numpy Array to Tensor?

Mukul Latiyan
Updated on 03-Aug-2023 18:16:10

4K+ Views

Numpy is a popular Python library used for numerical computing and scientific computing, providing a powerful array object for handling large and multi−dimensional arrays. However, when it comes to machine learning, deep learning, and neural networks, PyTorch is a widely used library that provides an efficient and flexible platform for building and training these models. While Numpy arrays and PyTorch tensors are similar in many ways, they have different properties and methods, which makes it necessary to convert a Numpy array to a PyTorch tensor when using PyTorch for machine learning applications. In this article, we will explore the process ... Read More

How to normalize a NumPy array so the values range exactly between 0 and 1?

Tarun Singh
Updated on 10-Aug-2023 16:01:21

2K+ Views

NumPy is a powerful library in Python for numerical computing that provides an array object for the efficient handling of large datasets. Often, it is necessary to normalize the values of a NumPy array to ensure they fall within a specific range. One common normalization technique is to scale the values between 0 and 1. In this article, we will learn how to normalize a NumPy array so the values range exactly between 0 and 1. We will see the different approaches that can be used to achieve this using NumPy, along with syntax and complete examples. Approaches There are ... Read More

Previous 1 ... 3 4 5 6 7 ... 121 Next
Advertisements