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
20 views

Neural Net that memorizes what it sees in order?

I'm sorry for this weird question, I know ML is about generalization but I have a specific use case where I'd like to build a neural network or really just a matrix, that memorizes everything it sees ...
0
votes
0answers
11 views

What is the formula used by np.dot?

Dot products are pretty simple for 1- or 2-dimensional arrays, but anything beyond that is incomprehensible to me. I tried looking into numpy‘s dot function but the ...
0
votes
0answers
11 views

Random matrix theory impact on covariance matrix analysis [migrated]

Framework: From RMT, eigenvalues have a semicircle distribution for symmetric matrices each with i.i.d normally distributed entries as the size of the matrix grows. The restrictions on i.i.d have ...
0
votes
0answers
6 views

Adding an extra dimension in weight matrix in Tensorflow

I was reading styleGAN2 code, in the networks_stylegan2.py file at line 95, they have added an extra dimension in the weight matrix for incorporating mini-batch. What I know is that TensorFlow can ...
0
votes
0answers
11 views

Reinforcement learning example when the action is a matrix

I am working on solving a problem with reinforcement learning which has to find the optimal matrix that maximize the reward. I am not able to see how I can formulate this problem as I have practiced ...
0
votes
0answers
12 views

Learning affinity among features

A batch of semantic objects in the image (lesions in CT scans) are represented in feature space, $X_{B \times C}$. I want to represent the whole batch in a single vector, $1 \times C$, in order to ...
0
votes
0answers
15 views

Toeplitz matrix in convolution neural network problem

Instead of multiplying the kernel with input vector iteratively, the convolution operation could be written as matrix multiplication. Infact this is how convolution operation is implemented ...
1
vote
1answer
59 views

PCA, covariance, eigenvector matrix and rotation [closed]

I am following the Coursera NLP specialization, and in particular the lab "Another explanation about PCA" in Course 1 Week 3. From the lab, I recovered the following code. It creates 2 ...
0
votes
1answer
26 views
0
votes
0answers
21 views

Why is this equation converted to matrix form in this way? Is it possible to multiply an inverse matrix with a vector?

I have been banging my head on wall for days trying to decode this equation. please help me out with this... Below is the equation (consider $x$ as $\Delta x$, and $y$ as $\Delta y$): $x = - \eta(Id-\...
0
votes
0answers
51 views

What does an image pose (camera to world) mean?

I have 1000 2D images of a 3D scene. For each image, I have pose (camera to world) as follows: ...
0
votes
1answer
34 views

How to get used to matricial/vectorial operations?

I came to data science/machine learning from another background in computer science and i feel that i'm lacking of experience with matricial/vectorial operations. Python or Matlab, for instance, ...
1
vote
1answer
23 views

Matrix notation in Sutton and Barto

On pg. 206 of Barto and Sutton's Reinforcement Learning, there is a curious statement about the result of a scalar product: As I interpret it, A is the expectation of a scalar product of two d-...
1
vote
0answers
37 views

How can I get a value of context vector in GPT?

I'm a newbie in NLP and I'm now stuck in GPT. The question I'm struggling with is related to a term 'context vector' It says in the following (sorry that the material provided is written in korean) ...
0
votes
0answers
41 views

what exactly is the hessian matrix in xgboost?

i would like to understand a bit more the mathematics behind xgboost. I understand that the hessian is the second partial derivative of the loss function, i originally thought this was with respect to ...
1
vote
0answers
17 views

Sparse Covariance Selection

I was reading this article https://www.di.ens.fr/~aspremon/PDF/CovSelSIMAX.pdf, whose goal is to estimate the covariance matrix from a the sample covariance matrix drawn from a distribution $X$. ' ...
1
vote
1answer
54 views

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 ...
0
votes
0answers
14 views

How to draw multiple matrices (with grid, custom color per cell) in 3D with raycast?

I would like to draw multiple matrix with ray-casting in 3D. More specific like this (source) I have seen similar figure in some paper (I forgot which one). I wonder how they can draw like this. If ...
-1
votes
2answers
46 views

what is the meaning of $\mathbb{R}^{768\times (768 * 2)}$?

Hi I'm an undergraduate student interested in Machine Learning. I was reading a paper from ICLR 2020 and came a cross a weird looking vector dimensions. Can anyone tell me what this means?? $\mathbb{R}...
1
vote
1answer
215 views

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 ...
0
votes
0answers
24 views

What is the dimension of a time trend matrix in a VAR model?

What is the dimension of a time trend matrix in a VAR model? Consider the following VAR model: I was thinking the dimensions is (3x2) where -> 3 rows correspond to three X variables -> 2 columns ...
1
vote
1answer
32 views

Can all known ML algorithms be written as a sequence of matrix operations?

I keep hearing that machine learning is just linear algebra. Does that mean all known (and all possible?) ML algos, from random forest, to support-vector machines, to recursive neural networks, can ...
0
votes
1answer
56 views

How to create a matrix from two given vectors in R in RStudio?

Suppose, $c(1, 2, 3, 4)$ and $c(2, 4, 5, 6)$ are two vectors. Then in R or RStudio, How to create a $4\times 2$ matrix from these two vectors? Also, how to add another vector $c(8, 9, 10, 11)$ ...
0
votes
1answer
554 views

Trying to understand the result provided by np.linalg.norm function in numpy (normalisation)

I'm new to data science with a moderate math background. I'm playing around with numpy and can across the following: So after reading np.linalg.norm, to my ...
0
votes
1answer
66 views

How do I use matrix math in irregular neural networks such as those generated from neuroevolution (NEAT)?

I understand how to structure the matrix when every node in a layer is fully connected to every node in adjacent layers and I understand that in "irregular" neural networks I can just process each ...
1
vote
0answers
18 views

What is the kernel matrix used for in the kernel trick?

I have $n$ linearly inseperable datapoints, $x_1 \dots , x_n$. I use the kernel trick to map and compute the dot product in higher dimensions (without actually mapping / transforming the data). ...
0
votes
1answer
158 views

How to compute Hessian matrix for log-likelihood function for Logistic Regression

I am currently studying the Elements of Statistical Learning book. The following equation is in page 120. It calculates the Hessian matrix for the log-likelihood function as follows \begin{equation} ...
-1
votes
1answer
22 views

Why don't the dimensions in this linear regression equation match up?

I'm going through an article on linear regression, and they give the following formula for computing estimates: The convention is that all vectors are column vectors. So if ...
3
votes
1answer
124 views

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 ...
2
votes
1answer
27 views

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, ...
1
vote
0answers
121 views

Scipy Sparse vstack memory error

I have a bunch of scipy matrices (of the same #columns) loaded from disk. I want to combine them into one scipy sparse matrix. I am using scipy sparse vstack method. I am able to load the ...
1
vote
0answers
13 views

Question regarding: Vectorization Math of Backpropagation in a Neural Network

Formula: These are the formula I use for backpropagation from Brilliant: Question: If we consider a Neural Network with the structure (3,2): And we would start calculating the derivative (for 1 ...
1
vote
1answer
57 views

List of Correlations to Correlation Matrix [closed]

I am using python to do some data analysis and I need to represent the following table as a correlation matrix. The correlation value is a value between -1 and 1. ...
0
votes
1answer
1k views

Normalize / Standardize in a Random Forest?

If I have a matrix of co-occurring words in conversations of different lengths, is it appropriate to standardize / normalize the data prior to training? My matrix is set up as follows: one row per ...
0
votes
0answers
26 views

Linear Regression Error in feature matrix step

I'm trying to code the design function used in linear regression using numpy and I get this error: Traceback (most recent call last): File "C:\Users\visha\AppData\Local\Continuum\anaconda3\lib\...
0
votes
2answers
2k 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
40 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
122 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: ...
4
votes
1answer
3k 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
662 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: ...
1
vote
1answer
1k 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
44 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 ...
1
vote
1answer
182 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
2k 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
50 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 ...
1
vote
1answer
114 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
529 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
357 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 the ...
1
vote
1answer
30 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 ...
2
votes
1answer
224 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 ...