modelfoxdotdev / modelfox

ModelFox makes it easy to train, deploy, and monitor machine learning models.
Other
1.46k stars 64 forks source link

Unwrap in Stats #105

Open isabella opened 2 years ago

isabella commented 2 years ago
error: panicked at 'called `Option::unwrap()` on a `None` value', crates/core/stats.rs:365:48
   0: backtrace::capture::Backtrace::new
   1: tangram::train::train::{{closure}}
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::begin_panic_handler::{{closure}}
   4: std::sys_common::backtrace::__rust_end_short_backtrace
   5: _rust_begin_unwind
   6: core::panicking::panic_fmt
   7: core::panicking::panic
   8: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   9: tangram_core::stats::Stats::finalize
  10: tangram_core::train::Trainer::prepare
  11: tangram::main
  12: std::sys_common::backtrace::__rust_begin_short_backtrace
  13: _main
isabella commented 2 years ago

This happens here:

let min = self.histogram.iter().next().unwrap().0.get();

https://github.com/tangramdotdev/tangram/blob/d3472c217f0177872d40628425ea0241bb3afb24/crates/core/stats.rs#L365

MitchyGoodness commented 1 year ago

Hey @isabella, do you happen to have the original training data that triggered this bug? Based on this comment, I would assume the issue was caused by the histogram size exceeding 100 as set here. However, when I trained using heart_disease.csv and selecting resting_blood_pressure as the target, the issue did not reoccur. I was able to confirm, the histogram size exceeded the limit but it did not panic when unwrapped.