Skip to content

Commit c0dddfc

Browse files
author
minjk-bl
committed
ML page prototype
1 parent 29a3a1c commit c0dddfc

17 files changed

+1892
-82
lines changed

css/component/instanceEditor.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
.vp-ins-select-box {
2424
margin-top: 5px;
25-
border: 0.25px solid #C4C4C4;
25+
border: 0.25px solid var(--border-gray-color);
2626
}
2727
.vp-ins-select-list {
2828
height: 145px;

css/popupComponent.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,14 @@
308308
.vp-popup-frame select::-ms-expand {
309309
display: none;
310310
}
311+
/* Big Selector */
312+
.vp-popup-frame .vp-big-select {
313+
border: 2px solid #FFCF73;
314+
width: 100%;
315+
height: 35px;
316+
background-position: 97% 50%;
317+
cursor: pointer;
318+
}
311319
/* accordian for popup component */
312320
.vp-popup-frame .vp-accordian {
313321
cursor: pointer;

data/libraries.json

Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,7 +3102,35 @@
31023102
"grid" : true,
31033103
"item" : [
31043104
{
3105-
"id" : "ml_split",
3105+
"id" : "ml_dataSet",
3106+
"type" : "function",
3107+
"level": 1,
3108+
"name" : "Data Sets",
3109+
"tag" : "DATA SETS,MACHINE LEARNING,ML",
3110+
"path" : "visualpython - machine_learning - data sets",
3111+
"desc" : "Data sets for machine learning",
3112+
"file" : "m_ml/DataSets",
3113+
"apps" : {
3114+
"color": 1,
3115+
"icon": "apps/apps_white.svg"
3116+
}
3117+
},
3118+
{
3119+
"id" : "ml_dataPrep",
3120+
"type" : "function",
3121+
"level": 1,
3122+
"name" : "Data Prep",
3123+
"tag" : "DATA PREPARATION,MACHINE LEARNING,ML",
3124+
"path" : "visualpython - machine_learning - data prep",
3125+
"desc" : "Data preparation for machine learning",
3126+
"file" : "m_ml/DataPrep",
3127+
"apps" : {
3128+
"color": 1,
3129+
"icon": "apps/apps_white.svg"
3130+
}
3131+
},
3132+
{
3133+
"id" : "ml_dataSplit",
31063134
"type" : "function",
31073135
"level": 1,
31083136
"name" : "Data Split",
@@ -3116,59 +3144,73 @@
31163144
}
31173145
},
31183146
{
3119-
"id" : "ml_modelSelection",
3147+
"id" : "ml_regression",
3148+
"type" : "function",
3149+
"level": 1,
3150+
"name" : "Regression",
3151+
"tag" : "REGRESSION,MODEL,MACHINE LEARNING,ML",
3152+
"path" : "visualpython - machine_learning - regression",
3153+
"desc" : "Regression model for machine learning",
3154+
"file" : "m_ml/Regression",
3155+
"apps" : {
3156+
"color": 1,
3157+
"icon": "apps/apps_model.svg"
3158+
}
3159+
},
3160+
{
3161+
"id" : "ml_classification",
31203162
"type" : "function",
31213163
"level": 1,
3122-
"name" : "Model Creating",
3123-
"tag" : "MODEL CREATE,MACHINE LEARNING,ML",
3124-
"path" : "visualpython - machine_learning - model selection",
3125-
"desc" : "Model creating for machine learning",
3126-
"file" : "m_ml/modelSelection",
3164+
"name" : "Classification",
3165+
"tag" : "CLASSIFICATION,MODEL,MACHINE LEARNING,ML",
3166+
"path" : "visualpython - machine_learning - classification",
3167+
"desc" : "Classification model for machine learning",
3168+
"file" : "m_ml/Classification",
31273169
"apps" : {
31283170
"color": 1,
31293171
"icon": "apps/apps_model.svg"
31303172
}
31313173
},
31323174
{
3133-
"id" : "ml_fitting",
3175+
"id" : "ml_clustering",
31343176
"type" : "function",
31353177
"level": 1,
3136-
"name" : "Fitting",
3137-
"tag" : "FITTING,MACHINE LEARNING,ML",
3138-
"path" : "visualpython - machine_learning - fitting",
3139-
"desc" : "Fitting for machine learning",
3140-
"file" : "m_ml/fitting",
3178+
"name" : "Clustering",
3179+
"tag" : "CLUSTERING,MODEL,MACHINE LEARNING,ML",
3180+
"path" : "visualpython - machine_learning - clustering",
3181+
"desc" : "Clustering model for machine learning",
3182+
"file" : "m_ml/Clustering",
31413183
"apps" : {
31423184
"color": 1,
3143-
"icon": "apps/apps_fit.svg"
3185+
"icon": "apps/apps_model.svg"
31443186
}
31453187
},
31463188
{
3147-
"id" : "ml_transformation",
3189+
"id" : "ml_dimensionReduction",
31483190
"type" : "function",
31493191
"level": 1,
3150-
"name" : "Transform",
3151-
"tag" : "TRANSFORMATION,MACHINE LEARNING,ML",
3152-
"path" : "visualpython - machine_learning - transformation",
3153-
"desc" : "Transformation for machine learning",
3154-
"file" : "m_ml/transformation",
3192+
"name" : "Dimension Reduction",
3193+
"tag" : "DIMENSION REDUCTION,MODEL,MACHINE LEARNING,ML",
3194+
"path" : "visualpython - machine_learning - dimension_reduction",
3195+
"desc" : "Dimension reduction model for machine learning",
3196+
"file" : "m_ml/DimensionReduction",
31553197
"apps" : {
31563198
"color": 1,
3157-
"icon": "apps/apps_transform.svg"
3199+
"icon": "apps/apps_model.svg"
31583200
}
31593201
},
31603202
{
3161-
"id" : "ml_prediction",
3203+
"id" : "ml_autoML",
31623204
"type" : "function",
31633205
"level": 1,
3164-
"name" : "Prediction",
3165-
"tag" : "PREDICTION,MACHINE LEARNING,ML",
3166-
"path" : "visualpython - machine_learning - prediction",
3167-
"desc" : "Prediction for machine learning",
3168-
"file" : "m_ml/prediction",
3206+
"name" : "AutoML",
3207+
"tag" : "AUTO ML,MODEL,MACHINE LEARNING,ML",
3208+
"path" : "visualpython - machine_learning - automl",
3209+
"desc" : "AutoML model for machine learning",
3210+
"file" : "m_ml/AutoML",
31693211
"apps" : {
31703212
"color": 1,
3171-
"icon": "apps/apps_predict.svg"
3213+
"icon": "apps/apps_model.svg"
31723214
}
31733215
},
31743216
{

data/m_ml/mlLibrary.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,98 @@ define([
2020
* ]
2121
*/
2222
var ML_LIBRARIES = {
23+
/** Data Preparation - Encoding */
24+
'prep-onehot': {
25+
name: 'OneHotEncoder',
26+
import: 'from sklearn.preprocessing import OneHotEncoder',
27+
code: 'OneHotEncoder()',
28+
options: [
29+
30+
]
31+
},
32+
'prep-label': {
33+
name: 'LabelEncoder',
34+
import: 'from sklearn.preprocessing import LabelEncoder',
35+
code: 'LabelEncoder()',
36+
options: [
37+
38+
]
39+
},
40+
'prep-ordinal': {
41+
name: 'OrdinalEncoder',
42+
import: 'from sklearn.preprocessing import OrdinalEncoder',
43+
code: 'OrdinalEncoder()',
44+
options: [
45+
46+
]
47+
},
48+
'prep-target': {
49+
name: 'TargetEncoder',
50+
install: '!pip install category_encoders',
51+
import: 'from category_encoders.target_encoder import TargetEncoder',
52+
code: 'TargetEncoder()',
53+
options: [
54+
55+
]
56+
},
57+
'prep-smote': {
58+
name: 'SMOTE',
59+
install: '!pip install imblearn',
60+
import: 'from imlearn.over_sampling import SMOTE',
61+
code: 'SMOTE()',
62+
options: [
63+
64+
]
65+
},
66+
/** Data Preparation - Scaling */
67+
'prep-standard': {
68+
name: 'StandardScaler',
69+
import: 'from sklearn.preprocessing import StandardScaler',
70+
code: 'StandardScaler()',
71+
options: [
72+
73+
]
74+
},
75+
'prep-robust': {
76+
name: 'RobustScaler',
77+
import: 'from sklearn.preprocessing import RobustScaler',
78+
code: 'RobustScaler()',
79+
options: [
80+
81+
]
82+
},
83+
'prep-minmax': {
84+
name: 'MinMaxScaler',
85+
import: 'from sklearn.preprocessing import MinMaxScaler',
86+
code: 'MinMaxScaler()',
87+
options: [
88+
89+
]
90+
},
91+
'prep-normalizer': {
92+
name: 'Normalizer',
93+
import: 'from sklearn.preprocessing import Normalizer',
94+
code: 'Normalizer()',
95+
options: [
96+
97+
]
98+
},
99+
'prep-func-trsfrm-log': {
100+
name: 'Log Scaling',
101+
import: 'from sklearn.preprocessing import FunctionTransformer',
102+
code: 'FunctionTransformer(np.log1p)',
103+
options: [
104+
105+
]
106+
},
107+
'prep-func-trsfrm-exp': {
108+
name: 'Exponential Scaling',
109+
import: 'from sklearn.preprocessing import FunctionTransformer',
110+
code: 'FunctionTransformer(np.expm1)',
111+
options: [
112+
113+
]
114+
},
23115
/** Regression */
24116
'ln-rgs': {
25117
name: 'LinearRegression',

html/m_ml/model.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<body>
2+
<div class="vp-grid-box">
3+
<select id="modelControlType" class="vp-big-select vp-state">
4+
<option value="creation">Model Creation</option>
5+
<option value="selection">Model Selection</option>
6+
</select>
7+
<div class="vp-grid-box vp-model-box" data-type="creation">
8+
<div class="vp-grid-border-box">
9+
<div class="vp-grid-col-110">
10+
<label for="modelType" class="vp-orange-text">Model type</label>
11+
<div>
12+
<select id="modelType" class="vp-select vp-state">
13+
<!-- Auto Create -->
14+
</select>
15+
<button class="vp-button" id="vp_installLibrary">Install</button>
16+
</div>
17+
</div>
18+
<div class="vp-grid-col-110 vp-model-option-box">
19+
20+
</div>
21+
</div>
22+
<div class="vp-grid-border-box vp-grid-col-110">
23+
<label for="featureData" class="vp-orange-text">Feature data</label>
24+
<input type="text" class="vp-input vp-state" id="featureData" placeholder="Select feature data" value="X_train"/>
25+
<label for="targetData" class="vp-orange-text">Target data</label>
26+
<input type="text" class="vp-input vp-state" id="targetData" placeholder="Select target data" value="y_train"/>
27+
</div>
28+
<div class="vp-grid-border-box vp-grid-col-110">
29+
<label for="allocateTo" class="vp-orange-text">Allocate to</label>
30+
<input type="text" class="vp-input vp-state" id="allocateTo" placeholder="New variable name" value="model"/>
31+
</div>
32+
</div>
33+
<div class="vp-grid-box vp-model-box" data-type="selection">
34+
<div class="vp-grid-border-box vp-grid-col-110">
35+
<label for="model" class="vp-orange-text">Model</label>
36+
<select id="model" class="vp-select vp-state">
37+
<!-- Auto Create -->
38+
</select>
39+
</div>
40+
<div class="vp-grid-border-box">
41+
<div id="instanceEditor">
42+
<!-- instanceEditor -->
43+
</div>
44+
</div>
45+
</div>
46+
</div>
47+
</body>

html/m_ml/modelSelection.html

Lines changed: 0 additions & 28 deletions
This file was deleted.

js/com/com_Config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,11 @@ define([
437437
})
438438
}
439439

440-
getMLDataDict() {
441-
return Config.ML_DATA_DICT;
440+
getMLDataDict(key = '') {
441+
if (key == '') {
442+
return Config.ML_DATA_DICT;
443+
}
444+
return Config.ML_DATA_DICT[key];
442445
}
443446

444447
getMLDataTypes() {
@@ -493,6 +496,12 @@ define([
493496
],
494497
'Dimension Reduction': [
495498
'PCA', 'LinearDiscriminantAnalysis', 'TruncatedSVD', 'NMF'
499+
],
500+
'Data Preparation': [
501+
/** Encoding */
502+
'OneHotEncoder', 'LabelEncoder', 'OrdinalEncoder', 'TargetEncoder', 'SMOTE',
503+
/** Scaling */
504+
'StandardScaler', 'RobustScaler', 'MinMaxScaler', 'Normalizer', 'FunctionTransformer'
496505
]
497506
};
498507

@@ -501,7 +510,8 @@ define([
501510
...Config.ML_DATA_DICT['Classification'],
502511
...Config.ML_DATA_DICT['Auto ML'],
503512
...Config.ML_DATA_DICT['Clustering'],
504-
...Config.ML_DATA_DICT['Dimension Reduction']
513+
...Config.ML_DATA_DICT['Dimension Reduction'],
514+
...Config.ML_DATA_DICT['Data Preparation']
505515
];
506516

507517
return Config;

js/com/com_Kernel.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,12 @@ define([
250250
//====================================================================
251251
// Machine Learning
252252
//====================================================================
253-
getModelList() {
253+
getModelList(modelCategory='') {
254254
// use function command to get variable list of selected data types
255255
var cmdSB = `_vp_print(_vp_get_variables_list(${JSON.stringify(vpConfig.getMLDataTypes())}))`;
256-
256+
if (modelCategory != '') {
257+
cmdSB = `_vp_print(_vp_get_variables_list(${JSON.stringify(vpConfig.getMLDataDict(modelCategory))}))`;
258+
}
257259
var that = this;
258260
return new Promise(function(resolve, reject) {
259261
that.execute(cmdSB).then(function(resultObj) {

0 commit comments

Comments
 (0)