Skip to content

Commit 28ffb20

Browse files
author
minjk-bl
committed
Implement GridSearch app
1 parent 7030217 commit 28ffb20

File tree

5 files changed

+695
-0
lines changed

5 files changed

+695
-0
lines changed

visualpython/css/m_ml/gridSearch.css

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
.vp-inner-param-list-box {
2+
width: 245px;
3+
height: 140px;
4+
border: 0.25px solid var(--vp-border-gray-color);
5+
overflow-y: auto;
6+
overflow-x: hidden;
7+
margin: 5px 0;
8+
}
9+
.vp-inner-param-list-item {
10+
width: 100%;
11+
height: 30px;
12+
line-height: 30px;
13+
padding: 0px 10px;
14+
border-bottom: 0.25px solid var(--vp-border-gray-color);
15+
background-color: var(--vp-background-color);
16+
text-overflow: ellipsis;
17+
overflow: hidden;
18+
white-space: nowrap;
19+
}
20+
.vp-inner-param-list-item:hover {
21+
cursor: pointer;
22+
background-color: var(--vp-background-hover-color);
23+
}
24+
.vp-inner-param-list-item.selected {
25+
color: var(--vp-font-highlight);
26+
background-color: var(--vp-light-gray-color);
27+
}
28+
.vp-param-grid-title {
29+
line-height: 30px;
30+
}
31+
.vp-param-grid-box {
32+
margin-bottom: 10px;
33+
}
34+
.vp-param-set {
35+
36+
}
37+
.vp-param-set-del {
38+
cursor: pointer;
39+
float: right;
40+
}
41+
.vp-param-set-add {
42+
cursor: pointer;
43+
}
44+
.vp-param-item > label {
45+
align-self: center;
46+
}
47+
.vp-param-item-del {
48+
cursor: pointer;
49+
height: 42px;
50+
}
51+
.vp-param-result-input-box {
52+
width: 100%;
53+
border: 0.25px solid var(--vp-border-gray-color);
54+
padding: 5px;
55+
display: flex;
56+
gap: 5px;
57+
}
58+
.vp-param-result-box {
59+
display: inline-flex;
60+
gap: 5px;
61+
}
62+
.vp-param-result-item {
63+
border: 0.25px solid var(--vp-light-gray-color);
64+
background: var(--vp-light-gray-color);
65+
border-radius: 10px;
66+
padding: 5px 7px;
67+
display: flex;
68+
gap: 5px;
69+
align-items: center;
70+
}
71+
.vp-param-result-item:hover {
72+
border: 0.25px solid var(--vp-font-highlight);
73+
color: var(--vp-font-highlight);
74+
}
75+
.vp-param-result-item-del {
76+
width: 15px;
77+
display: inline-block;
78+
}
79+
input.vp-param-val {
80+
border: 0px !important;
81+
width: 100% !important;
82+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<body>
2+
<div class="vp-grid-box">
3+
<div class="vp-grid-box vp-model-box" data-type="creation">
4+
<div class="vp-grid-border-box">
5+
<div class="vp-grid-col-110">
6+
<label for="modelType" class="vp-orange-text">Model type</label>
7+
<div class="vp-flex-gap5">
8+
<select id="modelType" class="vp-select vp-state">
9+
<!-- Auto Create -->
10+
</select>
11+
</div>
12+
</div>
13+
<hr style="margin: 5px 0;" />
14+
<div class="vp-grid-col-110 vp-model-option-box">
15+
16+
</div>
17+
<div class="vp-grid-col-110">
18+
<label for="allocateToCreation" class="vp-orange-text">Allocate to</label>
19+
<input type="text" class="vp-input vp-state" id="allocateToCreation" placeholder="New variable name" value="model"/>
20+
</div>
21+
</div>
22+
<hr style="margin: 5px 0;" />
23+
<div class="vp-flex-gap10">
24+
<label class="vp-bold vp-param-grid-title">Param grid</label>
25+
<button class="vp-button vp-param-set-add" id="vp_addParamSet">+ Add param set</button>
26+
</div>
27+
<div class="vp-grid-box vp-param-grid-box">
28+
<div class="vp-grid-border-box vp-param-set-box">
29+
<div>
30+
<label class="vp-bold vp-param-set-name">Param set 1</label>
31+
<div class="vp-icon-delete vp-param-set-del" title="Delete this param set."></div>
32+
</div>
33+
<div class="vp-grid-box vp-param-item-box">
34+
35+
</div>
36+
<button class="vp-button vp-param-item-add">+ Add param</button>
37+
</div>
38+
</div>
39+
</div>
40+
</div>
41+
</body>

visualpython/js/m_ml/FitPredict.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,51 @@ define([
685685
}
686686
}
687687
break;
688+
case 'ETC':
689+
if (modelType === 'GridSearchCV') {
690+
actions = {
691+
'fit': {
692+
name: 'fit',
693+
label: 'Fit',
694+
code: '${model}.fit(${fit_featureData})',
695+
description: 'Run fit with all sets of parameters.',
696+
options: [
697+
{ name: 'fit_featureData', label: 'Feature Data', component: ['data_select'], var_type: ['DataFrame', 'Series', 'ndarray', 'list', 'dict'], value: 'X' }
698+
]
699+
},
700+
'predict': {
701+
name: 'predict',
702+
label: 'Predict',
703+
code: '${pred_allocate} = ${model}.predict(${pred_featureData})',
704+
description: 'Call predict on the estimator with the best found parameters.',
705+
options: [
706+
{ name: 'pred_featureData', label: 'Feature Data', component: ['data_select'], var_type: ['DataFrame', 'Series', 'ndarray', 'list', 'dict'], value: 'X' },
707+
{ name: 'pred_allocate', label: 'Allocate to', component: ['input'], placeholder: 'New variable', value: 'pred' }
708+
]
709+
},
710+
'inverse_transform': {
711+
name: 'inverse_transform',
712+
label: 'Inverse transform',
713+
code: '${inverse_allocate} = ${model}.inverse_transform(${inverse_featureData})',
714+
description: 'Call inverse_transform on the estimator with the best found params.',
715+
options: [
716+
{ name: 'inverse_featureData', label: 'Feature Data', component: ['data_select'], var_type: ['DataFrame', 'Series', 'ndarray', 'list', 'dict'], value: 'X' },
717+
{ name: 'inverse_allocate', label: 'Allocate to', component: ['input'], placeholder: 'New variable', value: 'inv_trans' }
718+
]
719+
},
720+
'transform': {
721+
name: 'transform',
722+
label: 'Transform',
723+
code: '${trans_allocate} = ${model}.transform(${trans_featureData})',
724+
description: 'Call transform on the estimator with the best found parameters.',
725+
options: [
726+
{ name: 'trans_featureData', label: 'Feature Data', component: ['data_select'], var_type: ['DataFrame', 'Series', 'ndarray', 'list', 'dict'], value: 'X' },
727+
{ name: 'trans_allocate', label: 'Allocate to', component: ['input'], placeholder: 'New variable', value: 'trans' }
728+
]
729+
}
730+
}
731+
}
732+
break;
688733
}
689734
return actions;
690735
}

0 commit comments

Comments
 (0)