is there a filter function of kalman in Python that works in the same way as the Kalman function of matlab?
[kest] = kalman(sys,Qn,Rn)
The idea is that the function receives as parameters a space of states and the respective weight matrices (it is to implement an LQR controller)
You can use the pyKalman library. See the sin example followed by the filter example.
It is not exactly like Matlab but it is easy enough to use.
I finally found the ovtave source code for the kalman filter and implemented it in python. Anyway, thank you very much
Related
I have some intensive calculation to do involving hypergeomotric distribution and I'd like to know if there exists an implementation of this function that support 'real' vectorize calculation ? (Q1)
By 'real' I mean : not using the np.vectorize who seems to be implementing a for loop.
I know R implementation of the hypergeometric law allows for that kind of computation, which makes the code much more effcicient.
If it helps : I'm trying to duplicate an algorithm develop in R to Python, to compute exact confidence intervals for hypergeometric parameters. The concept was develop in the following paper :
http://www.wright.edu/~weizhen.wang/paper/37-2015jasa_wang.pdf
The solution involve iterating over all the possible combination of paremters to select the subset that satisfy to a specific condition.
(Q2) As an alternative, would it be possible to create my own udf using the definition of the law and the np.choose method but applied to vectors ?
(Q3) as a final option is it possible to call my script in R from Python ?
Thank you !
Are there functions in python that will fill out missing values in a matrix for you, by using collaborative filtering (ex. alternating minimization algorithm, etc). Or does one need to implement such functions from scratch?
[EDIT]: Although this isn't a matrix-completion example, but just to illustrate a similar situation, I know there is an svd() function in Matlab that takes a matrix as input and automatically outputs the singular value decomposition (svd) of it. I'm looking for something like that in Python, hopefully a built-in function, but even a good library out there would be great.
Check out numpy's linalg library to find a python SVD implementation
There is a library fancyimpute. Also, sklearn NMF
I am trying to look for a Python function that is the same as MATLAB's 'fit' function.
Specifically I am looking for something similar to the following MATLAB code:
fi = fit(bins, z, cubicinterp)
where z and bins are lists.
Try SciPy's curve_fit() for general fitting of a function.
For specific interpolations, have a look at SciPy's interploation functions.
Honestly, I think there are hundreds of Python functions to do exactly what you want (and much more).
Here is one example using NumPy, but seriously, just google it and you will be amazed:
numpy.polyfit
I am currently trying to move from Matlab to Python and succeeded in several aspects. However, one function in Matlab's Signal Processing Toolbox that I use quite regularly is the impinvar function to calculate a digital filter from its analogue version.
In Scipy.signal I only found the bilinear function to do something similar. But, in contrast to the Matlab bilinear function, it does not take an optional argument to do some pre-warping of the frequencies. I did not find any impinvar (impulse invariance) function in Scipy.
Before I now start to code it myself I'd like to ask whether there is something that I simply overlooked? Thanks.
There is a Python translation of the Octave impinvar function in the PyDynamic package which should be equivalent to the Matlab version.
I will have to implement a convolution of two functions in Python, but SciPy/Numpy appear to have functions only for the convolution of two arrays.
Before I try to implement this by using the the regular integration expression of convolution, I would like to ask if someone knows of an already available module that performs these operations.
Failing that, which of the several kinds of integration that SciPy provides is the best suited for this?
Thanks!
You could try to implement the Discrete Convolution if you need it point by point.
Yes, SciPy/Numpy is mostly concerned about arrays.
If you can tolerate an approximate solution, and your functions only operate over a range of value (not infinite) you can fill an array with the values and convolve the arrays.
If you want something more "correct" calculus-wise you would probably need a powerful solver (mathmatica, maple...)