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

📄 clusterwrapper.java

📁 著名的开源仿真软件yale
💻 JAVA
字号:
/* *  YALE - Yet Another Learning Environment *  Copyright (C) 2002, 2003 *      Simon Fischer, Ralf Klinkenberg, Ingo Mierswa,  *          Katharina Morik, Oliver Ritthoff *      Artificial Intelligence Unit *      Computer Science Department *      University of Dortmund *      44221 Dortmund,  Germany *  email: yale@ls8.cs.uni-dortmund.de *  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.operator.clusterer;import edu.udo.cs.yale.operator.Operator;import edu.udo.cs.yale.operator.OperatorChain;import edu.udo.cs.yale.operator.OperatorException;import edu.udo.cs.yale.operator.IllegalInputException;import edu.udo.cs.yale.operator.FatalException;import edu.udo.cs.yale.operator.IOObject;import edu.udo.cs.yale.example.ExampleSet;import edu.udo.cs.yale.example.SplittedExampleSet;import edu.udo.cs.yale.tools.LogService;/** *  This operator splits up the input example set according to the clusters and *  applies its inner operators <var>number_of_clusters</var> time. This requires *  the example set to have a special cluster attribute which can be either *  created by a {@link Clusterer} or might be declared in the attribute description *  file that was used when the data was loaded. * *  @yale.todo Test this operator. *  @version $Id: ClusterWrapper.java,v 2.6 2003/08/07 15:10:15 fischer Exp $ */public class ClusterWrapper extends OperatorChain {    private static final Class[] INPUT_CLASSES = { ExampleSet.class };    private static final Class[] OUTPUT_CLASSES = {};    private int numberOfClusters;    public IOObject[] apply() throws OperatorException {	ExampleSet exampleSet = (ExampleSet)getInput(ExampleSet.class);	if (exampleSet == null) {	    throw new FatalException("No example set in input of '"+getName()+"'!");	}	SplittedExampleSet splitted = SplittedExampleSet.splitByAttribute(exampleSet, exampleSet.getCluster());	for (int i = 0; i < numberOfClusters; i++) {	    splitted.selectSingleSubset(i);	    setInput(getInput().copy().append(new IOObject[] { splitted }));	    super.apply();	}	return new IOObject[0];    }    /** the clustered example set */    public Class[] getInputClasses() {	return INPUT_CLASSES;    }    /** no output */    public Class[] getOutputClasses() {	return OUTPUT_CLASSES;    }    public Class[] checkIO(Class[] input) throws IllegalInputException {	for (int i = 0; i < getNumberOfOperators(); i++) {	    Operator o = getOperator(i);	    input = o.checkIO(input);	}	return OUTPUT_CLASSES;    }    /** Returns the highest possible value for the maximum number of innner operators. */    public int getMaxNumberOfInnerOperators() { return 0; }    /** Returns 0 for the minimum number of innner operators. */    public int getMinNumberOfInnerOperators() { return Integer.MAX_VALUE; }    public int getNumberOfSteps() {	return numberOfClusters*getNumberOfChildrensSteps() + 1;    }}

⌨️ 快捷键说明

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