当前位置: 首页>>代码示例>>Python>>正文


Python Visualizer.getFigure方法代码示例

本文整理汇总了Python中visualizer.Visualizer.getFigure方法的典型用法代码示例。如果您正苦于以下问题:Python Visualizer.getFigure方法的具体用法?Python Visualizer.getFigure怎么用?Python Visualizer.getFigure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在visualizer.Visualizer的用法示例。


在下文中一共展示了Visualizer.getFigure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Window

# 需要导入模块: from visualizer import Visualizer [as 别名]
# 或者: from visualizer.Visualizer import getFigure [as 别名]
class Window(QtGui.QDialog):
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        # visualizer
        self.vis = Visualizer(xlim=30)

        # this is the Canvas Widget that displays the `figure`
        # it takes the `figure` instance as a parameter to __init__
        self.canvas = FigureCanvas(self.vis.getFigure())

        # this is the Navigation widget
        # it takes the Canvas widget and a parent
        # self.toolbar = NavigationToolbar(self.canvas, self)

        # Form
        self.window_size_line_edit = QtGui.QLineEdit("10")
        self.window_size_line_edit.textChanged.connect(self.dnnChanged)
        self.m_line_edit = QtGui.QLineEdit("1")
        self.m_line_edit.textChanged.connect(self.dnnChanged)
        self.r_line_edit = QtGui.QLineEdit("2")
        self.r_line_edit.textChanged.connect(self.dnnChanged)
        self.hidden_layer_sizes_line_edit = QtGui.QLineEdit("10,10,10")
        self.hidden_layer_sizes_line_edit.textChanged.connect(self.dnnChanged)

        self.input_form = QtGui.QFormLayout()
        self.input_form.addRow("Window SIze:", self.window_size_line_edit)
        self.input_form.addRow("m:", self.m_line_edit)
        self.input_form.addRow("r:", self.r_line_edit)
        self.input_form.addRow("Hidden Layer Sizes:", self.hidden_layer_sizes_line_edit)

        self.pretrian_epochs_line_edit = QtGui.QLineEdit("10")
        self.pretrian_epochs_line_edit.textChanged.connect(self.updateWorker)
        self.pretrain_lr_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.pretrain_lr_slider.setRange(1, 10)
        self.pretrain_lr_slider.setValue(1)
        self.pretrain_lr_slider.valueChanged.connect(self.updateWorker)
        self.finetune_epochs_line_edit = QtGui.QLineEdit("10")
        self.finetune_epochs_line_edit.textChanged.connect(self.updateWorker)
        self.finetune_lr_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.finetune_lr_slider.setRange(1, 10)
        self.finetune_lr_slider.setValue(1)
        self.finetune_lr_slider.valueChanged.connect(self.updateWorker)

        self.learn_form = QtGui.QFormLayout()
        self.learn_form.addRow("finetune_epoch", self.finetune_epochs_line_edit)
        self.learn_form.addRow("finetune_lr", self.finetune_lr_slider)
        self.learn_form.addRow("pretrain_epoch", self.pretrian_epochs_line_edit)
        self.learn_form.addRow("pretrain_lr", self.pretrain_lr_slider)

        # A slider to control the plot delay
        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.slider.setRange(0, 99)
        self.slider.setValue(25)
        self.slider.valueChanged.connect(self.updateWorker)

        # A slider to control K
        self.k_slider = QtGui.QSlider(QtCore.Qt.Vertical)
        self.k_slider.setRange(0, 100)
        self.k_slider.setValue(0)
        self.k_slider.valueChanged.connect(self.updateWorker)
        self.n_slider = QtGui.QSlider(QtCore.Qt.Vertical)
        self.n_slider.setRange(0, 100)
        self.n_slider.setValue(0)
        self.n_slider.valueChanged.connect(self.updateWorker)

        # Just some button connected to `plot` method
        self.start_stop_button = QtGui.QPushButton("Start")
        self.start_stop_button.clicked.connect(self.start)

        # set the layout
        layout = QtGui.QGridLayout()
        # layout.addWidget(self.toolbar)
        layout.addWidget(self.canvas, 0, 0, 1, 2)
        layout.addWidget(self.k_slider, 0, 2, 1, 1)
        layout.addWidget(self.n_slider, 0, 3, 1, 1)
        layout.addLayout(self.input_form, 1, 0, 1, 1)
        layout.addLayout(self.learn_form, 1, 1, 1, 1)
        layout.addWidget(self.slider, 2, 0)
        layout.addWidget(self.start_stop_button, 2, 1)
        self.setLayout(layout)

        # setup worker
        self.need_setup = True
        self.worker = Worker(self.vis)

        # setup event dispatchers
        self.worker.started.connect(self.workerStarted)
        self.worker.updated.connect(self.updateFigure)
        self.worker.stopped.connect(self.workerStopped)

    def start(self):
        self.start_stop_button.setText("Stop")
        self.start_stop_button.setEnabled(False)

        window_size = string.atoi(self.window_size_line_edit.text())
        m = string.atoi(self.m_line_edit.text())
        r = string.atoi(self.r_line_edit.text())
        hidden_layer_sizes = self.hidden_layer_sizes_line_edit.text().split(",")
        hidden_layer_sizes = [string.atoi(n) for n in hidden_layer_sizes]
#.........这里部分代码省略.........
开发者ID:itolab-hayashi-rafik,项目名称:weather,代码行数:103,代码来源:gui.py


注:本文中的visualizer.Visualizer.getFigure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。