⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yale.java

📁 一个很好的LIBSVM的JAVA源码。对于要研究和改进SVM算法的学者。可以参考。来自数据挖掘工具YALE工具包。
💻 JAVA
字号:
/*
 *  YALE - Yet Another Learning Environment
 *  Copyright (C) 2001-2004
 *      Simon Fischer, Ralf Klinkenberg, Ingo Mierswa, 
 *          Katharina Morik, Oliver Ritthoff
 *      Artificial Intelligence Unit
 *      Computer Science Department
 *      University of Dortmund
 *      44221 Dortmund,  Germany
 *  email: yale-team@lists.sourceforge.net
 *  web:   http://yale.cs.uni-dortmund.de/
 *
 *  This program 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. 
 *
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 *  USA.
 */
package edu.udo.cs.yale;

import edu.udo.cs.yale.gui.SplashScreen;
import edu.udo.cs.yale.operator.parameter.*;
import edu.udo.cs.yale.operator.IllegalInputException;
import edu.udo.cs.yale.operator.IllegalNumberOfInnerOperatorsException;
import edu.udo.cs.yale.operator.IOContainer;
import edu.udo.cs.yale.operator.IOObject;
import edu.udo.cs.yale.operator.Operator;
import edu.udo.cs.yale.operator.OperatorChain;
import edu.udo.cs.yale.operator.SimpleOperatorChain;
import edu.udo.cs.yale.operator.OperatorException;
import edu.udo.cs.yale.operator.parameter.ParameterType;
import edu.udo.cs.yale.tools.Tools;
import edu.udo.cs.yale.tools.LogService;
import edu.udo.cs.yale.tools.ParameterService;
import edu.udo.cs.yale.tools.RandomGenerator;
import edu.udo.cs.yale.tools.ResultService;
import edu.udo.cs.yale.tools.TempFileService;
import edu.udo.cs.yale.tools.plugin.Plugin;
import edu.udo.cs.yale.tools.XMLException;

import java.io.IOException;
import java.io.File;
import java.io.Reader;
import java.io.FileReader;
import java.util.Map;
import javax.imageio.ImageIO;

/**
 *  Main program. Entry point for command line programm, GUI and wrappers.
 *  @author Simon, Ingo
 *  @version $Id: Yale.java,v 2.19 2004/08/27 11:57:30 ingomierswa Exp $
 */
public class Yale {

    public static String getVersion() {
	return Version.getVersion();
    }

    /** A set of all known system properties (starting with "yale."). Properties
     *  can be registered using {@link #registerYaleProperty(ParameterType)}. */
    private static final java.util.Set PROPERTY_TYPES = new java.util.TreeSet();

    static {
	System.setProperty("yale.version", getVersion());
	registerYaleProperty(new ParameterTypeString("yale.tools.editor", "Path to external Java editor. %f is replaced by filename and %l by the linenumber.", true));
	registerYaleProperty(new ParameterTypeString("yale.tools.sendmail.command", "Path to sendmail. Used for email notifications.", true));
	registerYaleProperty(new ParameterTypeString("yale.tools.gnuplot.command", "Path to gnuplot. Used to display results.", "/usr/bin/gnuplot"));
	registerYaleProperty(new ParameterTypeString("yale.tools.gnuplot.command", "Path to gnuplot. Used to display results.", "/usr/bin/gnuplot"));
	registerYaleProperty(new ParameterTypeBoolean("yale.logfile.format", "Use unix special characters for logfile highlighting (requires new Yale instance).", false));
    }

    public static final String LICENSE =
	"Yale version "+getVersion()+", Copyright (C) 2001-2004\n"+
	"Yale comes with ABSOLUTELY NO WARRANTY; This is free software,\n" +
	"and you are welcome to redistribute it under certain conditions;\n"+
	"see license information in the file named LICENSE.";


    private static Experiment experiment;
    private static InputHandler inputHandler = new ConsoleInputHandler();

    private static SplashScreen splashScreen;

    public static void readExperimentFile(File experimentfile) throws XMLException, IOException, InstantiationException, IllegalAccessException {
	try {
	    LogService.logMessage("Reading experiment file '" + experimentfile+"'.", LogService.STATUS);
	    if (!experimentfile.exists() || !experimentfile.canRead()) {
		LogService.logMessage("Cannot read config file '"+experimentfile+"'!", LogService.FATAL);
	    }
	    Yale.experiment = new Experiment(experimentfile);
	} catch (XMLException e) {
	    throw new XMLException(experimentfile.getName()+":"+e.getMessage());
	}
    }

    public static Experiment getExperiment() {
	return experiment;
    }

    public static void setExperiment(Experiment experiment) {
	Yale.experiment = experiment;
    }

    public static void init() throws IOException {
	ParameterService.init();
	Plugin.registerAllPlugins();
    }

    public static SplashScreen showLogo() {
	try {
	    splashScreen = new SplashScreen("YALE", getVersion(), ImageIO.read(Tools.getResource("yale_logo_java.gif")));
	    splashScreen.showSplashScreen();
	    return splashScreen;
	} catch (Exception e) { e.printStackTrace(); return null; }
    }

    public static void hideLogo() {
	try {
	    splashScreen.dispose();
	} catch (Exception e) {}
    }

    public static void splashMessage(String message) {
	if (splashScreen != null) {
	    splashScreen.setMessage(message);
	}
    }

    public static void setInputHandler(InputHandler inputHandler) {
	Yale.inputHandler = inputHandler;
    }

    public static InputHandler getInputHandler() {
	return inputHandler;
    }

    /** Returns a set of {@link ParameterType}s for the Yale system properties. */
    public static java.util.Set getYaleProperties() {
	return PROPERTY_TYPES;
    }

    public static void registerYaleProperty(ParameterType type) {
	PROPERTY_TYPES.add(type);
    }

    public static void quit(int errorcode) {
	Runtime runtime = Runtime.getRuntime();
	runtime.gc();
	runtime.runFinalization();
	System.exit(errorcode);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -