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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? labelpowersetclassifier.java

?? Multi-label classification 和weka集成
?? JAVA
字號:
package mulan.classifier;

/*
 *    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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

import java.util.Random;

import mulan.LabelSet;
import mulan.Transformations;
import weka.classifiers.Classifier;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.SparseInstance;
import weka.filters.Filter;
import weka.filters.unsupervised.attribute.Remove;

@SuppressWarnings("serial")
/**
 * Class that implements a label powerset classifier <p>
 *
 * @author Grigorios Tsoumakas 
 * @author Robert Friberg
 * @version $Revision: 0.02 $ 
 */
public class LabelPowersetClassifier extends AbstractMultiLabelClassifier
{
    protected Instances metadataTrain;
    protected Instances metadataTest;
    
    protected Random Rand;

    public LabelPowersetClassifier(Classifier classifier, int numLabels) throws Exception
    {
        super(numLabels);
        this.baseClassifier = makeCopy(classifier);
        Rand = new Random(1);
    }

    public int indexOfClassValue(String value)
    {
        return metadataTest.attribute(metadataTest.numAttributes()-1).indexOfValue(value);
    }

    public void buildClassifier(Instances train) throws Exception
    {
        //super.buildClassifier(train);
        if (baseClassifier == null) baseClassifier = defaultClassifier(); 
        metadataTrain = new Instances(train, 0);

        Transformations trans = new Transformations(numLabels);
        Instances newTrain = trans.LabelPowerset(train);
        
        // build classifier on new dataset
        baseClassifier.buildClassifier(newTrain);

        // keep the header of new dataset for classification
        metadataTest = new Instances(newTrain, 0);
    }

    /**
     * Remove all label attributes 
     */
    private Instances removeAllLabels(Instances train) throws Exception
    {
        //Indices of attributes to remove
        int indices[] = new int[numLabels];
        int k = 0;
        for (int j = 0; j < numLabels; j++)
        {
            indices[k] = train.numAttributes() - numLabels + j;
            k++;
        }

        Remove remove = new Remove();
        remove.setAttributeIndicesArray(indices);
        remove.setInputFormat(train);
        remove.setInvertSelection(true);
        Instances result = Filter.useFilter(train, remove);
        result.setClassIndex(result.numAttributes() - 1);
        return result;
    }

    /**
     * Extracted from makePrediction to support label subset mapping which 
     * needs access to this distribution. The distribution contains the prior
     * probabilities of all the label subsets when a probabilistic base
     * classifier is used.
     */
    protected double[] distributionFromBaseClassifier(Instance instance) throws Exception
    {
        //System.out.println("old instance:" + instance.toString());
        Instance newInstance;
        if (instance instanceof SparseInstance) 
            newInstance = (SparseInstance) instance.copy();            
        else 
            newInstance = (Instance) instance.copy();

        int numAttributes = instance.numAttributes();
        newInstance.setDataset(null);
        for (int i=0; i<numLabels-1; i++)
            newInstance.deleteAttributeAt(numAttributes-1-i);
        newInstance.setDataset(metadataTest);
        //System.out.println("new instance:" + newInstance.toString());
        
        return baseClassifier.distributionForInstance(newInstance); 		
    }

    public Prediction makePrediction(Instance instance) throws Exception {
        double predictions[];
        //double confidences[] = new double[numLabels];

        double[] distribution = distributionFromBaseClassifier(instance);

        int classIndex = RandomIndexOfMax(distribution,Rand);
        //double confidence = distribution[classIndex];

        String strClass = (metadataTest.classAttribute()).value(classIndex);
        LabelSet labels = LabelSet.fromBitString(strClass);
        predictions = labels.toDoubleArray();
        
        /* old solution
        for (int i = 0; i < numLabels; i++)
        {
                if (predictions[i] == 1) confidences[i] = confidence;
                else confidences[i] = 1-confidence;
        }
        */
        
        Prediction result = new Prediction(predictions, predictions);
        
        return result;
    }

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

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕亚洲不卡| 欧美高清视频不卡网| 久久精品一区四区| 国产麻豆91精品| 欧美国产一区视频在线观看| 国产麻豆91精品| 国产精品久久久久一区二区三区| 成人动漫视频在线| 亚洲激情中文1区| 欧美日韩国产综合一区二区三区 | 蓝色福利精品导航| 欧美成人在线直播| 福利电影一区二区三区| 亚洲视频一区在线| 欧美军同video69gay| 国产一区二区在线看| 国产精品传媒视频| 欧美日本精品一区二区三区| 久久国产精品99久久人人澡| 国产婷婷一区二区| 欧美最新大片在线看| 免费不卡在线视频| 国产精品久久午夜夜伦鲁鲁| 91国偷自产一区二区使用方法| 偷拍与自拍一区| 国产偷国产偷亚洲高清人白洁 | 日韩中文字幕区一区有砖一区| 日韩区在线观看| 成人18视频日本| 日本大胆欧美人术艺术动态| 欧美—级在线免费片| 91国内精品野花午夜精品| 蜜桃精品视频在线| 亚洲欧洲国产日韩| 日韩免费高清av| 91九色最新地址| 国产精品一区二区91| 亚洲一二三专区| 亚洲国产成人在线| 欧美一卡二卡三卡四卡| 99久久久久久99| 久久精品国产一区二区三区免费看| 国产精品久久国产精麻豆99网站| 欧美日韩高清一区二区三区| 成人久久18免费网站麻豆 | 成人精品国产免费网站| 婷婷久久综合九色国产成人| 中文无字幕一区二区三区| 91精品国产综合久久精品性色| www.欧美日韩| 国产一区二区精品久久| 婷婷综合五月天| 亚洲黄一区二区三区| 国产三级三级三级精品8ⅰ区| 欧美日韩一本到| 91理论电影在线观看| 国产成人av影院| 激情图片小说一区| 日韩 欧美一区二区三区| 亚洲四区在线观看| 国产精品麻豆视频| 久久精品日产第一区二区三区高清版| 337p亚洲精品色噜噜噜| 色呦呦国产精品| av在线播放不卡| 国产成人精品综合在线观看| 韩国av一区二区| 精品一区二区在线免费观看| 日本不卡123| 免费精品视频在线| 婷婷久久综合九色综合伊人色| 亚洲综合色丁香婷婷六月图片| 中文字幕亚洲区| 综合久久久久久| 亚洲柠檬福利资源导航| 中文字幕日韩精品一区 | 中文字幕免费不卡| 久久精品夜色噜噜亚洲a∨| 欧美精品一区二区在线观看| 欧美电视剧在线看免费| 日韩欧美一级片| 亚洲精品一区二区三区在线观看| 日韩视频一区二区三区| 日韩欧美激情四射| 精品电影一区二区三区| 久久久影院官网| 日本一区二区视频在线| 国产精品天美传媒沈樵| 18成人在线观看| 亚洲一区二区在线免费看| 亚洲电影视频在线| 天天av天天翘天天综合网色鬼国产 | 国产成人丝袜美腿| 国产91丝袜在线播放九色| 丁香另类激情小说| 91在线观看免费视频| 色综合久久99| 欧美老年两性高潮| 久久婷婷国产综合精品青草| 欧美激情在线观看视频免费| 亚洲欧美另类图片小说| 日日噜噜夜夜狠狠视频欧美人| 美日韩黄色大片| 高清不卡在线观看| 91久久精品网| 日韩一区二区免费视频| 欧美经典一区二区| 亚洲一区影音先锋| 久久国产精品99精品国产| 成人丝袜视频网| 91福利在线看| 欧美不卡在线视频| 亚洲女人小视频在线观看| 免费欧美在线视频| www.爱久久.com| 91麻豆精品国产91久久久资源速度| 精品国产免费一区二区三区四区 | 成人免费视频在线观看| 天堂午夜影视日韩欧美一区二区| 久久国产精品一区二区| 91免费观看视频在线| 欧美大白屁股肥臀xxxxxx| 专区另类欧美日韩| 另类小说视频一区二区| 91网站在线观看视频| 欧美成人一级视频| 一区二区三区四区精品在线视频| 国模冰冰炮一区二区| 色哟哟国产精品| 久久久www免费人成精品| 亚洲国产精品影院| 成人理论电影网| 欧美一区二区在线不卡| 亚洲欧美区自拍先锋| 国内久久精品视频| 欧美美女喷水视频| 自拍偷拍亚洲综合| 国产99精品国产| 精品少妇一区二区三区日产乱码| 一区二区三区高清在线| 高清久久久久久| 欧美不卡一区二区| 午夜影院在线观看欧美| 91蝌蚪国产九色| 国产欧美日韩精品一区| 看电视剧不卡顿的网站| 欧美日韩中文字幕一区| 亚洲日本一区二区三区| 国产成人啪免费观看软件| 日韩精品中文字幕一区二区三区| 亚洲狠狠爱一区二区三区| 91麻豆swag| 最新日韩在线视频| 成人精品高清在线| 国产亚洲1区2区3区| 黑人巨大精品欧美一区| 欧美一级欧美三级在线观看| 亚洲国产裸拍裸体视频在线观看乱了| av网站一区二区三区| 中文字幕av一区二区三区高| 国产精品一区二区在线观看网站| 日韩精品一区二区三区老鸭窝| 日本欧美肥老太交大片| 欧美高清视频不卡网| 丝袜国产日韩另类美女| 欧美日韩1234| 视频在线观看91| 在线成人高清不卡| 视频一区欧美日韩| 欧美一级黄色片| 美日韩一级片在线观看| 91精品国产麻豆国产自产在线| 爽好久久久欧美精品| 欧美日韩亚洲综合| 无吗不卡中文字幕| 欧美xxxxx牲另类人与| 精品一区二区三区不卡| 久久精品一二三| www.欧美日韩| 亚洲午夜精品网| 51精品久久久久久久蜜臀| 久久国产精品99精品国产| 久久男人中文字幕资源站| 粉嫩av一区二区三区粉嫩| 国产精品乱子久久久久| 一本大道av伊人久久综合| 亚洲午夜久久久久| 91精品国产综合久久久久| 精品亚洲成a人在线观看| 久久精品亚洲精品国产欧美 | 91网上在线视频| 亚洲午夜私人影院| 精品乱人伦小说| 成人白浆超碰人人人人| 亚洲综合激情网| 日韩久久久精品| 99精品久久久久久| 午夜久久电影网| 久久久精品国产免费观看同学| 91伊人久久大香线蕉|