fn evaluate(&self) -> f64
	{
		let mut rng = rand::thread_rng();
		//calculate mean squared error of random batch of points -> seems to accept outliers
		let mut mse = 0.0;
		let n = 3; //batch size
		for _ in 0..n
		{
			let i = rng.gen::<usize>() % self.target.len();
			let point = &self.target[i];
			let error = point.1 - calc_f(&self.fct, point.0);
			mse += error * error;
		}
		mse /= n as f64;
		
		//add regularization
		let reg = REGULARIZATION * (self.fct.len() - 1) as f64; //regularization
		
		//return
		-(mse + reg)
	}
//evaluate as inverted mean squared error to target (we want to minimize instead of maximize)
evaluate as inverted mean squared error to target (we want to minimize instead of maximize)
evaluate as inverted mean squared error to target ( we want to minimize instead of maximize )
fn evaluate(&self) -> f64
	{
		let mut rng = rand::thread_rng();
		//calculate mean squared error of random batch of points -> seems to accept outliers
		let mut mse = 0.0;
		let n = 3; //batch size
		for _ in 0..n
		{
			let i = rng.gen::<usize>() % self.target.len();
			let point = &self.target[i];
			let error = point.1 - calc_f(&self.fct, point.0);
			mse += error * error;
		}
		mse /= n as f64;
		//add regularization
		let reg = REGULARIZATION * (self.fct.len() - 1) as f64; //regularization
		//return
		-(mse + reg)
	}
fn evaluate ( & self ) -> f64 { let mut rng = rand :: thread_rng ( ) ; //calculate mean squared error of random batch of points -> seems to accept outliers let mut mse = 0.0 ; let n = 3 ; //batch size for _ in 0 .. n { let i = rng . gen :: < usize > ( ) % self . target . len ( ) ; let point = & self . target [ i ] ; let error = point . 1 - calc_f ( & self . fct , point . 0 ) ; mse += error * error ; } mse /= n as f64 ; //add regularization let reg = REGULARIZATION * ( self . fct . len ( ) - 1 ) as f64 ; //regularization //return - ( mse + reg ) }
evaluate as inverted mean squared error to target (we want to minimize instead of maximize)
evaluate as inverted mean squared error to target ( we want to minimize instead of maximize )
&self
&self