How LSTM weight dimension depend on input dimension? - artificial-intelligence

In detail can we multiply weight(w as a scalar value) to input that can be n dimension?

If you through how LSTM works. weight is directly multiplied with input and previous sequence . details here Understanding LSTM therefore weight dimension should be same as input dimension.

Related

Looking for a array reducing algorithm

I have an array of a structures containing two float values x and y.
x is the position on a x-axis in mm (0.0mm to e.g. 2500.0mm)
y is a height measurement in mm at the x-position (0.0mm to e.g. 50.0mm)
With the length of 2500.0mm I will have an array filled up with 2501 values (one for each mm). As i want to send this array to a visualization which will draw that on a x/y plot i want to reduce that array to exactly 500 values (more than 500 values will slow down the communication too much). Now you might say.. well okay, than just take every 5th value. But what to do if my array has 1653 values? I would have to take every 3,306th value. I definitely need the first and the last value.
Is there any elegant algorithm that might help me out?
You could use interpolation to estimate a function that is similar to yours, and then you could just choose the desired points in the data range and estimate their value. Then, you could simply plot these values.
This is elegant and pretty easy to generalize for more or less points, as long as you stay within the range of original data (and do not try to extrapolate out of this range)

Excel maximum difference between consecutive values in array

I have an array of numbers:
46.50, 46.50, 46.50, 50.00, 60.00, 57.00, 50.00, 48.00, 44.00, 42.00
I'd like to create a formula that finds the maximum positive difference between two consecutive pairs. So in the above example, the intermediate calculation would be:
0,0,-3.50,-10.00,3.00,7.00,2.00,4.00,2.00
Therefore the answer would be 7.00
Going to go with a basic array formula for this one. Aussuming your data is layed out as per the image below, used to offset ranges and subtract one range from the other. Then take the maximum of those results. This can be achieved using the following formula entered as an array. meaning you need to confirm it with CTRL+SHIFT+ENTER. You will know you have done it right when {} show up around your formula. They cannot be added manually.
=MAX(B3:B11-B4:B12)
as an alternative non array formula you can got with AGGREGATE which will perform array like calculations:
=AGGREGATE(14,6,B3:B11-B4:B12,1)
The above formulas will provide you with the largest positive difference. If how ever you need to know the largest difference, then -10 is a larger difference than 7. Its just in the opposite direction. To find this you would need to add ABS to the above equations as follows:
=MAX(ABS(B3:B11-B4:B12))
OR
=AGGREGATE(14,6,ABS(B3:B11-B4:B12),1)
Use an array formaula. If your values are in column A (rows 1 to 10 in this case), use
=MAX(A1:A9-A2:A10)
And enter it with CTRL-SHIFT-ENTER instead of just Enter.

Array formula where i need to find weighted average

I am trying to find a weighted avg score for each member. So column A for me is the member list for each loan. Column BC is where scores are. I will weight them by the principal balance and that is column K. I put the unique member numbers in column BF. I tried the formula below but it doesn't work, I appreciate any suggestions:
=IF($A$6:$A$46375=BF6,$BC$6:$BC$46375*$H$6:$K$46375)/SumIF($A$6:$A$46375=BF6,$BC$6:$BC$46375))
Two things:
Use Sumproduct on the numerator:
SUMPRODUCT(($A$6:$A$46375=BF6)*$BC$6:$BC$46375*$H$6:$K$46375)
The SUMIF has a typo, You do not use the = in that manner in a SUMIF:
SUMIF($A$6:$A$46375,BF6,$BC$6:$BC$46375)
So together:
=SUMPRODUCT(($A$6:$A$46375=BF6)*$BC$6:$BC$46375*$H$6:$K$46375)/SUMIF($A$6:$A$46375,BF6,$BC$6:$BC$46375)
It is not a CSE array formula. It does not require Ctrl-Shift-Enter.
array formula
write
=sum(if(A6:A46375=BF6,BC6:BC46375*K6:K46375,0)/sum(if(A6:A46375=BF6,BC6:BC46375,0))
then press ctrl+shift+enter

Clarification of the leading dimension in CUBLAS when transposing

For a matrix A, the documentation only states that the corresponding leading dimension parameter lda refers to the:
leading dimension of two-dimensional array used to store the matrix A
Thus I presume this is just the number of rows of A given CUBLAS' column major storage format. However, when we consider Op(A), what does the leading dimension refer to now?
Nothing changes. The leading dimension always refers to the length of the first dimension of the array. The data order flags (normal, transpose, conjugate) only indicate to BLAS how the data within the array is stored. They have no effect on the array itself, which is always column major ordered and requires an LDA value for indexing in 2D.
So whether the matrix data is stored in transposed form or not, an m x n array always has LDA>=m.
If you are using row-major representation then the number of "columns" will be leading dimension and vice versa in column-major representation number of "rows".

Creating Algorithm: Box Split when there is maximum no.of points in the box

Hello I need help with making algorithm with the following:
Let's say a 2d domain of space with xmax, xmin, ymin, ymax, with 'n~10,000' of points in the space.
Go through lists of points positions.
When there is maximum no,of points (lets say 10) in the box, the box split into 4 equal smaller boxes.
Then check again if the each of the smaller box has more than maximum no. of points. it will split again into 4 equal smaller boxes.... until the box has less than the maximum no.of points per box.
Any suggestions how I can make this algorithm? Please?
Cheers!
You should try to program this yourself and then ask again as soon as you run into problems.
To get you started here's an idea: create two arrays of indices that just go up from 0 to the number of points you have. Then use the x-values of the points to sort one index-array and the y-values to sort the other index-array. You can then read what you need by simply taking the n-th entry from each array and combine the x/y-maxima of the 2 points you got. (Also: To then get the next cross-point you dont need to sort again, just use the next n'th entries)

Resources