亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? flattentruelabelsclassifier.java

?? Multi-label classification 和weka集成
?? JAVA
字號(hào):
package mulan.classifier;
import weka.classifiers.Classifier;
import weka.core.Attribute;
import weka.core.FastVector;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.SparseInstance;

@SuppressWarnings("serial")
/**
 * A multilabel classifier based on Problem Transformation 5.
 * The multiple label attributes are mapped to a single multi class
 * attribute. 
 */
public class FlattenTrueLabelsClassifier extends AbstractMultiLabelClassifier implements
		MultiLabelClassifier
{

	public static final String versionId = "$Id: 2007-02-21 02:55:46 +0100 (on, 21 feb 2007) $"; 
	
	
	/**
	 * The encapsulated distribution classifier.
	 */
	protected Classifier classifier;
	
	
	/**
	 * A dataset with the format needed by the base classifier.
	 * It is potentially expensive copying datasets with many attributes,
	 * so it is used for building the classifier and then it's instances
	 * are discarded and it is reused during prediction.
	 */
	protected Instances transformed;

	
	/**
	 * Default constructor needed to allow instantiation 
	 * by reflection. If this constructor is used call setNumLabels()
	 * and setBaseClassifier(Classifier) before building the classifier
	 * or exceptions will hail.
	 */
	public FlattenTrueLabelsClassifier()
	{
	}
	
	public FlattenTrueLabelsClassifier(Classifier classifier, int numLabels)
	{
		super(numLabels);
		this.classifier = classifier;
	}
	
	public void buildClassifier(Instances instances) throws Exception
	{
		super.buildClassifier(instances);
		
		if (classifier == null) 
			classifier = forName("weka.classifiers.bayes.NaiveBayes", null);
		
		//Do the transformation 
		//and generate the classifier
		transformed = determineOutputFormat(instances); 
		transform(instances, transformed);
		classifier.buildClassifier(transformed);
		
		//We dont need the data anymore, just the metadata.
		//Asserts that the classifier has copied anything
		//it needs.
		transformed.delete();
	}
	

	/**
	 * 
	 * @param source
	 * @param dest
	 * @throws Exception
	 */
	protected void transform(Instances source, Instances dest) throws Exception
	{
		for (int i = 0; i < source.numInstances(); i++)
	    {
			//Convert a single instance to multiple ones
			Instance instance = source.instance(i);
			transformAndAppendMultiple(instance, dest);
	    }
	}
	
	/**
	 * Derives the transformed format suitable for the underlying classifier 
	 * from the input and the number of label attributes.
	 * @param input
	 * @return An empty Instances object with the new format
	 * @throws Exception
	 */
	protected Instances determineOutputFormat(Instances input) throws Exception 
	{
		//Get names of all class attributes
		FastVector classValues = new FastVector(numLabels);
		int startIndex = input.numAttributes() - numLabels; 
		for(int i = startIndex; i < input.numAttributes(); i++)
			classValues.addElement(input.attribute(i).name());
		
		//remove numClasses attributes from the end
		Instances outputFormat = new Instances(input, 0);
		for(int i = 0; i < numLabels; i++)
			outputFormat.deleteAttributeAt(outputFormat.numAttributes() - 1);
		
		//create and append the nominal class attribute
		Attribute classAttribute = new Attribute("Class", classValues);
		outputFormat.insertAttributeAt(classAttribute, outputFormat.numAttributes());
		outputFormat.setClassIndex(outputFormat.numAttributes() - 1);
		return outputFormat;
	}
	

	/**
	 * Each input instance will yield one output instance for each label.
	 * Transform a single input instance into 0 or more 
	 * output instances.
	 * 
	 * @param instance
	 * @param out Actually a reference to the member variable transformed.
	 */
	private void transformAndAppendMultiple(Instance instance, Instances out)
	{
		//Grab a reference to the input dataset 
		Instances in  = instance.dataset();
		
		//The prototype instance is used to make copies, one per label.
		Instance prototype = transform(instance);
	
		//At this point we have an instance with a missing last class value
	    //Now we iterate over the incoming instances multiple labels
	    //and output one instance for every label with a value of 1.
		//TODO: This asserts that label attribute is binary nominal with values {0,1}
		for(int i = in.numAttributes() - numLabels; i < in.numAttributes(); i++)
		{
			if (instance.value(i) == 0 || instance.value(i) == Instance.missingValue() ) continue;
			Instance copy = (Instance) prototype.copy();
			copy.setDataset(out);
			copy.setClassValue(instance.attribute(i).name());
			out.add(copy);
		}
	}
	
	/**
	 * Transform a single instance to match the format of the base
	 * classifier by copying all predictors to a new instance.
	 * @param instance
	 * @return a transformed copy of the passed instance
	 */
	private Instance transform(Instance instance)
	{
		
		//TODO: It might be faster to copy the entire instance and 
		//      then remove the trailing label attributes.		
		
		//Make room for all predictors and an additional class attribute
		double [] vals = new double[transformed.numAttributes()];

		//Copy all predictors		
		for (int i = 0; i < transformed.numAttributes() - 1; i++)
			vals[i] = instance.value(i);

		//If class value is 0 it will not be included in the sparse
		//instance and validation will fail. 
		vals[transformed.numAttributes()-1] = 42;
		
		Instance result = (instance instanceof SparseInstance)
		? new SparseInstance(instance.weight(), vals)
		: new Instance(instance.weight(), vals);
		
		result.setDataset(transformed);
		return result;
	}
	
	protected Prediction makePrediction(Instance instance) throws Exception
	{
		instance = transform(instance);
		double[] confidences = classifier.distributionForInstance(instance);
		return new Prediction(labelsFromConfidences(confidences), confidences);
	}

    public String getRevision() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看日韩国产| 久久久午夜精品| 制服丝袜亚洲播放| 懂色一区二区三区免费观看| 亚洲综合久久久| 日本一区二区成人在线| 欧美一级xxx| 一本久久精品一区二区| 激情欧美一区二区三区在线观看| 亚洲视频在线观看一区| 久久久欧美精品sm网站| 欧美日韩一区二区在线视频| 9久草视频在线视频精品| 精品中文字幕一区二区| 亚洲第一激情av| 亚洲天堂网中文字| 亚洲国产成人在线| xnxx国产精品| 欧美一级黄色片| 欧美日韩国产首页在线观看| 99精品视频中文字幕| 国产盗摄女厕一区二区三区| 美女视频黄a大片欧美| 亚洲一区二区三区四区中文字幕| 国产精品理论片| 久久久久久97三级| 欧美mv和日韩mv的网站| 欧美精品高清视频| 欧美午夜一区二区| 91久久国产最好的精华液| av成人免费在线观看| 高清在线成人网| 国产精品综合av一区二区国产馆| 麻豆精品在线视频| 美女一区二区三区在线观看| 三级成人在线视频| 丝袜诱惑亚洲看片| 香港成人在线视频| 亚洲午夜一二三区视频| 亚洲最新在线观看| 亚洲黄色av一区| 一区二区三区国产豹纹内裤在线| 亚洲欧美色综合| 亚洲综合色网站| 亚洲成av人影院| 日本欧美在线观看| 蜜桃av噜噜一区二区三区小说| 天堂在线亚洲视频| 美女一区二区三区在线观看| 久久精品国产99国产| 国产自产高清不卡| 国产成人在线视频免费播放| 成人听书哪个软件好| av在线这里只有精品| 91浏览器在线视频| 欧美性色aⅴ视频一区日韩精品| 精品视频在线看| 欧美电影免费观看高清完整版在线| 欧美一级一区二区| 久久久蜜桃精品| 国产精品久久久久久久久免费相片| 中文字幕字幕中文在线中不卡视频| 亚洲色欲色欲www在线观看| 亚洲一区二区免费视频| 日韩高清一级片| 国产在线精品一区在线观看麻豆| 国产成a人亚洲精| 色中色一区二区| 欧美一区二区三区在| 久久精品视频免费观看| 中文字幕亚洲在| 无吗不卡中文字幕| 国产一区二区三区| 色综合久久综合网欧美综合网| 欧美性受xxxx| 久久久99精品免费观看| 一区二区三区久久| 久久精品国产久精国产爱| 成人精品鲁一区一区二区| 欧美性高清videossexo| 精品福利一二区| 1区2区3区欧美| 蜜桃久久精品一区二区| eeuss鲁片一区二区三区| 欧美日本韩国一区二区三区视频 | 色综合激情五月| 91精品国产色综合久久ai换脸| 久久综合色综合88| 亚洲一区二区在线免费观看视频| 久久国产成人午夜av影院| 色偷偷久久人人79超碰人人澡 | 欧美亚洲另类激情小说| 精品乱码亚洲一区二区不卡| 亚洲女与黑人做爰| 精一区二区三区| 欧美三级中文字幕| 国产欧美精品在线观看| 婷婷成人综合网| 97精品视频在线观看自产线路二| 欧美一区二区三区四区视频 | 久久机这里只有精品| youjizz国产精品| 亚洲精品一线二线三线无人区| 亚洲欧洲综合另类| 国产成人亚洲综合a∨婷婷| 欧美日韩国产乱码电影| 亚洲日本丝袜连裤袜办公室| 精品亚洲欧美一区| 欧美日韩激情在线| 国产精品美女久久久久高潮| 久久99精品视频| 欧美久久久久久蜜桃| 亚洲欧美日韩久久精品| 国产精选一区二区三区| 欧美一级片在线看| 亚洲午夜激情av| 色综合久久中文综合久久97| 亚洲国产精品激情在线观看| 久久91精品国产91久久小草| 欧美日韩国产小视频| 亚洲图片一区二区| 色综合视频一区二区三区高清| 欧美激情在线看| 国产不卡在线视频| 久久久久久亚洲综合影院红桃| 日韩av在线发布| 正在播放亚洲一区| 午夜视频一区二区三区| 欧美日韩国产综合视频在线观看| 一区二区三区四区五区视频在线观看| 懂色av噜噜一区二区三区av| 国产拍欧美日韩视频二区| 国产麻豆一精品一av一免费 | 国产精品 欧美精品| 久久综合久久综合久久综合| 美女视频免费一区| 精品日产卡一卡二卡麻豆| 蜜桃久久久久久久| 日韩女优电影在线观看| 麻豆91免费观看| 久久久亚洲国产美女国产盗摄 | 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美日韩高清一区二区三区| 午夜日韩在线电影| 日韩欧美在线一区二区三区| 麻豆免费精品视频| 日韩精品一区二区三区在线播放 | 亚洲特级片在线| 一本一道综合狠狠老| 一区二区高清在线| 91.xcao| 麻豆国产欧美日韩综合精品二区| 精品国产乱码久久久久久久久| 国产一区二区三区精品欧美日韩一区二区三区 | 91精品福利视频| 五月婷婷综合在线| 欧美一级生活片| 国产乱人伦精品一区二区在线观看| 久久精品亚洲麻豆av一区二区| 国产成人亚洲综合色影视| 亚洲欧美一区二区视频| 在线看国产一区二区| 日韩av电影一区| 国产人伦精品一区二区| 99v久久综合狠狠综合久久| 亚洲国产精品久久一线不卡| 日韩一区二区三区在线| 国产精品一区二区果冻传媒| 成人欧美一区二区三区在线播放| 欧美图区在线视频| 欧美aaaaa成人免费观看视频| 国产片一区二区| 欧美日韩综合在线| 国产一区二区三区在线看麻豆| 国产精品久久福利| 91麻豆精品国产综合久久久久久 | 中文一区二区在线观看| 在线免费观看视频一区| 久久99久久精品欧美| 亚洲视频一二区| 精品久久五月天| 日本高清不卡一区| 国内成人自拍视频| 亚洲一级电影视频| 国产亚洲短视频| 欧美精三区欧美精三区| 成人激情黄色小说| 日韩国产精品久久久久久亚洲| 亚洲国产精品传媒在线观看| 8x8x8国产精品| 91丨porny丨首页| 久久99热这里只有精品| 亚洲精品成人a在线观看| 偷偷要91色婷婷| 最新久久zyz资源站| 精品剧情在线观看| 欧美日韩黄色影视| 91免费版在线看| 国产成人精品影院| 免费一区二区视频|