data points transformation to be used by DFT - fft

rather simple question for those who deeply understand Fourier Transform:
so suppose that I have a data series of values [5,2,4,1,0,6,3,7]
and I want to calculate Discrete Fourier Transform (DFT) for given set of data points.
According to wiki DFT uses as input complex numbers and outputs also complex numbers, so question is how to convert / transform data points -> input for DFT ?

Related

How to decide tree depth of LGBM for high dimensional data?

I am using LightGBM for regression problems on my project and the input data has 800 numeric variables which is high dimensional and sparse dataset.
I want to use as many variables as possible in each iterations. In this case, should I unlimit max_depth?
Because I set max_depth=2 to overcome overfitting issue but it seems using only 1~3 variables in each iterations and those variables are used reapetedly.
And I want to know how tree depth affects to learning result of regression tree.
Detailed info. of the present model:
Number of input variables=800 (numeric)
target variables=1 (numeric)
objective=regression
max_depth=2
num_leaves=3
num_iterations=2000
learning_rate=0.01

FFTW non-symetric inverse transform c2r

Suppose I have a real 2D matrix A(MxN), by using the FFTW3 r2c transform I take the matrix into Fourier space where B is the complex array B=fft(A(Mx(N/2+1))).
I know that B has Hermetian redundancy, so I perform some operations (left-right, up-down flips and complex conjugates) to recover the Hermetian symmetry to obtain the full complex matrix B'.
Now I perform some operations on the full complex matrix B' (such that it is no longer symmetric and want to take the inverse using c2r, how do I do this since the c2r transform is now expecting a symmetric half matrix?
Since B' is not symmetric, its inverse transform is not real. You cannot use c2r meaningfully on this matrix. Use the regular complex-to-complex inverse transform.

Support vector regression based GIS anaysis

I'm new here and I really want some help. I have a dataset including geographical information (longitude, latitude.. ) and I want to ensure the prediction of some aspects using this dataset with Support Vector Regression, but I don't know how to perform this task. I have the following inquires,
Is there a specific precessing I need to go through?
Does SVR consider a geographic dataset as normal data set or are there some specificities in term of tools and treatment?
Any recommended prediction analytics tools (including SVR) considering geographical data?
This given solution is for the situation that you want to extract the independent variable base on the dependent variable from a raster.
but if you have you all dependent and independent data with their corresponding location you simply use svm function in R and you then add a raster or vector (new) data to your predict function for prediction, or you also can use the estimated coefficient of dependent variable in raster calculator in GIS and multiply them to the corresponding independent variable and finally you will get your predicted raster.
Simply you can do the following for spatial data in R.
First of all, the support vector regression can be used for prediction of real value and you can use the library("e1071") in R in order to execute this algorithm.
you can import your dataset as CSV along with lat and long columns.
transform your data.fram to Spatial data.frame
#Read data
dat<-read.csv(choose.files())
#convert the data to SPDF.
dat_sp=SpatialPoints(cbind(dat$x,dat$y))
#add your Geographical referense system
dat_crs=CRS("+proj=utm +zone=39 +datum=WGS84")
#Data Frams for SpatialPoint Data(Creating a SpatialPoints data frame for dat)
dat_spdf=SpatialPointsDataFrame(coords = dat_sp,data = dat, proj4string = dat_crs)
plot(dat_spdf, col='blue', cex=1, pch=16, axes=TRUE)
#Extract value
dat_spdf$ref <- extract(raster , dat_spdf)
then you can extract your data on a raster data or whatever you have(your independent variable).
and finally, you can use the following cold in R.
SVM(dependent ~.,independent)
But you need to really have an intuition about what the SVR is and how to evaluate the result.
you also can show your result as a final raster map.
you can use toolbox package or you may use raster package.

Obtaining multiple output in regression using deep learning

Given an RGB image of hand and 3d position of the keypoints of the hand as dataset, I want to do this as regression problem in DL. In this case input will be the RGB image, and output should be estimated 3d position of keypoints.
I have seen some info about regression but most of them are trying to estimate one single value. Is it possible to estimate multiple values(or output) all at once?
For now I have referred to this code. This guy is trying to estimate the age of a person in the image.
The output vector from a neural net can represent anything as long as you define loss function well. Say you want to detect (x,y,z) co-ordinates of 10 keypoints, then just have 30 element long output vector say (x1,y1,z1,x2,y2,z2..............,x10,y10,z10), where xi,yi,zi denote coordinates of ith keypoint, basically you can use any order you feel convenient with. Just be careful with your loss function. Say you want to calculate RMSE loss, you would have to extract tripes correctly and then calculate RMSE loss for each keypoint, or if you are fimiliar with linear algebra, just reshape it into a 3x10 matrix correctly and and have your results also as a 3x10 matrix and then just use
loss = tf.sqrt(tf.reduce_mean(tf.squared_difference(Y1, Y2)))
But once you have formulated your net you will have to stick to it.

Why does fftw3 inverse fourier transform's produces output vector of type double?

I want to take inverse fourier transform of a signal. I use this
fftw_plan_dft_c2r_1d
however, the output vector is required to be double. The question is isn't that the IFFT of a signal gives complex number result?
The definition of the Discrete Fourier Transform (DFT) allows for the time-domain input to be a complex valued signal and produces a frequency-domain result which is in general also complex valued. Correspondingly the inverse transform of that complex-valued frequency-domain result would produce the same (or at least within the available implementation's numerical precision) original time-domain signal. The result of the inverse transform could thus be complex.
Just the same, if we restrict time-domain inputs of the forward transform to real-valued signals then we would similarly expect the inverse transform of the corresponding frequency-domain spectrum to give us back the same original real-valued signal.
Note that the forward transform of those real-valued signal produces a frequency domain result that exhibits Hermitian symmetry (and conversely, if a frequency domain signal has Hermitian symmetry it must be the transform of a real valued signal). fftw_plan_dft_c2r_1d then computes the inverse transform (which is real-valued and stored in double) under the assumption that the frequency domain spectrum indeed has Hermitian symmetry.