Questions tagged [matrix]

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

In mathematics, a matrix (plural: matrices) is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns.

69 questions
9
votes
1 answer

What types of matrix multiplication are used in Machine Learning? When are they used?

I'm looking at equations for neural networks and backpropagation and I see this symbol in the equations, ⊙. I thought matrix multiplication of neural networks always involved matrices that matched dimensions on both sides, such as... [3, 3]@[3, 2].…
Ant
  • 217
  • 1
  • 2
  • 5
7
votes
1 answer

Comparing transition matrices for Markov chains

I have a population, each unit of which exists in one of several states that change over time. I am using first-order Markov chains to model these state transitions. My population can be segmented into various subpopulations of interest. I've…
R Hill
  • 1,115
  • 11
  • 20
5
votes
1 answer

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 embeddings of two words each, obtained from…
5
votes
2 answers

Normalize matrix in Python numpy

I've an array like this: array([[ 0, 1], [ 2, 3], [ 4, 5], [ 6, 7], [ 8, 9], [10, 11], [12, 13], [14, 15]]) I want to make normalize this array between -1 and 1. I'm currently using…
Tarlan Ahad
  • 271
  • 2
  • 5
  • 15
5
votes
0 answers

How is image convolution actually implemented in deep learning libraries using simple linear algebra?

As a clarifier, I want to implement cross-correlation, but the machine learning literature keeps referring to it as convolution so I will stick with it. I am trying to implement image convolution using linear algebra. After looking around on the…
4
votes
0 answers

How to switch the rows/columns of a matrix table in Power BI so that the roll-up dates are in the columns

I've set up a tabular report using the Matrix visualization tool but I couldn't find a way to put the hierarchical datetime period variable into the columns. At the moment it's in the rows as shown in the screenshots below, and my variables are in…
Bill
  • 163
  • 1
  • 8
3
votes
1 answer

tensorflow pseudo inverse doesn't work for complex matrices!

The Tensorflow documentation here says that: tf.linalg.pinv is ''analogous to numpy.linalg.pinv. It differs only in default value of rcond''. However, tf.linalg.pinv requires the matrix to be float type while np.linalg.pinv could be used with…
eMichel
  • 33
  • 4
3
votes
2 answers

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: # convert from data frames to numpy matrices X = np.matrix(X.values) y = np.matrix(y.values) theta = np.matrix(np.array([0,0])) When I came accross this line : …
Sabito
  • 143
  • 10
2
votes
3 answers

converting array to a true/false matrices

I have a data set where each record is a json document with a label, and an array of signals. The signals will vary for each record: { "label":"bad", "id": "0009", "signals":["high_debt_ratio", "no_job"] }, { "label":"good", …
Cyph
  • 121
  • 2
2
votes
1 answer

Conventions for dimensions of input and weight matrices in neural networks?

Im currently learning neural networks and I see conflicting decsriptions of the dimensions of weight and input matrices on the internet. I just wanted to know if there is some convention which more people use than the other. I currently define my…
Tim von Känel
  • 381
  • 2
  • 12
2
votes
1 answer

Recommender system that matches similar customers with similar highly rated products?

I have a dataset of 1,000 customers that bought 20 distinct phones and rated them 1-5. I have several demographic attributes for these customers (gender, age). My website offers 100 distinct devices, each with several attributes (screen size, case…
Insu Q
  • 191
  • 2
  • 8
2
votes
1 answer

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 all dimension?
2
votes
1 answer

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.
shaifali Gupta
  • 420
  • 4
  • 17
2
votes
1 answer

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 output. Now suppose that instead of scalars I want to operate on 1d vectors (e.g. word…
Pat Niemeyer
  • 133
  • 4
1
vote
0 answers

Efficient method of performing within matrix similarity

I want to compute a similarity comparison for each entry in a dataset to every other entry that is labeled as class 1 (excluding the current entry if it has a label of 1). So, consider a matrix of training data that has columns for ID and…
CopyOfA
  • 167
  • 6
1
2 3 4 5