@@ -135,7 +135,7 @@ define([
135135description :'Fit Encoder/Scaler to X, then transform X.' ,
136136options :[
137137{ name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
138- { name :'fit_trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' }
138+ { name :'fit_trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value : 'trans' }
139139]
140140} ,
141141'transform' :{
@@ -154,7 +154,7 @@ define([
154154description :'Transform binary labels back to multi-class labels.' ,
155155options :[
156156{ name :'inverse_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
157- { name :'inverse_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' }
157+ { name :'inverse_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value : 'inv_trans' }
158158]
159159}
160160}
@@ -209,7 +209,15 @@ define([
209209if ( modelType == 'AgglomerativeClustering'
210210|| modelType == 'DBSCAN' ) {
211211actions = {
212- 'fit' :defaultActions [ 'fit' ] ,
212+ 'fit' :{
213+ name :'fit' ,
214+ label :'Fit' ,
215+ code :'${model}.fit(${fit_featureData})' ,
216+ description :'Perform clustering from features, or distance matrix.' ,
217+ options :[
218+ { name :'fit_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' }
219+ ]
220+ } ,
213221'fit_predict' :{
214222name :'fit_predict' ,
215223label :'Fit and predict' ,
@@ -224,8 +232,25 @@ define([
224232break ;
225233}
226234actions = {
227- 'fit' :defaultActions [ 'fit' ] ,
228- 'predict' :defaultActions [ 'predict' ] ,
235+ 'fit' :{
236+ name :'fit' ,
237+ label :'Fit' ,
238+ code :'${model}.fit(${fit_featureData})' ,
239+ description :'Compute clustering.' ,
240+ options :[
241+ { name :'fit_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' }
242+ ]
243+ } ,
244+ 'predict' :{
245+ name :'predict' ,
246+ label :'Predict' ,
247+ code :'${pred_allocate} = ${model}.predict(${pred_featureData})' ,
248+ description :'Predict the closest target data X belongs to.' ,
249+ options :[
250+ { name :'pred_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
251+ { name :'pred_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'pred' }
252+ ]
253+ } ,
229254'fit_predict' :{
230255name :'fit_predict' ,
231256label :'Fit and predict' ,
@@ -246,7 +271,7 @@ define([
246271code :'${fit_trans_allocate} = ${model}.fit_transform(${fit_trans_featureData})' ,
247272description :'Compute clustering and transform X to cluster-distance space.' ,
248273options :[
249- { name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X_train ' } ,
274+ { name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X ' } ,
250275{ name :'fit_trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'trans' }
251276]
252277} ,
@@ -266,23 +291,114 @@ define([
266291case 'Dimension Reduction' :
267292if ( modelType == 'TSNE' ) {
268293actions = {
269- 'fit' :defaultActions [ 'fit' ] ,
294+ 'fit' :{
295+ name :'fit' ,
296+ label :'Fit' ,
297+ code :'${model}.fit(${fit_featureData})' ,
298+ description :'Fit X into an embedded space.' ,
299+ options :[
300+ { name :'fit_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' }
301+ ]
302+ } ,
270303'fit_transform' :{
271304name :'fit_transform' ,
272305label :'Fit and transform' ,
273306code :'${fit_trans_allocate} = ${model}.fit_transform(${fit_trans_featureData})' ,
274307description :'Fit X into an embedded space and return that transformed output.' ,
275308options :[
276- { name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X_train ' } ,
309+ { name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X ' } ,
277310{ name :'fit_trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'trans' }
278311]
279312}
280313}
281314break ;
282315}
316+ if ( modelType == 'LinearDiscriminantAnalysis' ) { // LDA
317+ actions = {
318+ 'fit' :{
319+ name :'fit' ,
320+ label :'Fit' ,
321+ code :'${model}.fit(${fit_featureData}, ${fit_targetData})' ,
322+ description :'Fit the Linear Discriminant Analysis model.' ,
323+ options :[
324+ { name :'fit_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
325+ { name :'fit_targetData' , label :'Target Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'y' }
326+ ]
327+ } ,
328+ 'fit_transform' :{
329+ name :'fit_transform' ,
330+ label :'Fit and transform' ,
331+ code :'${fit_trans_allocate} = ${model}.fit_transform(${fit_trans_featureData}${fit_trans_targetData})' ,
332+ description :'Fit to data, then transform it.' ,
333+ options :[
334+ { name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
335+ { name :'fit_trans_targetData' , label :'Target Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'y' } ,
336+ { name :'fit_trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'trans' }
337+ ]
338+ } ,
339+ 'predict' :{
340+ name :'predict' ,
341+ label :'Predict' ,
342+ code :'${pred_allocate} = ${model}.predict(${pred_featureData})' ,
343+ description :'Predict class labels for samples in X.' ,
344+ options :[
345+ { name :'pred_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
346+ { name :'pred_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'pred' }
347+ ]
348+ } ,
349+ 'transform' :{
350+ name :'transform' ,
351+ label :'Transform' ,
352+ code :'${trans_allocate} = ${model}.transform(${trans_featureData})' ,
353+ description :'Project data to maximize class separation.' ,
354+ options :[
355+ { name :'trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
356+ { name :'trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'trans' }
357+ ]
358+ }
359+ }
360+ break ;
361+ }
283362actions = {
284- 'fit' :defaultActions [ 'fit' ] ,
285- 'transform' :defaultActions [ 'transform' ] ,
363+ 'fit' :{
364+ name :'fit' ,
365+ label :'Fit' ,
366+ code :'${model}.fit(${fit_featureData})' ,
367+ description :'Fit X into an embedded space.' ,
368+ options :[
369+ { name :'fit_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' }
370+ ]
371+ } ,
372+ 'fit_transform' :{
373+ name :'fit_transform' ,
374+ label :'Fit and transform' ,
375+ code :'${fit_trans_allocate} = ${model}.fit_transform(${fit_trans_featureData})' ,
376+ description :'Fit the model with X and apply the dimensionality reduction on X.' ,
377+ options :[
378+ { name :'fit_trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
379+ { name :'fit_trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'trans' }
380+ ]
381+ } ,
382+ 'inverse_transform' :{
383+ name :'inverse_transform' ,
384+ label :'Inverse transform' ,
385+ code :'${inverse_allocate} = ${model}.inverse_transform(${inverse_featureData})' ,
386+ description :'Transform data back to its original space.' ,
387+ options :[
388+ { name :'inverse_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
389+ { name :'inverse_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'inv_trans' }
390+ ]
391+ } ,
392+ 'transform' :{
393+ name :'transform' ,
394+ label :'Transform' ,
395+ code :'${trans_allocate} = ${model}.transform(${trans_featureData})' ,
396+ description :'Apply dimensionality reduction to X.' ,
397+ options :[
398+ { name :'trans_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
399+ { name :'trans_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'trans' }
400+ ]
401+ }
286402}
287403break ;
288404}
@@ -533,6 +649,22 @@ define([
533649}
534650break ;
535651case 'Dimension Reduction' :
652+ if ( modelType == 'LDA' ) {
653+ infos = {
654+ 'score' :{
655+ name :'score' ,
656+ label :'Score' ,
657+ code :'${score_allocate} = ${model}.score(${score_featureData}, ${score_targetData})' ,
658+ description :'Return the average log-likelihood of all samples.' ,
659+ options :[
660+ { name :'score_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
661+ { name :'score_targetData' , label :'Target Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'y' } ,
662+ { name :'score_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'scores' }
663+ ]
664+ }
665+ }
666+ break ;
667+ }
536668if ( modelType == 'PCA' ) {
537669infos = {
538670'explained_variance_ratio_' :{
@@ -546,6 +678,19 @@ define([
546678}
547679}
548680}
681+ infos = {
682+ ...infos ,
683+ 'score' :{
684+ name :'score' ,
685+ label :'Score' ,
686+ code :'${score_allocate} = ${model}.score(${score_featureData})' ,
687+ description :'Return the average log-likelihood of all samples.' ,
688+ options :[
689+ { name :'score_featureData' , label :'Feature Data' , component :[ 'var_select' ] , var_type :[ 'DataFrame' , 'Series' ] , value :'X' } ,
690+ { name :'score_allocate' , label :'Allocate to' , component :[ 'input' ] , placeholder :'New variable' , value :'scores' }
691+ ]
692+ }
693+ }
549694break ;
550695}
551696return infos ;