001    /*
002     * JNI_SVM-light - A Java Native Interface for SVM-light
003     * 
004     * Copyright (C) 2005 
005     * Tom Crecelius & Martin Theobald 
006     * Max-Planck Institute for Computer Science
007     * 
008     * This program is free software; you can redistribute it and/or modify it under
009     * the terms of the GNU General Public License as published by the Free Software
010     * Foundation.
011     * 
012     * This program is distributed in the hope that it will be useful, but WITHOUT
013     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
014     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
015     * details.
016     * 
017     * You should have received a copy of the GNU General Public License along with
018     * this program; if not, write to the Free Software Foundation, Inc., 51
019     * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
020     */
021    
022    package jnisvmlight;
023    
024    /**
025     * The TrainingParameters object combines the KernelParm and LearnParam objects.
026     * 
027     * @author Tom Crecelius & Martin Theobald
028     */
029    public class TrainingParameters {
030    
031      private KernelParam m_kp;
032    
033      private LearnParam m_lp;
034    
035      /**
036       * Initializes the training parameters with the default values for the kernel
037       * and the learning parameters.
038       */
039      public TrainingParameters() {
040        this(new LearnParam(), new KernelParam());
041      }
042    
043      /**
044       * Initializes the training parameters with customized values for the kernel
045       * and the learning parameters.
046       */
047      public TrainingParameters(LearnParam lp, KernelParam kp) {
048        m_lp = lp;
049        m_kp = kp;
050      }
051    
052      public LearnParam getLearningParameters() {
053        return m_lp;
054      }
055    
056      public KernelParam getKernelParameters() {
057        return m_kp;
058      }
059    
060      public void setLearningParameters(LearnParam lp) {
061        this.m_lp = lp;
062      }
063    
064      public void setKernelParameters(KernelParam kp) {
065        this.m_kp = kp;
066      }
067    
068      public TrainingParameters(String[] argv) {
069        this();
070        m_lp.argc = argv.length;
071        if (argv.length > 1 && (argv.length % 2) == 0) {
072          m_lp.argv = argv;
073        } else {
074          System.err.println("Wrong number of arguments!");
075        }
076      }
077    }