Commit be0511f1 authored by alessio.quaresima's avatar alessio.quaresima
Browse files

Query for database simplified

parent e79289d6
......@@ -12,25 +12,23 @@ dict = SpikeTimit.create_dictionary(file=dict_path)
##
# Parameters to compute the input_data
target_dialects = [1]
target_gender = 'f'
target_dialects = [1,2,5,8]
target_gender = "f" # "fm" "m"
samples = 10
n_speakers = 1
repetitions = 75 # amount of times you present the network with each unique stimulus.
silence_time = 0.15 # in seconds
n_features = 10 # number of features combined from input frequencies
##
## Select a subset of the whole dataset.
# In this case I select all the female speakers from
# regional accent 1 that use at least on of the words in their
## I declared these functions because I am don't know how to use the Dataframes quesry properly *_*...
in_words(df_words) = isempty(intersect(Set(df_words),Set(words)))
in_dialect(df_dialect) = df_dialect target_dialects
in_gender(df_gender) = occursin(df_gender, target_gender)
speakers = []
for word in words
speaker = @linq train |>
where(:dialect . target_dialects, :gender.==target_gender, word . :words) |>
select(:speaker) |> unique
push!(speakers,Set(speaker.speaker))
end
speakers = collect(intersect(speakers...))
single_speaker_train = filter(:speaker=> x->x speakers, train)
# this is a DataFrameMeta macro
speaker = @where(train,in_dialect.(:dialect), in_gender.(:gender), in_words.(:words))
## Select the inputs
durations, spikes, labels = SpikeTimit.select_inputs(df=single_speaker_train, words=words, samples = samples, n_feat = n_features);
......@@ -39,6 +37,9 @@ durations, spikes, labels = SpikeTimit.select_inputs(df=single_speaker_train, wo
all_ft, all_n, words_t, phones_t = SpikeTimit.mix_inputs(;durations=durations, spikes=spikes, labels=labels, repetitions=repetitions, silence_time)
SpikeTimit.convert_to_dt(words_t, 0.1)
SpikeTimit.convert_to_dt(phones_t, 0.1)
all_ft = SpikeTimit.convert_to_dt(all_ft, 0.1)
words_savepoints = SpikeTimit.get_savepoints(trans= words_t, n_measure=10)
ph_savepoints, ll = SpikeTimit.get_savepoints(trans= phones_t, n_measure=10)
......@@ -48,4 +49,4 @@ ph_savepoints, ll = SpikeTimit.get_savepoints(trans= phones_t, n_measure=10)
all_ft[end]
repetitions*(sum(durations)+(silence_time*(length(durations))))-silence_time
words_t.intervals[end]
phones_t.intervals[end]
phones_t.steps[end]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment