diff --git a/src/naive_bayes/gaussian.rs b/src/naive_bayes/gaussian.rs index d72d27de..fcfde216 100644 --- a/src/naive_bayes/gaussian.rs +++ b/src/naive_bayes/gaussian.rs @@ -51,14 +51,32 @@ struct GaussianNBDistribution { theta: Vec>, } -impl fmt::Display for GaussianNBDistribution { +impl< + TX: Number + RealNumber + RealNumber, + TY: Number + Ord + Unsigned, + X: Array2, + Y: Array1, + > fmt::Display for BaseNaiveBayes> +{ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!( f, - "GaussianNBDistribution: class_count: {:?}", - self.class_count + "BaseNaiveBayes: {{\n distribution: {}}}", + self.distribution )?; - writeln!(f, "class_labels: {:?}", self.class_labels)?; + Ok(()) + } +} + +impl fmt::Display for GaussianNBDistribution { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "GaussianNBDistribution: {{")?; + writeln!(f, " class_labels: {:?},", self.class_labels)?; + writeln!(f, " class_count: {:?},", self.class_count)?; + writeln!(f, " class_priors: {:?},", self.class_priors)?; + writeln!(f, " var: {:?},", self.var)?; + writeln!(f, " theta: {:?}", self.theta)?; + write!(f, "}}")?; Ok(()) } } @@ -277,7 +295,7 @@ impl< > fmt::Display for GaussianNB { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - writeln!(f, "GaussianNB:\ninner: {:?}", self.inner.as_ref().unwrap())?; + writeln!(f, "GaussianNB:\n inner: {}", self.inner.as_ref().unwrap())?; Ok(()) } }