@@ -209,7 +209,7 @@ test_that('bad input', {
209
209
210
210
# ------------------------------------------------------------------------------
211
211
212
- num_pred <- names( hpc )[ 1 : 3 ]
212
+ num_pred <- c( " input_fields " , " num_pending " , " iterations " )
213
213
hpc_bad_form <- as.formula(class ~ term )
214
214
hpc_basic <- linear_reg() %> % set_engine(" lm" )
215
215
@@ -279,43 +279,44 @@ test_that('lm execution', {
279
279
})
280
280
281
281
test_that(' lm prediction' , {
282
- uni_lm <- lm(input_fields ~ compounds + iterations + num_pending , data = hpc )
282
+ uni_lm <- lm(compounds ~ input_fields + num_pending + iterations , data = hpc )
283
283
uni_pred <- unname(predict(uni_lm , newdata = hpc [1 : 5 , ]))
284
- inl_lm <- lm(input_fields ~ log(compounds ) + class , data = hpc )
284
+ inl_lm <- lm(compounds ~ log(input_fields ) + class , data = hpc )
285
285
inl_pred <- unname(predict(inl_lm , newdata = hpc [1 : 5 , ]))
286
- mv_lm <- lm(cbind(compounds , iterations ) ~ . , data = hpc )
286
+ mv_lm <- lm(cbind(input_fields , num_pending ) ~ . , data = hpc )
287
287
mv_pred <- as_tibble(predict(mv_lm , newdata = hpc [1 : 5 , ]))
288
- names(mv_pred ) <- c(" .pred_compounds" , " .pred_iterations" )
289
-
288
+ names(mv_pred ) <- c(" .pred_input_fields" , " .pred_num_pending" )
290
289
291
290
res_xy <- fit_xy(
292
291
hpc_basic ,
293
292
x = hpc [, num_pred ],
294
- y = hpc $ input_fields ,
293
+ y = hpc $ compounds ,
295
294
control = ctrl
296
295
)
297
296
298
297
expect_equal(uni_pred , predict(res_xy , hpc [1 : 5 , num_pred ])$ .pred )
299
298
300
299
res_form <- fit(
301
300
hpc_basic ,
302
- input_fields ~ log(compounds ) + class ,
301
+ compounds ~ log(input_fields ) + class ,
303
302
data = hpc ,
304
303
control = ctrl
305
304
)
305
+
306
306
expect_equal(inl_pred , predict(res_form , hpc [1 : 5 , ])$ .pred )
307
307
308
308
res_mv <- fit(
309
309
hpc_basic ,
310
- cbind(compounds , iterations ) ~ . ,
310
+ cbind(input_fields , num_pending ) ~ . ,
311
311
data = hpc ,
312
312
control = ctrl
313
313
)
314
+
314
315
expect_equal(mv_pred , predict(res_mv , hpc [1 : 5 ,]))
315
316
})
316
317
317
318
test_that(' lm intervals' , {
318
- stats_lm <- lm(input_fields ~ compounds + iterations + num_pending ,
319
+ stats_lm <- lm(compounds ~ input_fields + iterations + num_pending ,
319
320
data = hpc )
320
321
confidence_lm <- predict(stats_lm , newdata = hpc [1 : 5 , ],
321
322
level = 0.93 , interval = " confidence" )
@@ -325,7 +326,7 @@ test_that('lm intervals', {
325
326
res_xy <- fit_xy(
326
327
linear_reg() %> % set_engine(" lm" ),
327
328
x = hpc [, num_pred ],
328
- y = hpc $ input_fields ,
329
+ y = hpc $ compounds ,
329
330
control = ctrl
330
331
)
331
332
0 commit comments