mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-10-04 12:59:26 +00:00
Refactor LogReg implementation for improved readability by adjusting formatting and organizing imports
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::matrix::{Matrix, SeriesOps};
|
||||
use crate::compute::activations::sigmoid;
|
||||
use crate::matrix::{Matrix, SeriesOps};
|
||||
|
||||
pub struct LogReg {
|
||||
w: Matrix<f64>,
|
||||
@@ -31,14 +31,14 @@ impl LogReg {
|
||||
}
|
||||
|
||||
pub fn predict(&self, x: &Matrix<f64>) -> Matrix<f64> {
|
||||
self.predict_proba(x).map(|p| if p >= 0.5 { 1.0 } else { 0.0 })
|
||||
self.predict_proba(x)
|
||||
.map(|p| if p >= 0.5 { 1.0 } else { 0.0 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::LogReg;
|
||||
use crate::matrix::Matrix;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_logreg_fit_predict() {
|
||||
|
Reference in New Issue
Block a user