EricArcher / banter

banter is a package for creating hierarchical acoustic event classifiers out of multiple call type detectors.
9 stars 0 forks source link

addBanterDetector suggested modification in cases with insufficient data in detector #3

Open shannonrankin opened 1 year ago

shannonrankin commented 1 year ago

Problem: When adding multiple detectors to a banter modeling using addBanterDetector, if one or more of the detectors has insufficient data to build a detector model, Banter gives an error such as: Error in .getSampsize(df$species, sampsize, paste0("Detector model (", : Detector model (Click_Detector_1) has 1 species (need at least 2 for model)

This error results in a full-stop of the processing (no data is added to the model).

There will be cases where this happens, but a model can be built using the detectors with sufficient data.

Suggested modification: Print a warning (instead of an error) identify the detector(s) with insufficient data and Populate the model with the detectors it CAN use

There is a workaround by specifying the exact detectors to use; but since this will be a thing that happens not infrequently, the modification may make it more user friendly

EricArcher commented 1 year ago

I've made a modification that changes these errors to warnings. It should run through now, but I don't have the data to test. Please give it a go and let me know if it's performing properly. If not, can you send me a minimal dataset that replicates the error and I'll work on it more.

shannonrankin commented 1 year ago

Eric- It seems to work in general, but there might be a lingering dust mite? When I plot the summary of the banter model after adding the detector models, I now get an error: Error in getBanterModel(x, model) : trying to get slot "model" from an object of a basic class ("NULL") with no slots

When I try to runBanterModel I get the following error: Error in is.data.frame(y) : trying to get slot "ids" from an object of a basic class ("NULL") with no slots

I will send a test dataset separately (github would not support that file time)

shannonrankin commented 1 year ago

See comments in github-- possibly funky things going on...

test data set attached-- thank you

On Fri, Jan 27, 2023 at 3:57 PM Eric Archer @.***> wrote:

I've made a modification that changes these errors to warnings. It should run through now, but I don't have the data to test. Please give it a go and let me know if it's performing properly. If not, can you send me a minimal dataset that replicates the error and I'll work on it more.

— Reply to this email directly, view it on GitHub https://github.com/EricArcher/banter/issues/3#issuecomment-1407200918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOC5FKAXZIHVQH6MW2POBILWUROE7ANCNFSM6AAAAAAUJIEMVE . You are receiving this because you authored the thread.Message ID: @.***>

-- Shannon Rankin Wildlife Research Biologist Southwest Fisheries Science Center NMFS/NOAA 8901 La Jolla Shores Dr. La Jolla, CA 92037 858-546-7072 @.***

We are ADRIFT in the California Current. Check out our Sound Bytes blog https://www.fisheries.noaa.gov/taxonomy/term/1000356091 here.

EricArcher commented 1 year ago

Can't see the attached data, but I think I could see what was causing the error. I've made a fix, so give it another go.

shannonrankin commented 1 year ago

Eric- Test dataset was attached to the email-- but it would not allow me to attach directly to the Issue (so I think the email did not attach it). I will send in a separate email.

I installed the latest banter from github (0.9.5) and I get the same errors. I went through the hoops of ensuring I had the latest update from Github, reloading my entire workstation & data in a fresh environment, etc.

I can run the addBanterDetector and it appears to be working, but again when I run the summary(banter_model) I get the following error: Error in getBanterModel(x, model) : trying to get slot "model" from an object of a basic class ("NULL") with no slots

And when I try to run the runBanterModel (event level), I get the following error: Error in is.data.frame(y) : trying to get slot "ids" from an object of a basic class ("NULL") with no slots

FWIW, I am ok with reverting back to the original and dealing with it-- it will come up regularly, but it is something we can deal with. I will send the subsetted data separately via email.

EricArcher commented 1 year ago

Found the bug - small error in how I made an earlier update. I've tested it on your example data and so far it works - excluding Detectors 1 and 7 from the model, but proceeding normally. Give it a go and let me know if you see anything else funky.

shannonrankin commented 1 year ago

Looks great to me-- I'll reach out if I see any other questionable behavior-- but thank you!! :)