@@ -59,7 +59,7 @@ define([
5959this . modelTypeList = {
6060'Encoding' :[ 'prep-onehot' , 'prep-label' , 'prep-ordinal' , 'prep-target' , 'prep-smote' ] ,
6161'Scaling' :[ 'prep-standard' , 'prep-robust' , 'prep-minmax' , 'prep-normalizer' , 'prep-func-trsfrm-log' , 'prep-func-trsfrm-exp' , 'prep-poly-feat' , 'prep-kbins-discretizer' ] ,
62- 'ETC' :[ 'make-column-transformer' ]
62+ 'ETC' :[ 'prep-simple-imputer' , ' make-column-transformer']
6363}
6464
6565this . mctEstimator = {
@@ -94,10 +94,19 @@ define([
9494$ ( that . wrapSelector ( '#vp_installLibrary' ) ) . hide ( ) ;
9595}
9696
97- if ( modelType == 'make-column-transformer' ) {
97+ if ( modelType === 'make-column-transformer' ) {
9898// load mct-targetData
9999that . loadVariableList ( ) ;
100100that . bindMCT ( ) ;
101+ } else if ( modelType === 'prep-simple-imputer' ) {
102+ $ ( that . wrapSelector ( '#missing_values' ) ) . replaceWith ( `<div>
103+ ${ $ ( that . wrapSelector ( '#missing_values' ) ) [ 0 ] . outerHTML }
104+ <label><input type="checkbox" id="missing_values_istext" class="vp-state"/><span>Text</span></label>
105+ </div>` ) ;
106+ $ ( that . wrapSelector ( '#fill_value' ) ) . replaceWith ( `<div>
107+ ${ $ ( that . wrapSelector ( '#fill_value' ) ) [ 0 ] . outerHTML }
108+ <label><input type="checkbox" id="fill_value_istext" class="vp-state"/><span>Text</span></label>
109+ </div>` ) ;
101110}
102111} ) ;
103112
@@ -411,6 +420,7 @@ define([
411420
412421generateCode ( ) {
413422let { modelControlType, modelType, userOption, allocateToCreation, model} = this . state ;
423+ let state = JSON . parse ( JSON . stringify ( this . state ) ) ;
414424let code = new com_String ( ) ;
415425if ( modelControlType == 'creation' ) {
416426/**
@@ -422,22 +432,33 @@ define([
422432let config = this . modelConfig [ modelType ] ;
423433code . appendLine ( config . import ) ;
424434
435+ if ( modelType === 'prep-simple-imputer' ) {
436+ let checkList = [ 'missing_values' , 'fill_value' ] ;
437+ checkList . forEach ( checkKey => {
438+ try {
439+ state [ checkKey ] = com_util . convertToStr ( state [ checkKey ] , state [ checkKey + '_istext' ] ) ;
440+ } catch ( e ) {
441+ ;
442+ }
443+ } ) ;
444+ }
445+
425446// model code
426447let modelCode = config . code ;
427- modelCode = com_generator . vp_codeGenerator ( this , config , this . state , ( userOption != '' ?', ' + userOption :'' ) ) ;
448+ modelCode = com_generator . vp_codeGenerator ( this , config , state , ( userOption != '' ?', ' + userOption :'' ) ) ;
428449
429450// generate mct code
430- if ( modelType == 'make-column-transformer' ) {
451+ if ( modelType === 'make-column-transformer' ) {
431452let mctCodes = [ ] ;
432- let { mct_estimator1, mct_columns1, mct_estimator2, mct_columns2} = this . state ;
453+ let { mct_estimator1, mct_columns1, mct_estimator2, mct_columns2} = state ;
433454if ( mct_estimator1 != undefined && mct_estimator1 != '' ) {
434455code . appendLine ( this . modelConfig [ mct_estimator1 ] . import ) ;
435- let estimator1code = com_generator . vp_codeGenerator ( this , this . modelConfig [ mct_estimator1 ] , this . state , ( userOption != '' ?', ' + userOption :'' ) ) ;
456+ let estimator1code = com_generator . vp_codeGenerator ( this , this . modelConfig [ mct_estimator1 ] , state , ( userOption != '' ?', ' + userOption :'' ) ) ;
436457mctCodes . push ( com_util . formatString ( '({0}, [{1}])' , estimator1code , mct_columns1 ) ) ;
437458}
438459if ( mct_estimator2 != undefined && mct_estimator2 != '' ) {
439460code . appendLine ( this . modelConfig [ mct_estimator2 ] . import ) ;
440- let estimator2code = com_generator . vp_codeGenerator ( this , this . modelConfig [ mct_estimator2 ] , this . state , ( userOption != '' ?', ' + userOption :'' ) ) ;
461+ let estimator2code = com_generator . vp_codeGenerator ( this , this . modelConfig [ mct_estimator2 ] , state , ( userOption != '' ?', ' + userOption :'' ) ) ;
441462mctCodes . push ( com_util . formatString ( '({0}, [{1}])' , estimator2code , mct_columns2 ) ) ;
442463}
443464modelCode = modelCode . replace ( '${mct_code}' , mctCodes . join ( ', ' ) ) ;