Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Devops for v3.0.2#260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
minjk-bl merged 8 commits intovisualpython:devopsfromminjk-bl:devops
May 14, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletionsvisualpython/data/m_library/pandasLibrary.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -206,7 +206,7 @@ define([
},
{
"name": "sep",
"label": "Seperator",
"label": "Separator",
"type": "text",
"usePair": true
},
Expand DownExpand Up@@ -304,7 +304,7 @@ define([
},
{
"name": "sep",
"label": "Seperator",
"label": "Separator",
"type": "text",
"usePair": true
},
Expand DownExpand Up@@ -4342,7 +4342,7 @@ define([
},
{
"name": "prefix_sep",
"label": "HeaderSeperator",
"label": "HeaderSeparator",
"default": "_",
"usePair": true
},
Expand Down
6 changes: 3 additions & 3 deletionsvisualpython/data/m_library/pandasLibrary_v1.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -163,7 +163,7 @@ define([
{
name: 'sep',
type: 'text',
label: 'Seperator'
label: 'Separator'
},
{
name: 'names',
Expand DownExpand Up@@ -243,7 +243,7 @@ define([
{
name: 'sep',
type: 'text',
label: 'Seperator'
label: 'Separator'
},
{
name: 'na_rep',
Expand DownExpand Up@@ -3514,7 +3514,7 @@ define([
{
name: 'prefix_sep',
type: ['text'],
label: 'HeaderSeperator',
label: 'HeaderSeparator',
default: '_'
},
{
Expand Down
16 changes: 8 additions & 8 deletionsvisualpython/data/m_ml/mlLibrary.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -128,10 +128,10 @@ define([
'prep-onehot': {
name: 'OneHotEncoder',
import: 'from sklearn.preprocessing import OneHotEncoder',
code: 'OneHotEncoder(${sparse}${handle_unknown}${etc})',
code: 'OneHotEncoder(${sparse_output}${handle_unknown}${etc})',
returnType: 'OneHotEncoder',
options: [
{ name: 'sparse', component: ['bool_select'], default: 'False', usePair: true },
{ name: 'sparse_output', component: ['bool_select'], default: 'True', value: 'False', usePair: true },
{ name: 'handle_unknown', component: ['option_suggest'], usePair: true,
options: ['error', 'ignore'], default: 'error' },
]
Expand DownExpand Up@@ -490,8 +490,8 @@ define([
code: 'DecisionTreeClassifier(${criterion}${max_depth}${min_samples_split}${random_state}${etc})',
returnType: 'DecisionTreeClassifier',
options: [
{ name: 'criterion', component: ['option_select'], type: 'text', default: 'squared_error', type:'text',
options: ['squared_error', 'friedman_mse', 'absolute_error', 'poisson'], usePair: true },
{ name: 'criterion', component: ['option_select'], type: 'text', default: 'gini', type:'text',
options: ['gini','entropy','log_loss'], usePair: true },
{ name: 'max_depth', component: ['input_number'], placeholder: 'None', usePair: true },
{ name: 'min_samples_split', component: ['input_number'], default: 2, usePair: true },
{ name: 'random_state', component: ['input_number'], placeholder: '123', usePair: true }
Expand All@@ -505,7 +505,7 @@ define([
options: [
{ name: 'n_estimators', component: ['input_number'], default: 100, usePair: true },
{ name: 'criterion', component: ['option_select'], type: 'text', default: 'gini', type:'text', usePair: true,
options: ['gini', 'entropy'] },
options: ['gini', 'entropy', 'log_loss'] },
{ name: 'max_depth', component: ['input_number'], placeholder: 'None', usePair: true },
{ name: 'min_samples_split', component: ['input_number'], default: 2, usePair: true },
{ name: 'n_jobs', component: ['input_number'], placeholder: 'None', usePair: true },
Expand All@@ -518,12 +518,12 @@ define([
code: 'GradientBoostingClassifier(${loss}${learning_rate}${n_estimators}${criterion}${random_state}${etc})',
returnType: 'GradientBoostingClassifier',
options: [
{ name: 'loss', component: ['option_select'], type: 'text', default: 'deviance', type: 'text', usePair: true,
options: ['deviance', 'exponential'] },
{ name: 'loss', component: ['option_select'], type: 'text', default: 'log_loss', type: 'text', usePair: true,
options: ['log_loss', 'exponential'] },
{ name: 'learning_rate', component: ['input_number'], default: 0.1, usePair: true },
{ name: 'n_estimators', component: ['input_number'], default: 100, usePair: true },
{ name: 'criterion', component: ['option_select'], type: 'text', default: 'friedman_mse', type:'text', usePair: true,
options: ['friedman_mse', 'squared_error', 'mse', 'mae'] },
options: ['friedman_mse', 'squared_error'] },
{ name: 'random_state', component: ['input_number'], placeholder: '123', usePair: true }
]
},
Expand Down
1 change: 1 addition & 0 deletionsvisualpython/html/m_stats/regression.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@
<label><input type="checkbox" id="normTest" class="vp-state" checked><span>Residual Normality test</span></label>
<label><input type="checkbox" id="histogram" class="vp-state" checked><span>Residual histogram</span></label>
<label><input type="checkbox" id="scatterplot" class="vp-state" checked><span>Residual scatterplot</span></label>
<label><input type="checkbox" id="rmse" class="vp-state" checked><span>RMSE</span></label>
</div>
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletionsvisualpython/js/com/com_generatorV2.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,6 +376,8 @@ define([
allowDataType: obj.var_type,
placeholder: obj.placeholder || 'Select data',
value: value,
columnSelection: obj.columnSelection || 'multiple', // single / multiple
returnFrameType: obj.returnFrameType || '', // '' / DataFrame / Series
required: obj.required === true
});
content = $(dataSelector.toTagString());
Expand DownExpand Up@@ -890,7 +892,7 @@ define([
suggestInputX.addClass('vp-input vp-state');
suggestInputX.setNormalFilter(false);
suggestInputX.setValue(defaultValue);
$(selector + '#' + columnInputId).replaceWith(function() {
$(pageThis.wrapSelector('#' + columnInputId)).replaceWith(function() {
return suggestInputX.toTagString();
});
} else {
Expand All@@ -899,7 +901,7 @@ define([
'id': columnInputId,
'class': 'vp-select vp-state'
});
$(selector + '#' + columnInputId).replaceWith(function() {
$(pageThis.wrapSelector('#' + columnInputId)).replaceWith(function() {
return $(tag);
});
}
Expand DownExpand Up@@ -955,7 +957,7 @@ define([
suggestInputX.setSuggestList(function() { return list; }); //FIXME:
suggestInputX.setNormalFilter(false);
suggestInputX.setValue(defaultValue);
$(selector + '#' + columnInputId).replaceWith(function() {
$(pageThis.wrapSelector('#' + columnInputId)).replaceWith(function() {
return suggestInputX.toTagString();
});
} else {
Expand Down
154 changes: 133 additions & 21 deletionsvisualpython/js/com/component/DataSelector.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,11 @@ define([
select: null, // callback after selection from suggestInput (value, dtype)
allowDataType: null, // list of allowed data types
dataCategory: null, // list of data category (use it for ml categories)
columnSelection: 'multiple', // single/multi : allowed column selection
returnFrameType: '', // DataFrame/Series : required data type for DataFrame -> Series/DataFrame operation
// if Series, only one column selection is allowed and returns Series
// if DataFrame, always returns DataFrame
// if Empty(=== ''), if one column selected, returns Series / others, returns DataFrame
// additional options
boxClasses: '',
classes: '',
Expand DownExpand Up@@ -87,6 +92,9 @@ define([
this.prop.dataCategory = this.prop.allowDataType;
}
}
if (this.prop.returnFrameType === 'Series') {
this.prop.columnSelection = 'single'; // only single selection allowed
}

this.state = {
filterType: 'All',
Expand All@@ -98,6 +106,7 @@ define([
slicingEnd1: '',
slicingStart2: '',
slicingEnd2: '',
singleColumn: '',
ndRowType: 'slicing',
ndColType: 'slicing',
useIndex: false,
Expand DownExpand Up@@ -409,6 +418,19 @@ define([
}
}

templateForSingleSelector() {
return `
<div>
<label><input type="checkbox" id="useIndex" class="vp-state" ${this.state.useIndex===true?'checked':''}/> <span>Use Index</span></label>
<div class="vp-ds-df-singleselector" ${this.state.useIndex===true?'style="display:none;"':''}>
<label class="w50">Column</label>
<select id="singleColumn" class="vp-select vp-state w150">
</select>
</div>
</div>
`
}

templateForMultiSelector() {
return `
<div class="vp-ds-df-option-box">
Expand DownExpand Up@@ -599,22 +621,93 @@ define([

switch (dataType) {
case 'DataFrame':
// render option page
$(this.wrapSelector('.vp-ds-option-inner-box')).html(this.templateForMultiSelector());
// column selecting
this._columnSelector = new MultiSelector(this.wrapSelector('.vp-ds-df-multiselector'),
{ mode: 'columns', parent: [data], selectedList: this.state.indexing, allowAdd: true }
);

if (this.prop.columnSelection === 'single') {
// render option page
$(this.wrapSelector('.vp-ds-option-inner-box')).html(this.templateForSingleSelector());
// bind column source
// com_generator.vp_bindColumnSource(this, 'data', ['singleColumn'], 'select', false, false);
// vp_bindColumnSource(pageThis, targetId, columnInputIdList, tagType="input", columnWithEmpty=false, columnWithIndex=false)
const columnInputIdList = ['singleColumn'];
if (data === '') {
// reset with no source
columnInputIdList && columnInputIdList.forEach(columnInputId => {
let defaultValue = that.state[columnInputId];
if (defaultValue === null || defaultValue === undefined) {
defaultValue = '';
}
// option tags
var tag = $('<select></select>').attr({
'id': columnInputId,
'class': 'vp-select vp-state'
});
$(that.wrapSelector('#' + columnInputId)).replaceWith(function() {
return $(tag);
});
});
return ;
}
// get result and show on detail box
vpKernel.getColumnList(data).then(function(resultObj) {
try {
let { result, type, msg } = resultObj;
var { list } = JSON.parse(result);

// columns using suggestInput
columnInputIdList && columnInputIdList.forEach((columnInputId, idx) => {
let defaultValue = that.state[columnInputId];
if (defaultValue === null || defaultValue === undefined) {
defaultValue = '';
}
// create tag
var tag = $('<select></select>').attr({
'id': columnInputId,
'class': 'vp-select vp-state w150'
});
// make tag
list.forEach((listVar, idx) => {
var option = document.createElement('option');
$(option).attr({
'value':listVar.value,
'text':listVar.label,
'data-type':listVar.dtype
});
// cell metadata test : defaultValue as selected
if (listVar.value === defaultValue) {
$(option).prop('selected', true);
}
option.append(document.createTextNode(listVar.label));
$(tag).append(option);
});
$(that.wrapSelector('#' + columnInputId)).replaceWith(function() {
return $(tag);
});
$(that.wrapSelector('#' + columnInputId)).trigger('change');
}).catch(function(err) {
vpLog.display(VP_LOG_TYPE.ERROR, 'com_generator - bindColumnSource error ', err)
});
} catch (e) {
vpLog.display(VP_LOG_TYPE.ERROR, 'com_generator - bindColumnSource: not supported data type. ', e);
}
});
} else {
// render option page
$(this.wrapSelector('.vp-ds-option-inner-box')).html(this.templateForMultiSelector());
this._columnSelector = new MultiSelector(this.wrapSelector('.vp-ds-df-multiselector'),
{ mode: 'columns', parent: [data], selectedList: this.state.indexing, allowAdd: true }
);
}
// bind event
$(this.wrapSelector('#useIndex')).on('change', function() {
let checked = $(this).prop('checked');
that.state.useIndex = checked;
if (checked === true) {
$(that.wrapSelector('.vp-ds-df-multiselector')).hide();
$(that.wrapSelector('.vp-ds-df-singleselector')).hide();
$(that.wrapSelector('.vp-ds-df-index-box')).show();
} else {
$(that.wrapSelector('.vp-ds-df-multiselector')).show();
$(that.wrapSelector('.vp-ds-df-singleselector')).show();
$(that.wrapSelector('.vp-ds-df-index-box')).hide();
}
});
Expand DownExpand Up@@ -728,6 +821,7 @@ define([
let {
data, dataType,
useIndex,
singleColumn,
slicingStart1, slicingEnd1,
slicingStart2, slicingEnd2,
ndRowType, ndColType
Expand All@@ -742,21 +836,39 @@ define([
code.append('.index');
} else {
// use column selector
if (this._columnSelector != null) {
let result = this._columnSelector.getDataList();
this.state.indexing = result.map(obj => obj.code); // save state
let columnList = [];
result && result.forEach(obj => {
columnList.push(obj.code);
});
if (columnList.length > 0) {
if (columnList.length == 1) {
// return as Series
code.appendFormat('[{0}]', columnList.join(', '));
// change datatype to Series
this.state.returnDataType = 'Series';
} else {
code.appendFormat('[[{0}]]', columnList.join(', '));
if (this.prop.columnSelection === 'single') {
// single selector
if (this.prop.returnFrameType === 'DataFrame') {
// return as DataFrame
code.appendFormat('[[{0}]]', singleColumn);
} else {
// return as Series
code.appendFormat('[{0}]', singleColumn);
this.state.returnDataType = 'Series';
}
} else {
// multiple selector
if (this._columnSelector != null) {
let result = this._columnSelector.getDataList();
this.state.indexing = result.map(obj => obj.code); // save state
let columnList = [];
result && result.forEach(obj => {
columnList.push(obj.code);
});
if (columnList.length > 0) {
if (columnList.length == 1) {
if (this.prop.returnFrameType === 'DataFrame') {
// return as DataFrame
code.appendFormat('[[{0}]]', columnList.join(', '));
} else {
// return as Series
code.appendFormat('[{0}]', columnList.join(', '));
// change datatype to Series
this.state.returnDataType = 'Series';
}
} else {
code.appendFormat('[[{0}]]', columnList.join(', '));
}
}
}
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp