@@ -143,7 +143,6 @@ define([
143143 description : 'Transform labels to normalized encoding.'
144144 }
145145 }
146-
147146 if ( modelType != 'ColumnTransformer' ) {
148147 actions = {
149148 ...actions ,
@@ -159,6 +158,32 @@ define([
159158 }
160159 }
161160 }
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+ }
162187 break ;
163188 case 'Regression' :
164189 actions = {
@@ -407,10 +432,11 @@ define([
407432 'fit' : {
408433 name : 'fit' ,
409434 label : 'Fit' ,
410- code : '${model}.fit(${fit_featureData})' ,
435+ code : '${model}.fit(${fit_featureData}${fit_targetData} )' ,
411436 description : 'Run fit with all sets of parameters.' ,
412437 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' }
414440 ]
415441 } ,
416442 'predict' : {
@@ -419,7 +445,7 @@ define([
419445 code : '${pred_allocate} = ${model}.predict(${pred_featureData})' ,
420446 description : 'Call predict on the estimator with the best found parameters.' ,
421447 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 ' } ,
423449 { name : 'pred_allocate' , label : 'Allocate to' , component : [ 'input' ] , placeholder : 'New variable' , value : 'pred' }
424450 ]
425451 } ,
@@ -598,6 +624,19 @@ define([
598624 }
599625 }
600626 }
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+ }
601640 infos = {
602641 ...infos ,
603642 'get_params' : defaultInfos [ 'get_params' ]
0 commit comments