Ingesting data to JuliaDB without .csv files

question

#1

I’ve got a large dataset of several million short audio clips (i.e., waveforms in 1D arrays, plus metadata). Total size is about 500 GB, stored across 140,000 .jld files. I need to go through and calculate a set of summary features from each audio clip, which will then be used for clustering/classification/etc.

I haven’t used JuliaDB and OnlineStats yet, but they seem like the natural way to handle the big table of features. As I understand it, the simplest/naive way to get these data into JuliaDB would be:

  1. Load each .jld file, extract features from each clip, save the resulting table in a .csv file
  2. Ingest all .csv files into JuliaDB
  3. Re-save the dataset in binary format

My questions:
Is there a way to build the binary-format database without writing and reading all those intermediate .csv files?
Are there other tools or approaches I should be looking at?

Thanks in advance!


#2

1.4e5 data points should fit easily in memory if you are just after summary statistics, so I would just iterate through the files, extract statistics, push!ing them into Vectors, which I would then perhaps convert to a DataFrame.


#3

The simplest is to use map:

julia> t = table(@NT(filename = ["a.jld2", "b.jld2"]));
julia> f(filename) = @NT(filename=filename, length=1, frequency=2.3);

julia> map(f, t, select=:filename)
Table with 2 rows, 3 columns:
filename  length  frequency
───────────────────────────
"a.jld2"  1       2.3
"b.jld2"  1       2.3

Of course in your case f should be the function that loads the file and computes your relevant features. Note that if t is stored as a distributed table across several processors, map will be done in parallel.


#4

Thanks for the responses. I guess I didn’t make it clear, but there are 1.4e5 .jld files, each of which contains a variable number of waveforms…most between 10 and 1000. The table of summary features may well fit in RAM, but I’d hate to try processing them all and then get an out-of-memory error 95% of the way through :sweat_smile:

I’ve ended up splitting the list of files so I can process and save one medium-sized chunk at a time. I’ll be back in a day or two if it doesn’t work!