当前位置: 首页>>代码示例>>Java>>正文


Java MultilayerPerceptron.buildClassifier方法代码示例

本文整理汇总了Java中weka.classifiers.functions.MultilayerPerceptron.buildClassifier方法的典型用法代码示例。如果您正苦于以下问题:Java MultilayerPerceptron.buildClassifier方法的具体用法?Java MultilayerPerceptron.buildClassifier怎么用?Java MultilayerPerceptron.buildClassifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weka.classifiers.functions.MultilayerPerceptron的用法示例。


在下文中一共展示了MultilayerPerceptron.buildClassifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildClassifier

import weka.classifiers.functions.MultilayerPerceptron; //导入方法依赖的package包/类
public Classifier buildClassifier(Instances traindataset) {
    MultilayerPerceptron m = new MultilayerPerceptron();

    try {
        m.buildClassifier(traindataset);

    } catch (Exception ex) {
        Logger.getLogger(ModelGenerator.class.getName()).log(Level.SEVERE, null, ex);
    }
    return m;
}
 
开发者ID:sfahadahmed,项目名称:hungrydragon,代码行数:12,代码来源:ModelGenerator.java

示例2: trainMultilayerPerceptron

import weka.classifiers.functions.MultilayerPerceptron; //导入方法依赖的package包/类
public static void trainMultilayerPerceptron(final Instances trainingSet) throws Exception {
        // Create a classifier
        final MultilayerPerceptron tree = new MultilayerPerceptron();
        tree.buildClassifier(trainingSet);

        // Test the model
        final Evaluation eval = new Evaluation(trainingSet);
//        eval.crossValidateModel(tree, trainingSet, 10, new Random(1));
        eval.evaluateModel(tree, trainingSet);

        // Print the result à la Weka explorer:
        logger.info(eval.toSummaryString());
        logger.info(eval.toMatrixString());
        logger.info(tree.toString());
    }
 
开发者ID:cobr123,项目名称:VirtaMarketAnalyzer,代码行数:16,代码来源:RetailSalePrediction.java

示例3: wekaOutputTEST

import weka.classifiers.functions.MultilayerPerceptron; //导入方法依赖的package包/类
public static FCMWeka wekaOutputTEST() throws Exception {

		StringBuilder sb = new StringBuilder();
		sb.append("@relation level_of_satisfaction\n\n");
		sb.append("@attribute speed_public_service numeric\n");
		sb.append("@attribute accessibility numeric\n");
		sb.append("@attribute regional_Gdp numeric\n");
		sb.append("@attribute 'level of satisfaction' numeric\n\n");
		sb.append("@data\n");
		sb.append("0.6,0.2,0.6,0.2\n");
		sb.append("0.6,0.4,0.6,0.2\n");
		sb.append("0.6,0.4,0.8,0.2\n");
		sb.append("0.4,0.6,0.8,0.4\n");
		sb.append("0.8,1,1,0.8\n");
		sb.append("1,1,1,1\n");

		StringReader trainreader = new StringReader(sb.toString());
		Instances train = new Instances(trainreader);
		train.setClassIndex(train.numAttributes()-1);

		MultilayerPerceptron classifier = new MultilayerPerceptron();

		classifier.setHiddenLayers("0");
		try {
			classifier.buildClassifier(train);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		String wekaResp=classifier.toString();

		FCMWeka output=new FCMWeka();
		output.setMinimum(0);
		output.setMaximum(1);
		output.setMean(0.4f);
		output.setStdDev(.658f);
		output.setWekaString(wekaResp);
		return output;

	}
 
开发者ID:policycompass,项目名称:policycompass-fcmmanager,代码行数:42,代码来源:FCMModels.java

示例4: classifyMultiLayer

import weka.classifiers.functions.MultilayerPerceptron; //导入方法依赖的package包/类
public MultilayerPerceptron classifyMultiLayer(Instances data) throws Exception {
    MultilayerPerceptron layer = new MultilayerPerceptron();
    layer.buildClassifier(data);
    return layer;
}
 
开发者ID:andrzejtrzaska,项目名称:VoiceStressAnalysis,代码行数:6,代码来源:Classification.java

示例5: classify

import weka.classifiers.functions.MultilayerPerceptron; //导入方法依赖的package包/类
public  void classify() throws Exception {



        FileReader trainreader = new FileReader("rawData_biomedical.arff");


        Instances train = new Instances(trainreader);

        train.setClassIndex(train.numAttributes() - 1);

        double accuracy = 0 ;

            for (int i = 0; i < 10; i++) {
                MultilayerPerceptron mlp = new MultilayerPerceptron();
                mlp.setOptions(Utils.splitOptions("-L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H 4"));


                mlp.buildClassifier(train);

                Evaluation eval = new Evaluation(train);
                //evaluation.crossValidateModel(rf, trainData, numFolds, new Random(1));
                eval.crossValidateModel(mlp, train, 10, new Random(1));
                // eval.evaluateModel(mlp, train);
                System.out.println(eval.toSummaryString("\nResults\n======\n", false));
                trainreader.close();
                accuracy += eval.correlationCoefficient();

            }

        System.out.println("Avg Correlation: " + accuracy/10);

    }
 
开发者ID:gizemsogancioglu,项目名称:biosses,代码行数:34,代码来源:MultiLayerPerceptron.java

示例6: main

import weka.classifiers.functions.MultilayerPerceptron; //导入方法依赖的package包/类
public static void main(String[] args) {
    try {


        CSVLoader loader = new CSVLoader();
        loader.setSource(new File(OJOSECO_FILEPATH));



        Instances data = loader.getDataSet();

        Normalize normalize = new Normalize();
        normalize.setInputFormat(data);
        data = Filter.useFilter(data, normalize);

        data.setClassIndex(data.numAttributes() - 1);

        System.out.println(data.toSummaryString());



        data.randomize(new Random(0));

        int trainSize = Math.toIntExact(Math.round(data.numInstances() * RATIO_TEST));
        int testSize = data.numInstances() - trainSize;

        Instances train = new Instances(data, 0, trainSize);
        Instances test = new Instances(data, trainSize, testSize);



        MultilayerPerceptron mlp = new MultilayerPerceptron();
        mlp.setOptions(Utils.splitOptions("-L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H a"));
        mlp.buildClassifier(train);

        System.out.println(mlp.toString());



        Evaluation eval = new Evaluation(test);
        eval.evaluateModel(mlp, test);

        System.out.println(eval.toSummaryString());


    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
开发者ID:garciparedes,项目名称:java-examples,代码行数:51,代码来源:WekaMultiLayerPerceptron.java


注:本文中的weka.classifiers.functions.MultilayerPerceptron.buildClassifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。