📄 gaussnewtonpanel.java
字号:
/* * $RCSfile: GaussNewtonPanel.java,v $ * $Revision: 1.3 $ * $Date: 2005/02/24 21:20:29 $ * * NeuralNetworkToolkit * Copyright (C) 2004 Universidade de Brasília * * This file is part of NeuralNetworkToolkit. * * NeuralNetworkToolkit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * NeuralNetworkToolkit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NeuralNetworkToolkit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 - USA. */package neuralnetworktoolkit.gui.options.method;import java.awt.BorderLayout;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.util.ResourceBundle;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JSpinner;import javax.swing.SpinnerNumberModel;import javax.swing.border.TitledBorder;import neuralnetworktoolkit.methods.TrainingParameters;import neuralnetworktoolkit.methods.gradientbased.quasinewton.QuasiNewton;import neuralnetworktoolkit.methods.gradientbased.quasinewton.gaussnewton.GaussNewtonParameters;/** * * * @version $Revision: 1.3 $ - $Date: 2005/02/24 21:20:29 $ * * @author <a href="mailto:rodbra@pop.com.br">Rodrigo C. M. Coimbra</a> * @author <a href="mailto:hugoiver@yahoo.com.br">Hugo Iver V. Gonçalves</a> */public class GaussNewtonPanel extends TrainingMethodPanel { private JLabel maxIterationsLabel; private JLabel errorLabel; private JSpinner maxIterationsSpinner; private JSpinner errorSpinner; private SpinnerNumberModel maxIterationsSpinnerModel; private SpinnerNumberModel errorSpinnerModel; private JPanel maxIterationsPanel; private JPanel errorPanel; private JPanel stopConditionPanel; protected Insets borderInsets; private ResourceBundle resource; /** * * */ public GaussNewtonPanel() { resource = ResourceBundle .getBundle("neuralnetworktoolkit.gui.options.method.resources.GaussNewtonPanelResource"); borderInsets = new Insets(5, 5, 5, 5); maxIterationsLabel = new JLabel(resource.getString("maxIterations")); maxIterationsSpinnerModel = new SpinnerNumberModel(400, 1, QuasiNewton.MAX_ITERATIONS, 1); maxIterationsSpinner = new JSpinner(maxIterationsSpinnerModel); maxIterationsPanel = new JPanel(); maxIterationsPanel.setLayout(new BorderLayout()); maxIterationsPanel.add(maxIterationsLabel, BorderLayout.NORTH); maxIterationsPanel.add(maxIterationsSpinner, BorderLayout.CENTER); errorLabel = new JLabel(resource.getString("error")); errorSpinnerModel = new SpinnerNumberModel(0.001, 0, 1, 0.001); errorSpinner = new JSpinner(errorSpinnerModel); errorPanel = new JPanel(); errorPanel.setLayout(new BorderLayout()); errorPanel.add(errorLabel, BorderLayout.NORTH); errorPanel.add(errorSpinner, BorderLayout.CENTER); stopConditionPanel = new JPanel(); stopConditionPanel.setLayout(new GridBagLayout()); stopConditionPanel.add(maxIterationsPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, borderInsets, 67, 0)); stopConditionPanel.add(errorPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, borderInsets, 67, 0)); stopConditionPanel.setBorder(new TitledBorder(resource.getString("stopCondition"))); this.setLayout(new GridBagLayout()); this.add(stopConditionPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, borderInsets, 67, 0)); } //GaussNewtonPanel() /* * @see neuralnetworktoolkit.gui.options.method.TrainingMethodPanel#initializeComponents(boolean) */ public void initializeComponents(boolean verify) { GaussNewtonParameters gnParameters; if(verify) { gnParameters = (GaussNewtonParameters) parameters; errorSpinner.setValue(new Double(gnParameters.getError())); maxIterationsSpinner.setValue(new Integer(gnParameters.getMaxIterations())); } } //initializeComponents() /** * @return Returns the parameters. */ public TrainingParameters getParameters() { GaussNewtonParameters gnParameters; gnParameters = (GaussNewtonParameters) parameters; gnParameters.setError(((Double)errorSpinner.getValue()).doubleValue()); gnParameters.setMaxIterations(((Integer)maxIterationsSpinner.getValue()).intValue()); return gnParameters; } //getParameters()} //GaussNewtonPanel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -