@ Override protected boolean computeStep ( ) { // compute the new location and it's score if ( ! computeStep ( lambda , gradient , p ) ) { if ( config . mixture == 0.0 ) { throw new OptimizationException ( "Singular matrix encountered. Try setting mixture to a non-zero value" ) ; } lambda *= 4 ; if ( verbose != null ) verbose . println ( totalFullSteps + " Step computation failed. Increasing lambda" ) ; return maximumLambdaNu ( ) ; } if ( config . hessianScaling ) undoHessianScalingOnParameters ( p ) ; // compute the potential new state CommonOps_DDRM . add ( x , p , x_next ) ; computeResiduals ( x_next , residuals ) ; double fx_candidate = costFromResiduals ( residuals ) ; if ( UtilEjml . isUncountable ( fx_candidate ) ) throw new OptimizationException ( "Uncountable candidate score: " + fx_candidate ) ; // compute model prediction accuracy double actualReduction = fx - fx_candidate ; double predictedReduction = computePredictedReduction ( p ) ; if ( actualReduction == 0 || predictedReduction == 0 ) { if ( verbose != null ) verbose . println ( totalFullSteps + " reduction of zero" ) ; return true ; } return processStepResults ( fx_candidate , actualReduction , predictedReduction ) ; }
Compute a new possible state and determine if it should be accepted or not . If accepted update the state