# Tag Info

## Hot answers tagged data-analysis

12

Consider using the HDF5 file format. HDF5 is a hierarchical data storage format with several nice features: platform independent storage: the library takes care of little/big endianness for you hierarchical layout of datasets: like a filesystem within a file large, growable n-dimensional array storage mixed dataset types can exist within one file (ie, ...

11

First of all, you should specify whether you want all components or the most significant ones? Denote your matrix $A \in \mathbb{R}^{N \times M}$ with $N$ being number of samples and $M$ dimensionality. In case you want all components the classical way to go is to compute covariance matrix $C \in \mathbb{R}^{M\times M}$ (which has time complexity of $O(NM^... 10 They are not interchangeable. Computational science tends to refer more to HPC, simulation techniques (differential equations, molecular dynamics, etc.), and is usually referred to as scientific computing. Data science tends to refer to computationally-intensive data analysis, like "big data", bioinformatics, machine learning (optimization), Bayesian ... 8 I would suggest that a full database may be overkill for your purposes, though it would certainly work. Even$5 \cdot 10^5$rows should be no more than around 25mb of data. I would strongly recommend doing the analysis/plotting/etc with the same tool that you will use for querying your data. It is my experience that when changing what to analyse only takes ... 7 What you want to do here is partition N observations into K clusters who exhibit similar properties. This is called clustering and you can find more info here. Since you already have a numerical similarity measure, this makes me think about using the K-Means algorithm, in which you operate in several steps: Initialize cluster centroids randomly Assign each ... 7 I realize this question was asked a while ago, but I recently needed the Freschet distance as well. I couldn't find any implementations for Python, so I wrote my own based on the paper: "Computing Discrete Frechet Distance" by "Thomas Eiter and Heikki Mannila", and thought I would share it for future reference. It's written in Cython (save as frechet.pyx) #... 5 I agree with Davidmh that calculating uncertainties should not be handled by an automatic library. You will very quickly run into a case where the automatics fail (try doing a Fourier transform for instance). You say however that you just want to keep the uncertainties with your data. Why not just add them as an extra column in your dataframe? This is how I ... 5 I think what you are looking for is called "cluster analysis" or "clustering". Many different algorithms exist. In your case, you would want some "connectivity clustering", i.e. group elements together based on a property that links each two. Have a look at the clustering algorithms in scikits.learn (Python code) and the references mentioned there. 5 I highly recommend using a tool such as Sumatra for this. I used to have a similar "pedestrian" approach to yours for keeping track of many simulation runs with varying parameters, but in the end it just becomes a huge mess because it's next to impossible to design such an ad-hoc approach correctly upfront and to anticipate all the use cases and extensions ... 5 Take a look at active subspaces, e.g., Active Subspace Methods in Theory and Practice: http://epubs.siam.org/doi/abs/10.1137/130916138 And a PDF here: http://inside.mines.edu/~pconstan/docs/constantine-asm.pdf I have a SIAM book (Active Subspaces: Emerging Ideas for Dimension Reduction in Parameter Studies) coming out in March. Suppose$f$maps$\mathbb{...

5

When solving a nonlinear equation $$x = f(x), \qquad x\in\mathbb{R}^m,$$ the iteration method consists of generating successive guesses $$x_1 = f(x_0), \quad x_2 = f(x_1), \qquad x_k = f(x_{k-1}).$$ If this converges to a limit $x_*$, that limit will satisfy the equation $x_* = f(x_*)$. Convergence is guaranteed by Taylor's theorem so long as $|f'|<1$...

4

No, it's illegal by the Fortran standard, but that said most compilers will let you get away with it (if the debugging options are not turned on and provided a correct interface is not in scope at the calling point) as long as you are passing Double Complex to double precision and the arrays of the later are twice the size of the former, and similarly ...

3

The main purpose of sampling tons of pseudo-random data as opposed to non-random data is related to Runge's phenomenon for polynomial interpolation: Uniform spacing of interpolation points is often a bad idea. But choosing better interpolation points require knowledge of the function you want to interpolate (or integrate etc.). If you don't have that ...

3

I'd follow your suggestion of fitting a line $ax+b$ to your data. You don't even have to smooth it first -- fitting a line already takes care of it. There are, however, two questions: first, how do you fit the line? This is a question of the statistics of your noise. If noise is Gaussian then you'd use least squares. If your noise has large outliers then ...

3

I would recommend looking at the griddata method in SciPy, which seems to have the functionality you need. Pay attention to the 'fill value' argument if you are looking at points outside your $x,y$ data set.

2

I guess you only need a few (or a few hundred) dominant singular value/vector pairs. Then it is best to use an iterative method, which will be much faster and consume far less memory. In Matlab, see help svds

2

You may check my answer on Cross Validated. I didn't want to copy it here. Basically, you can use fast, randomized SVD to compute PCA basis and coefficients.

2

It seems that both $x$ and $y$ have an offset, since a Lissajous curve should oscillate around the origin, so: $x=A\sin{\left(at+\delta\right)}+x_0$ and $y=B\sin{\left(bt\right)}+y_0$. Besides that, your test equations do not seem to be correct. Because the ratio $\frac{a}{b}$ determines the number of "lobes" (points where the curve crosses itself) of the ...

2

Managing uncertainties is actually a quite delicate statistics problem. The known expression for error propagation using squared partial derivatives is good when the errors are normally distributed, independent, and small. This is usually the case; and in fact, even if the normality or independence are not fully satisfied, for most practical cases the result ...

2

I haven't read Wes McKinney's book, but he's a smart guy and pandas is an awesome package. So I suspect it's good. Another possibility for a quick start is to just go through the scikits learn documentation and code. It's nice package with a consistent interface, good examples, and nicely structured code. It's not "the answer" for data analysis using ...

2

20 MB data files are really not very large any more, on machines like yours. I would expect Mathematica to be able to read it in under a few seconds, and to be able to do an FFT in a few seconds to maybe a minute. You could try this by simply starting Mathematica, creating a vector with 3 million randomly chosen entries, and asking Mathematica to do the FFT. ...

2

While PCA is useful to reduce dimensions, the choice of the number of dimensions should be viewed as a parameter depending on the effectiveness of your classifier on the data generated by your problem. (It could be three, two, four, ...) But then you'll need a classifier, and you might get good mileage from one of the various mathematical segmentation / ...

2

The input for the Gonzalez algorithm is a set of elements to cluster and the distance between every pair of them. The first step of the Gonzalez algorithm is to select an element at random, this will be your first center (lets call it c_1). Since you already have a center, you must compute the distance from every element to c_1. Next, select as a new center ...

2

Let $\mathbf{\theta}$ be a Gaussian random vector with mean $\mathbf{\mu}$ and covariance matrix $\mathbf{\Sigma}_\mathbf{\theta}$. Let $\mathbf{p}_\theta$ denote the joint PDF. Let $J_\mathbf{\theta}$ be the objective function, as its negative logarithm: $$J_\mathbf{\theta}=-ln(\mathbf{p}_\theta)$$ By taking the partial derivatives w.r.t. $\theta_d$ and ...

2

Your reformulation is wrong: The product rule for derivatives is $(uv)' = u'v + uv'$. Applying this in your situation (with $\partial_x$ instead of $\frac{\partial}{\partial x}$ and $\partial_{xy} = \frac{\partial^2}{\partial x\partial y}$ for brevity would yield \partial_{xy}(uv) = \partial_y(\partial_x u \,v + u\,\partial_x v) = \partial_{xy}u \,v + \...

2

Bagging, Boosting, and Bayesian Model Averaging/Combination are all widely used techniques for doing this. These are discussed in many textbooks on machine learning.

2

If you understand the basics of Python, you should just try to get your hands dirty using some well known/documented Python libraries for the type of work you want to do. If you find you don't understand how to use certain features of the libraries due to inadequate knowledge in Python, just study up on those features and then get back to working with the ...

2

This is a typical use case for a paired t-test. The idea is to consider only the runtime difference $\Delta t$ for each problem and test for the null hypothesis $E(\Delta t)=0$. For a step-by-step explanation, see e.g. (the article refers to segmentation evaluation, but on an abstract level the problem is identiclal to yours): Mao, Kanungo: "Empirical ...

2

Welcome to SE SciComp. First of all, I would suggest using Jupyter so that you have access to IPython and its nice timing magics (see %time and %timeit magic function). These magics take into account that you need to run the code a couple of times to get reliable measurements. If you need even more in-depth comparison, you also need to take into account ...

2

You should be able to store everything in one table and plot from that if your data is tidy. Check out this paper, it's only about 20 pages.

Only top voted, non community-wiki answers of a minimum length are eligible