Questions tagged [matrix]

A matrix is a collection of numbers arranged into a fixed number of rows and columns.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

How Do I iterate over a matrix to access the M[i, j+1] element in R?

I am trying to generate a raster by iterating over a matrix and changing its values depending on whether they fulfil a condition. However, i get the error: Error in M[j+1, i] : subscript out of bounds ...
0
votes
1answer
23 views

How do I generate a laplacian matrix for a graph dataset?

If I have a dataset in a csv that looks like the one shown below. How do I convert this into a laplacian matrix using Python?
1
vote
2answers
37 views

Removing # from header

I have a $(418,2)$ matrix and I want to convert it to csv. so I write: np.savetxt('titanic1.csv', Sol, fmt='%.2f', delimiter=",",header="PassengerId,Survived") ...
0
votes
0answers
22 views

Transformation of matrix with missing values for hierarchical clustering

Comparing different variables, I got a matrix with lots of missing values. How do I have to transform the matrix below for hierarchical clustering? What I have already tried: ...
1
vote
1answer
56 views

Calculating cosine similarity between 3D arrays using Python

I have two matrices with multiple columns and three rows each. I calculated the cosine similarity (sklearn) but it gives the result as a matrix. How can I obtain one single value? The matrices are the ...
3
votes
2answers
45 views

Is there a difference between np.matrix(np.array([0,0])) and np.matrix([0,0])?

I was reading this code, for implemnting linear regression from scratch: ...
0
votes
0answers
26 views

Issue in computing matrix inverse

I need to compute inverse of a matrix that has very small values of the range of 10^-9. When I use numpy.linalg.inv it gives all entries of the inverse matrix as 0. I checked in the original matrix ...
0
votes
0answers
13 views

Is this an incorrect way of back-propagating error with matrices?

I was watching a public available video from Stanford (https://youtu.be/d14TUNcbn1k?t=2720) on the mathematics behind back propagation. They proposed a graph: that was then used as an example of back ...
1
vote
1answer
28 views

Computation of kernel matrix using radial basis kernel in svm

I want to compute a kernel matrix using RBF on my own. The training data is multidimensional. My query is whether we will apply $$e^{-\gamma(x-y)^2}$$ for each dimension and then sum the values across ...
0
votes
0answers
26 views

How does on test regression for a subspace or matrix factorization?

I've recently been reading a lot of papers and watching a lot of videos on both subspace learning, and matrix factorization. One thing is particularly eluding me though - how does any of this get ...
0
votes
1answer
34 views

Having difficult interpreting the eigenvectors for a simple 3x2 matrix

I calculated the eigenvectors and eigenvalues from a covariance matrix given a data matrix of 3 columns and 2 rows. I am trying to interpret results but I can't understand on how to interpret them. ...
1
vote
1answer
234 views

Python memory error: compute inverse of large sized matrix

I have a big matrix of size 200000 x 200000. I need to compute its inverse. But it gives out of memory error on using numpy.linalg.inv. Is there any way to compute the inverse of a large sized matrix.
0
votes
1answer
22 views

How do I find output size of a network?

The input to a convolutional layer of a neural network is an image of size $128\times 128\times 3.$ $ 40$ convolutional filters of size $5\times 5$ are applied to it. Would you get an output? If no ...
0
votes
1answer
30 views

Faster 3D Matrix Operation - Python

I am working with 3D matrix in Python, for example, given matrix like this with size of 2x3x4: ...
1
vote
1answer
42 views

How are weights calculated in a feed-forward neural network before they are summed up with bias?

I have read a lot of papers and watched different videos, it seems like they explain how they are summed up with bias before entering the activation function. What I am trying to understand is the ...
0
votes
1answer
81 views

how exp(-z) is working in a sigmoid function in neural networks while z is a matrix?

function g = sigmoid(z) %SIGMOID Compute sigmoid function J = SIGMOID(z) computes the sigmoid of z.% g = 1.0 ./ (1.0 + exp(-z)); end i'm going through andrew ng coursera course i have a doubt ...
1
vote
1answer
26 views

Is this matrix correctly built?

I was reading an article called "Ensemble learning in recommender systems: combining multiple user interactions for ranking personalization" where they explain a method they use called "BPR ...
0
votes
1answer
49 views

How can I create convolutions or linear layers that operate on vectors rather than scalars in pytorch?

Consider an nn.Linear(2,3) layer transform like the one below. It uses a 2x3 matrix of scalar weights to create a weighted sum for each scalar element in the ...
0
votes
1answer
87 views

How can I perform backpropagation directly in matrix form?

I had made a neural network library a few months ago, and I wasn't too familiar with matrices. So, instead of performing matrix dot products (between weights and inputs, then adding a bias matrix), I ...
4
votes
2answers
15k views

Normalize matrix in Python numpy

I've an array like this: ...
1
vote
0answers
109 views

Dataset containing spatial and temporal features (built on a CNN model)

A dataset contains spatial and temporal features. It contains the time series data (2 min intervals) of the sections of a map. It is 320*480 (320 map sections and 480-time intervals). Each row ...
1
vote
1answer
364 views

How to correctly pass Word2Vec vectors as input to an LSTM

I am trying to build a text classifier using lstm which, in its first layer, has weights get by a Word2Vecmodel. In order to ...