smartcore
smartcore copied to clipboard
Improve Display for naive_bayes
I'm submitting a
- [x] feature request.
Current Behaviour:
Currently println!("{}", &gnb)
prints:
GaussianNB:
inner: BaseNaiveBayes { distribution: GaussianNBDistribution { class_labels: [0, 1, 2], class_count: [50, 50, 50], class_priors: [0.3333333333333333, 0.3333333333333333, 0.3333333333333333], var: [[0.12176398698426993, 0.1422760001411465, 0.0295040034446723, 0.01126400058841702], [0.26110400788880384, 0.09650000076294418, 0.21639999752045114, 0.03832399889564586], [0.3962559386291673, 0.10192399745559833, 0.2984959836425922, 0.07392400431251556]], theta: [[5.006000003814697, 3.41800000667572, 1.4639999961853027, 0.24400000482797624], [5.935999975204468, 2.770000009536743, 4.259999980926514, 1.3259999918937684], [6.588000001907349, 2.9739999914169313, 5.551999988555909, 2.0259999775886537]] }, _phantom_tx: PhantomData, _phantom_ty: PhantomData, _phantom_x: PhantomData, _phantom_y: PhantomData }
Expected Behaviour:
For every structure implementing BaseNaiveBayes
should display:
GaussianNB:
inner: BaseNaiveBayes {
distribution: GaussianNBDistribution {
class_labels: [0, 1, 2],
class_count: [50, 50, 50],
class_priors: [0.3333333333333333, 0.3333333333333333, 0.3333333333333333],
var: [[0.12176398698426993, 0.1422760001411465, 0.0295040034446723, 0.01126400058841702], [0.26110400788880384, 0.09650000076294418, 0.21639999752045114, 0.03832399889564586], [0.3962559386291673, 0.10192399745559833, 0.2984959836425922, 0.07392400431251556]],
theta: [[5.006000003814697, 3.41800000667572, 1.4639999961853027, 0.24400000482797624], [5.935999975204468, 2.770000009536743, 4.259999980926514, 1.3259999918937684], [6.588000001907349, 2.9739999914169313, 5.551999988555909, 2.0259999775886537]]
}}
Steps to reproduce:
See tests with:
let gnb = GaussianNB::fit(&x, &y, parameters).unwrap();
println!("{}", &gnb);