@@ -143,7 +143,6 @@ define([
143
143
description : 'Transform labels to normalized encoding.'
144
144
}
145
145
}
146
-
147
146
if ( modelType != 'ColumnTransformer' ) {
148
147
actions = {
149
148
...actions ,
@@ -159,6 +158,32 @@ define([
159
158
}
160
159
}
161
160
}
161
+ if ( modelType === 'SMOTE' ) {
162
+ actions = {
163
+ 'fit' : {
164
+ name : 'fit' ,
165
+ label : 'Fit' ,
166
+ code : '${model}.fit(${fit_featureData}, ${fit_targetData})' ,
167
+ description : 'Check inputs and statistics of the sampler.' ,
168
+ options : [
169
+ { name : 'fit_featureData' , label : 'Feature Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'X_train' } ,
170
+ { name : 'fit_targetData' , label : 'Target Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'y_train' }
171
+ ]
172
+ } ,
173
+ 'fit_resample' : {
174
+ name : 'fit_resample' ,
175
+ label : 'Fit and resample' ,
176
+ code : '${fit_res_allocateX}, ${fit_res_allocatey} = ${model}.fit_resample(${fit_res_featureData}, ${fit_res_targetData})' ,
177
+ description : 'Resample the dataset.' ,
178
+ options : [
179
+ { name : 'fit_res_allocateX' , label : 'Allocate feature' , component : [ 'input' ] , placeholder : 'New variable' , value : 'X_res' } ,
180
+ { name : 'fit_res_allocatey' , label : 'Allocate target' , component : [ 'input' ] , placeholder : 'New variable' , value : 'y_res' } ,
181
+ { name : 'fit_res_featureData' , label : 'Feature Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'X_train' } ,
182
+ { name : 'fit_res_targetData' , label : 'Target Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'y_train' }
183
+ ]
184
+ }
185
+ }
186
+ }
162
187
break ;
163
188
case 'Regression' :
164
189
actions = {
@@ -407,10 +432,11 @@ define([
407
432
'fit' : {
408
433
name : 'fit' ,
409
434
label : 'Fit' ,
410
- code : '${model}.fit(${fit_featureData})' ,
435
+ code : '${model}.fit(${fit_featureData}${fit_targetData} )' ,
411
436
description : 'Run fit with all sets of parameters.' ,
412
437
options : [
413
- { name : 'fit_featureData' , label : 'Feature Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'X' }
438
+ { name : 'fit_featureData' , label : 'Feature Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'X_train' } ,
439
+ { name : 'fit_targetData' , label : 'Target Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'y_train' , usePair : true , pairKey : 'y' }
414
440
]
415
441
} ,
416
442
'predict' : {
@@ -419,7 +445,7 @@ define([
419
445
code : '${pred_allocate} = ${model}.predict(${pred_featureData})' ,
420
446
description : 'Call predict on the estimator with the best found parameters.' ,
421
447
options : [
422
- { name : 'pred_featureData' , label : 'Feature Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'X ' } ,
448
+ { name : 'pred_featureData' , label : 'Feature Data' , component : [ 'data_select' ] , var_type : [ 'DataFrame' , 'Series' , 'ndarray' , 'list' , 'dict' ] , value : 'X_test ' } ,
423
449
{ name : 'pred_allocate' , label : 'Allocate to' , component : [ 'input' ] , placeholder : 'New variable' , value : 'pred' }
424
450
]
425
451
} ,
@@ -598,6 +624,19 @@ define([
598
624
}
599
625
}
600
626
}
627
+ if ( modelType === 'SMOTE' ) {
628
+ infos = {
629
+ 'get_feature_names_out' : {
630
+ name : 'get_feature_names_out' ,
631
+ label : 'Get feature names' ,
632
+ code : '${feature_names_allocate} = ${model}.get_feature_names_out()' ,
633
+ description : 'Get output feature names for transformation.' ,
634
+ options : [
635
+ { name : 'feature_names_allocate' , label : 'Allocate to' , component : [ 'input' ] , placeholder : 'New variable' , value : 'features' }
636
+ ]
637
+ }
638
+ }
639
+ }
601
640
infos = {
602
641
...infos ,
603
642
'get_params' : defaultInfos [ 'get_params' ]
0 commit comments