File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/test/java/de/bwaldvogel/liblinear Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -344,6 +344,25 @@ void testTrain_IllegalParameters_RegularizeBias() {
344344 assertThat (model .bias ).isEqualTo (1.0 );
345345 }
346346
347+ @ Test
348+ void testTrain_IllegalParameters_P () throws Exception {
349+ Problem prob = createRandomProblem (2 );
350+ Parameter param = new Parameter (L2R_L2LOSS_SVR , 10 , 0.1 );
351+ param .p = -1 ;
352+
353+ assertThatExceptionOfType (IllegalArgumentException .class )
354+ .isThrownBy (() -> Linear .train (prob , param ))
355+ .withMessage ("p < 0" );
356+
357+ // It must not fail for solvers other than L2R_L2LOSS_SVR
358+ for (SolverType solverType : values ()) {
359+ if (solverType != L2R_L2LOSS_SVR ) {
360+ param .solverType = solverType ;
361+ Linear .train (prob , param );
362+ }
363+ }
364+ }
365+
347366 @ Test
348367 void testTrain_IllegalParameters_InitialSol () {
349368 Problem prob = createRandomProblem (2 );
You can’t perform that action at this time.
0 commit comments