Skip to content

Commit

Permalink
itadata2024
Browse files Browse the repository at this point in the history
  • Loading branch information
PasoStudio73 committed Oct 24, 2024
1 parent 39e57eb commit 6cb0aab
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 60 deletions.
3 changes: 3 additions & 0 deletions src/SoleXplorer/SoleXplorer.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SoleXplorer

end
4 changes: 2 additions & 2 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ function get_interesting_rules(
df = trimlength_df(df, splitlabel, lengthlabel, audiolabel; min_length=min_length, min_samples=min_samples, sr=audioparams.sr)
X, y, variable_names = afe(df, featset, audioparams)
prop_sole_dt = analysisparams.propositional ? propositional_analisys(X, y, variable_names=variable_names, features=features, train_ratio=train_ratio, rng=rng) : nothing
# modal_sole_dt = analysisparams.modal ? modal_analisys(X, y; variable_names=variable_names, features=features, nwindows=nwindows, relative_overlap=relative_overlap, train_ratio=train_ratio, rng=rng) : nothing
# interesting_rules(prop_sole_dt, modal_sole_dt; features=features, variable_names=variable_names)
modal_sole_dt = analysisparams.modal ? modal_analisys(X, y; variable_names=variable_names, features=features, nwindows=nwindows, relative_overlap=relative_overlap, train_ratio=train_ratio, rng=rng) : nothing
interesting_rules(prop_sole_dt, modal_sole_dt; features=features, variable_names=variable_names)
end
5 changes: 3 additions & 2 deletions src/rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function interesting_rules(
# min_lift = 2.0,
min_ninstances = 0,
# min_coverage = 0.10,
min_ncovered = 5,
# min_ncovered = 5,
normalize = true,
);
map(r->(consequent(r), readmetrics(r)), irules)
Expand Down Expand Up @@ -71,7 +71,8 @@ function interesting_rules(
min_lift = 1.0,
# min_lift = 2.0,
min_ninstances = 0,
min_coverage = 0.10,
# min_coverage = 0.10,
# min_ncovered = 5,
normalize = true,
variable_names_map=variable_names
)
Expand Down
8 changes: 4 additions & 4 deletions test/respiratory_bronchiectasis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ audioparams = let sr = 8000
mel_freqrange = (250, round(Int, sr / 2)),
)
end
train_seed = 1

# audioparams = let sr = 8000
# (
Expand All @@ -89,6 +90,7 @@ end
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 9

# audioparams = let sr = 8000
# (
Expand All @@ -102,8 +104,9 @@ end
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 11

analysisparams = (propositional=true, modal=false,)
analysisparams = (propositional=true, modal=true,)

min_length = 18000
min_samples = 88
Expand All @@ -118,9 +121,6 @@ relative_overlap = 0.05

# partitioning
train_ratio = 0.8
# train_seed = 1
# train_seed = 9
train_seed = 11

rng = Random.MersenneTwister(train_seed)
Random.seed!(train_seed)
Expand Down
45 changes: 24 additions & 21 deletions test/respiratory_bronchiolitis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using SoleAudio, Random
# -------------------------------------------------------------------------- #
# experiment specific parameters #
# -------------------------------------------------------------------------- #
# wav_path ="/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
# csv_path = "/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database"
wav_path ="/home/paso/datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
csv_path = "/home/paso/datasets/health_recognition/Respiratory_Sound_Database"
wav_path ="/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
csv_path = "/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database"
# wav_path ="/home/paso/datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
# csv_path = "/home/paso/datasets/health_recognition/Respiratory_Sound_Database"

csv_file = csv_path * "/" * "patient_diagnosis_partitioned.csv"

Expand Down Expand Up @@ -64,44 +64,49 @@ label_labels = :diagnosis
# -------------------------------------------------------------------------- #
featset = (:mel, :mfcc, :spectrals)

audioparams = let sr = 8000
(
sr = sr,
norm = true,
speech_detect = false,
nfft = 256,
mel_scale = :mel_htk, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
mel_nbands = 26,
mfcc_ncoeffs = 13,
mel_freqrange = (250, round(Int, sr / 2)),
)
end
train_seed = 1

# audioparams = let sr = 8000
# (
# sr = sr,
# norm = true,
# speech_detect = false,
# nfft = 256,
# mel_scale = :mel_htk, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_scale = :bark, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_nbands = 26,
# mfcc_ncoeffs = 13,
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 9

# audioparams = let sr = 8000
# (
# sr = sr,
# norm = true,
# speech_detect = false,
# nfft = 256,
# mel_scale = :bark, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_scale = :erb, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_nbands = 26,
# mfcc_ncoeffs = 13,
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 11

audioparams = let sr = 8000
(
sr = sr,
norm = true,
speech_detect = false,
nfft = 256,
mel_scale = :erb, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
mel_nbands = 26,
mfcc_ncoeffs = 13,
mel_freqrange = (250, round(Int, sr / 2)),
)
end
analysisparams = (propositional=true, modal=true,)

min_length = 10400
min_samples = 106
Expand All @@ -116,9 +121,6 @@ relative_overlap = 0.05

# partitioning
train_ratio = 0.8
# train_seed = 1
# train_seed = 9
train_seed = 11

rng = Random.MersenneTwister(train_seed)
Random.seed!(train_seed)
Expand All @@ -140,6 +142,7 @@ irules = get_interesting_rules(
df;
featset=featset,
audioparams=audioparams,
analysisparams=analysisparams,
min_length=min_length,
min_samples=min_samples,
features=features,
Expand Down
17 changes: 10 additions & 7 deletions test/respiratory_copd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using SoleAudio, Random
# -------------------------------------------------------------------------- #
# experiment specific parameters #
# -------------------------------------------------------------------------- #
# wav_path ="/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
# csv_path = "/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database"
wav_path ="/home/paso/datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
csv_path = "/home/paso/datasets/health_recognition/Respiratory_Sound_Database"
wav_path ="/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
csv_path = "/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database"
# wav_path ="/home/paso/datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
# csv_path = "/home/paso/datasets/health_recognition/Respiratory_Sound_Database"

csv_file = csv_path * "/" * "patient_diagnosis_partitioned.csv"

Expand Down Expand Up @@ -76,6 +76,7 @@ featset = (:mel, :mfcc, :spectrals)
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 1

# audioparams = let sr = 8000
# (
Expand All @@ -89,6 +90,7 @@ featset = (:mel, :mfcc, :spectrals)
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 9

audioparams = let sr = 8000
(
Expand All @@ -102,6 +104,9 @@ audioparams = let sr = 8000
mel_freqrange = (250, round(Int, sr / 2)),
)
end
train_seed = 11

analysisparams = (propositional=true, modal=false,)

min_length = 17500
min_samples = 132
Expand All @@ -116,9 +121,6 @@ relative_overlap = 0.05

# partitioning
train_ratio = 0.8
# train_seed = 1
# train_seed = 9
train_seed = 11

rng = Random.MersenneTwister(train_seed)
Random.seed!(train_seed)
Expand All @@ -140,6 +142,7 @@ irules = get_interesting_rules(
df;
featset=featset,
audioparams=audioparams,
analysisparams=analysisparams,
min_length=min_length,
min_samples=min_samples,
features=features,
Expand Down
6 changes: 3 additions & 3 deletions test/respiratory_pneumonia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ audioparams = let sr = 8000
mel_freqrange = (250, round(Int, sr / 2)),
)
end
train_seed = 1

# audioparams = let sr = 8000
# (
Expand All @@ -89,6 +90,7 @@ end
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 9

# audioparams = let sr = 8000
# (
Expand All @@ -102,6 +104,7 @@ end
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 11

analysisparams = (propositional=true, modal=false,)

Expand All @@ -118,9 +121,6 @@ relative_overlap = 0.05

# partitioning
train_ratio = 0.8
# train_seed = 1
# train_seed = 9
train_seed = 11

rng = Random.MersenneTwister(train_seed)
Random.seed!(train_seed)
Expand Down
45 changes: 24 additions & 21 deletions test/respiratory_urti.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using SoleAudio, Random
# -------------------------------------------------------------------------- #
# experiment specific parameters #
# -------------------------------------------------------------------------- #
# wav_path ="/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
# csv_path = "/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database"
wav_path ="/home/paso/datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
csv_path = "/home/paso/datasets/health_recognition/Respiratory_Sound_Database"
wav_path ="/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
csv_path = "/home/paso/Documents/Aclai/Datasets/health_recognition/Respiratory_Sound_Database"
# wav_path ="/home/paso/datasets/health_recognition/Respiratory_Sound_Database/audio_partitioned"
# csv_path = "/home/paso/datasets/health_recognition/Respiratory_Sound_Database"

csv_file = csv_path * "/" * "patient_diagnosis_partitioned.csv"

Expand Down Expand Up @@ -64,44 +64,49 @@ label_labels = :diagnosis
# -------------------------------------------------------------------------- #
featset = (:mel, :mfcc, :spectrals)

audioparams = let sr = 8000
(
sr = sr,
norm = true,
speech_detect = false,
nfft = 256,
mel_scale = :mel_htk, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
mel_nbands = 26,
mfcc_ncoeffs = 13,
mel_freqrange = (250, round(Int, sr / 2)),
)
end
train_seed = 1

# audioparams = let sr = 8000
# (
# sr = sr,
# norm = true,
# speech_detect = false,
# nfft = 256,
# mel_scale = :mel_htk, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_scale = :bark, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_nbands = 26,
# mfcc_ncoeffs = 13,
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 9

# audioparams = let sr = 8000
# (
# sr = sr,
# norm = true,
# speech_detect = false,
# nfft = 256,
# mel_scale = :bark, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_scale = :erb, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
# mel_nbands = 26,
# mfcc_ncoeffs = 13,
# mel_freqrange = (250, round(Int, sr / 2)),
# )
# end
# train_seed = 11

audioparams = let sr = 8000
(
sr = sr,
norm = true,
speech_detect = false,
nfft = 256,
mel_scale = :erb, # :mel_htk, :mel_slaney, :erb, :bark, :semitones, :tuned_semitones
mel_nbands = 26,
mfcc_ncoeffs = 13,
mel_freqrange = (250, round(Int, sr / 2)),
)
end
analysisparams = (propositional=true, modal=false,)

min_length = 14000
min_samples = 114
Expand All @@ -116,9 +121,6 @@ relative_overlap = 0.05

# partitioning
train_ratio = 0.8
# train_seed = 1
# train_seed = 9
train_seed = 11

rng = Random.MersenneTwister(train_seed)
Random.seed!(train_seed)
Expand All @@ -140,6 +142,7 @@ irules = get_interesting_rules(
df;
featset=featset,
audioparams=audioparams,
analysisparams=analysisparams,
min_length=min_length,
min_samples=min_samples,
features=features,
Expand Down

0 comments on commit 6cb0aab

Please sign in to comment.