@@ -215,6 +215,37 @@ def test_forest_regression(cas_session, boston_dataset):
215
215
check_input_variables (files , BOSTON_INPUT_VARS )
216
216
217
217
218
+ def test_forest_regression_with_nominals (cas_session , boston_dataset ):
219
+ target = {
220
+ 'tool' : 'SAS Visual Data Mining and Machine Learning' ,
221
+ 'targetVariable' : 'Price' ,
222
+ 'scoreCodeType' : 'ds2MultiType' ,
223
+ 'function' : 'prediction' ,
224
+ 'algorithm' : 'Random forest' ,
225
+ }
226
+
227
+ cas_session .loadactionset ('decisiontree' )
228
+ cas_session .loadactionset ('astore' )
229
+
230
+ tbl = cas_session .upload (boston_dataset ).casTable
231
+
232
+ tbl .decisiontree .foresttrain (
233
+ target = 'Price' ,
234
+ inputs = list (boston_dataset .columns [:- 1 ]),
235
+ nominals = ['chas' ],
236
+ saveState = 'astore' ,
237
+ )
238
+
239
+ desc = cas_session .astore .describe (rstore = 'astore' , epcode = True )
240
+ props = _get_model_properties (desc )
241
+
242
+ for k , v in target .items ():
243
+ assert props [k ] == v
244
+
245
+ files = create_files_from_astore (cas_session .CASTable ('astore' ))
246
+ check_input_variables (files , BOSTON_INPUT_VARS )
247
+
248
+
218
249
def test_gradboost_binary_classification (cas_session , cancer_dataset ):
219
250
target = {
220
251
'tool' : 'SAS Visual Data Mining and Machine Learning' ,
@@ -300,6 +331,37 @@ def test_gradboost_regression(cas_session, boston_dataset):
300
331
check_input_variables (files , BOSTON_INPUT_VARS )
301
332
302
333
334
+ def test_gradboost_regression_with_nominals (cas_session , boston_dataset ):
335
+ target = {
336
+ 'tool' : 'SAS Visual Data Mining and Machine Learning' ,
337
+ 'targetVariable' : 'Price' ,
338
+ 'scoreCodeType' : 'ds2MultiType' ,
339
+ 'function' : 'prediction' ,
340
+ 'algorithm' : 'Gradient boosting' ,
341
+ }
342
+
343
+ cas_session .loadactionset ('decisiontree' )
344
+ cas_session .loadactionset ('astore' )
345
+
346
+ tbl = cas_session .upload (boston_dataset ).casTable
347
+
348
+ tbl .decisiontree .gbtreetrain (
349
+ target = 'Price' ,
350
+ inputs = list (boston_dataset .columns [:- 1 ]),
351
+ nominals = ['chas' ],
352
+ savestate = 'astore' ,
353
+ )
354
+
355
+ desc = cas_session .astore .describe (rstore = 'astore' , epcode = True )
356
+ props = _get_model_properties (desc )
357
+
358
+ for k , v in target .items ():
359
+ assert props [k ] == v
360
+
361
+ files = create_files_from_astore (cas_session .CASTable ('astore' ))
362
+ check_input_variables (files , BOSTON_INPUT_VARS )
363
+
364
+
303
365
def test_neuralnet_regression (cas_session , boston_dataset ):
304
366
target = {
305
367
'tool' : 'SAS Visual Data Mining and Machine Learning' ,
@@ -393,6 +455,34 @@ def test_svm_regression(cas_session, boston_dataset):
393
455
check_input_variables (files , BOSTON_INPUT_VARS )
394
456
395
457
458
+ def test_svm_regression_with_nominals (cas_session , boston_dataset ):
459
+ target = {
460
+ 'tool' : 'SAS Visual Data Mining and Machine Learning' ,
461
+ 'targetVariable' : 'Price' ,
462
+ 'scoreCodeType' : 'ds2MultiType' ,
463
+ 'function' : 'prediction' ,
464
+ 'algorithm' : 'Support vector machine' ,
465
+ }
466
+
467
+ cas_session .loadactionset ('svm' )
468
+ cas_session .loadactionset ('astore' )
469
+
470
+ tbl = cas_session .upload (boston_dataset ).casTable
471
+
472
+ tbl .svm .svmTrain (
473
+ target = 'Price' , inputs = list (boston_dataset .columns [:- 1 ]), nominals = ['chas' ], saveState = 'astore'
474
+ )
475
+
476
+ desc = cas_session .astore .describe (rstore = 'astore' , epcode = True )
477
+ props = _get_model_properties (desc )
478
+
479
+ for k , v in target .items ():
480
+ assert props [k ] == v
481
+
482
+ files = create_files_from_astore (cas_session .CASTable ('astore' ))
483
+ check_input_variables (files , BOSTON_INPUT_VARS )
484
+
485
+
396
486
def test_bayesnet_binary_classification (cas_session , cancer_dataset ):
397
487
target = {
398
488
'tool' : 'SAS Visual Data Mining and Machine Learning' ,
0 commit comments