Skip to content

Commit

Permalink
Merge pull request salan668#53 from zhangjingcode/master
Browse files Browse the repository at this point in the history
test button and feature number curve optimization
  • Loading branch information
salan668 authored Feb 15, 2020
2 parents b827179 + f2fe206 commit c3c61ec
Show file tree
Hide file tree
Showing 7 changed files with 509 additions and 219 deletions.
207 changes: 0 additions & 207 deletions FAE/FeatureAnalysis/statistcs.py

This file was deleted.

6 changes: 5 additions & 1 deletion FAE/Visualization/PlotMetricVsFeatureNumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ def DrawCurve(x, y_list, std_list=[], xlabel='', ylabel='', title='', name_list=
if len(x) < 21:
axes.set_xticks(np.linspace(1, len(x), len(x)))
else:
sub_ticks_list = list(np.arange(0, len(x)+1,len(x)/5))
sub_ticks_list = list(np.arange(0, len(x)+1, len(x)/5))
sub_ticks_list[0] = 1
sub_ticks_list.append(best_auc_feature_number)
for delete_index in [best_auc_feature_number-1, best_auc_feature_number-2,
best_auc_feature_number+1, best_auc_feature_number+2]:
if delete_index in sub_ticks_list:
sub_ticks_list.remove(delete_index)
axes.set_xticks(sorted(sub_ticks_list))

if store_path:
Expand Down
18 changes: 9 additions & 9 deletions FAEGUI/VisualizationConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, parent=None):
self.checkPlotCVValidation.stateChanged.connect(self.UpdatePlot)
self.checkPlotTrain.stateChanged.connect(self.UpdatePlot)
self.checkPlotOneSE.stateChanged.connect(self.UpdatePlot)
# self.checkPlotTest.stateChanged.connect(self.UpdatePlot)
self.checkPlotTest.stateChanged.connect(self.UpdatePlot)
#

# Update Contribution canvas
Expand Down Expand Up @@ -123,7 +123,7 @@ def ClearAll(self):
self.checkPlotCVValidation.setChecked(False)
self.checkPlotTrain.setChecked(False)
self.checkPlotOneSE.setChecked(False)
# self.checkPlotTest.setChecked(False)
self.checkPlotTest.setChecked(False)
self.radioContributionFeatureSelector.setChecked(False)
self.checkMaxFeatureNumber.setChecked(False)
self.canvasROC.getFigure().clear()
Expand Down Expand Up @@ -395,13 +395,13 @@ def UpdatePlot(self):
show_data.append(temp[tuple(index)].tolist())
show_data_std.append(auc_std[tuple(index)].tolist())
name_list.append('Train')
# if self.checkPlotTest.isChecked():
# temp = deepcopy(self._fae.GetAUCMetric()['test'])
# auc_std = deepcopy(self._fae.GetAUCstdMetric()['test'])
# if temp.size > 0:
# show_data.append(temp[tuple(index)].tolist())
# show_data_std.append(auc_std[tuple(index)].tolist())
# name_list.append('Test')
if self.checkPlotTest.isChecked():
temp = deepcopy(self._fae.GetAUCMetric()['test'])
auc_std = deepcopy(self._fae.GetAUCstdMetric()['test'])
if temp.size > 0:
show_data.append(temp[tuple(index)].tolist())
show_data_std.append(auc_std[tuple(index)].tolist())
name_list.append('Test')


if len(show_data) > 0:
Expand Down
4 changes: 4 additions & 0 deletions GUI/Visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def setupUi(self, Visualization):
self.checkPlotTrain = QtWidgets.QCheckBox(Visualization)
self.checkPlotTrain.setObjectName("checkPlotTrain")
self.horizontalLayout_4.addWidget(self.checkPlotTrain)
self.checkPlotTest = QtWidgets.QCheckBox(Visualization)
self.checkPlotTest.setObjectName("checkPlotTest")
self.horizontalLayout_4.addWidget(self.checkPlotTest)
self.checkPlotOneSE = QtWidgets.QCheckBox(Visualization)
self.checkPlotOneSE.setObjectName("checkPlotOneSE")
self.horizontalLayout_4.addWidget(self.checkPlotOneSE)
Expand Down Expand Up @@ -243,6 +246,7 @@ def retranslateUi(self, Visualization):
self.checkPlotCVTrain.setText(_translate("Visualization", "CV Train"))
self.checkPlotCVValidation.setText(_translate("Visualization", "CV Validation"))
self.checkPlotTrain.setText(_translate("Visualization", "Train"))
self.checkPlotTest.setText(_translate("Visualization", "Test"))
self.checkPlotOneSE.setText(_translate("Visualization", "1-SE"))
self.label_5.setText(_translate("Visualization", "Y-Label"))
self.label_6.setText(_translate("Visualization", "X-Label"))
Expand Down
7 changes: 7 additions & 0 deletions GUI/Visualization.ui
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkPlotTest">
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkPlotOneSE">
<property name="text">
Expand Down
4 changes: 2 additions & 2 deletions ReUseModel/TestFAEModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def TestNewData(NewDataCsv, model_folder, result_save_path=''):

new_data_container.Load(NewDataCsv)

feature_selector = FeatureSelector()
feature_selector.SelectFeatureByName(new_data_container, train_info['selected_features'], is_replace=True)
# feature_selector = FeatureSelector()
# feature_selector.SelectFeatureByName(new_data_container, train_info['selected_features'], is_replace=True)

new_data_container = train_info['normalizer'].Transform(new_data_container)

Expand Down
Loading

0 comments on commit c3c61ec

Please sign in to comment.