How to detect significant change / trend in a time series data? [closed]

As has been pointed out already, you’re not looking for the derivative. You’re really looking for a “significant change” detection algorithm for a time series. You’ll certainly want a smoothing filter (and the moving average filter is fine — see Bjorn’s answer for this part). But in addition to the smoothing filter, you will also … Read more

numpy convert categorical string arrays to an integer array

np.unique has some optional returns return_inverse gives the integer encoding, which I use very often >>> b, c = np.unique(a, return_inverse=True) >>> b array([‘a’, ‘b’, ‘c’], dtype=”|S1″) >>> c array([0, 1, 2, 0, 1, 2]) >>> c+1 array([1, 2, 3, 1, 2, 3]) it can be used to recreate the original array from uniques >>> … Read more

sigmoidal regression with scipy, numpy, python, etc

Using scipy.optimize.leastsq: import numpy as np import matplotlib.pyplot as plt import scipy.optimize def sigmoid(p,x): x0,y0,c,k=p y = c / (1 + np.exp(-k*(x-x0))) + y0 return y def residuals(p,x,y): return y – sigmoid(p,x) def resize(arr,lower=0.0,upper=1.0): arr=arr.copy() if lower>upper: lower,upper=upper,lower arr -= arr.min() arr *= (upper-lower)/arr.max() arr += lower return arr # raw data x = np.array([821,576,473,377,326],dtype=”float”) … Read more

Is there a difference between a “finite state machine” and a “state machine”?

I’m not sure I understand if there is a difference between a finite state machine and a state machine? Am I thinking about this too hard? Yes, you are thinking about it too hard. 🙂 It depends on context. Obviously, taken literally, the term “finite state machine” indicates a finite number of states, while “state … Read more

Calculating adjusted p-values in Python

It is available in statsmodels. http://statsmodels.sourceforge.net/devel/stats.html#multiple-tests-and-multiple-comparison-procedures http://statsmodels.sourceforge.net/devel/generated/statsmodels.sandbox.stats.multicomp.multipletests.html and some explanations, examples and Monte Carlo http://jpktd.blogspot.com/2013/04/multiple-testing-p-value-corrections-in.html

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)