在Java中使用weka:产生折叠交叉验证

Java集成Weka做线性回归的例子 线性回归在数据挖掘领域应也是非常常见,即根据现有的数据集(行向量组成的矩阵),(训练)模拟出一个合适的规律(函数),来推测任何新给出的数据组合(向量)应该得到的值。具体的描述可以参见各种博客,怎么推导的看来看去一知半解,但总而言之结果也简单,就是计算得到一个“适当”的多元线性函数Y=a0+a1*x1+a2*x2+a3*x3+…+ak*xk。 阅读详情

水平有限,随便翻译,能看就行

原址:http://weka.wikispaces.com/Generating+cross-validation+folds+%28Java+approach%29

文章主要讲述了如何直接使用wekaAPI产生交叉验证训练/测试splits


使用如下变量:

Instances data =  ...;   // contains the full dataset we wann create train/test sets from
 int seed = ...;          // the seed for randomizing the data
 int folds = ...;         // the number of folds to generate, >=2

随机化数据

首先随机化你的数据

Random rand = new Random(seed);   // create seeded number generator
 randData = new Instances(data);   // create copy of original data
 randData.randomize(rand);         // randomize data with number generator

如果你的数据含有 nominal类,并且你想要使用分层交叉验证

randData.stratify(folds);


产生折叠

单步运行

接下来我们要做的事情就是创建训练和测试集

for (int n = 0; n < folds; n++) {
   Instances train = randData.trainCV(folds, n);
   Instances test = randData.testCV(folds, n);
 
   // further processing, classification, etc.
   ...
 }


备注:上面的代码由 weka.filters.supervised.instance.StratifiedRemoveFolds过滤器使用,weka.classifiers.Evaluation类和Explorer/Experimenter将会使用这个方法来得到训练集。

 Instances train = randData.trainCV(folds, n, rand);


多步运行

上面的例子演示了单步运行交叉验证,如果你想运行10次10折交叉验证使用下面的循环:

Instances data = ...;  // our dataset again, obtained from somewhere
 int runs = 10;
 for (int i = 0; i < runs; i++) {
   seed = i+1;  // every run gets a new, but defined seed value
 
   // see: randomize the data
   ...
 
   // see: generate the folds
   ...
 }

下面给出几个具体的例子

CrossValidationSingleRun.java

import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.Utils;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;

import java.util.Random;

/**
 * Performs a single run of cross-validation.
 *
 * Command-line parameters:
 * <ul>
 *    <li>-t filename - the dataset to use</li>
 *    <li>-x int - the number of folds to use</li>
 *    <li>-s int - the seed for the random number generator</li>
 *    <li>-c int - the class index, "first" and "last" are accepted as well;
 *    "last" is used by default</li>
 *    <li>-W classifier - classname and options, enclosed by double quotes; 
 *    the classifier to cross-validate</li>
 * </ul>
 *
 * Example command-line:
 * <pre>
 * java CrossValidationSingleRun -t anneal.arff -c last -x 10 -s 1 -W "weka.classifiers.trees.J48 -C 0.25"
 * </pre>
 *
 * @author FracPete (fracpete at waikato dot ac dot nz)
 */
public class CrossValidationSingleRun {

  /**
   * Performs the cross-validation. See Javadoc of class for information
   * on command-line parameters.
   *
   * @param args        the command-line parameters
   * @throws Excecption if something goes wrong
   */
  public static void main(String[] args) throws Exception {
    // loads data and set class index
    Instances data = DataSource.read(Utils.getOption("t", args));
    String clsIndex = Utils.getOption("c", args);
    if (clsIndex.length() == 0)
      clsIndex = "last";
    if (clsIndex.equals("first"))
      data.setClassIndex(0);
    else if (clsIndex.equals("last"))
      data.setClassIndex(data.numAttributes() - 1);
    else
      data.setClassIndex(Integer.parseInt(clsIndex) - 1);

    // classifier
    String[] tmpOptions;
    String classname;
    tmpOptions     = Utils.splitOptions(Utils.getOption("W", args));
    classname      = tmpOptions[0];
    tmpOptions[0]  = "";
    Classifier cls = (Classifier) Utils.forName(Classifier.class, classname, tmpOptions);

    // other options
    int seed  = Integer.parseInt(Utils.getOption("s", args));
    int folds = Integer.parseInt(Utils.getOption("x", args));

    // randomize data
    Random rand = new Random(seed);
    Instances randData = new Instances(data);
    randData.randomize(rand);
    if (randData.classAttribute().isNominal())
      randData.stratify(folds);

    // perform cross-validation
    Evaluation eval = new Evaluation(randData);
    for (int n = 0; n < folds; n++) {
      Instances train = randData.trainCV(folds, n);
      Instances test = randData.testCV(folds, n);
      // the above code is used by the StratifiedRemoveFolds filter, the
      // code below by the Explorer/Experimenter:
      // Instances train = randData.trainCV(folds, n, rand);

      // build and evaluate classifier
      Classifier clsCopy = Classifier.makeCopy(cls);
      clsCopy.buildClassifier(train);
      eval.evaluateModel(clsCopy, test);
    }

    // output evaluation
    System.out.println();
    System.out.println("=== Setup ===");
    System.out.println("Classifier: " + cls.getClass().getName() + " " + Utils.joinOptions(cls.getOptions()));
    System.out.println("Dataset: " + data.relationName());
    System.out.println("Folds: " + folds);
    System.out.println("Seed: " + seed);
    System.out.println();
    System.out.println(eval.toSummaryString("=== " + folds + "-fold Cross-validation ===", false));
  }
}


CrossValidationSingleRunVariant.java

import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.Utils;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;

import java.util.Random;

/**
 * Performs a single run of cross-validation. Outputs the Confusion matrices
 * for each single fold.
 *
 * Command-line parameters:
 * <ul>
 *    <li>-t filename - the dataset to use</li>
 *    <li>-x int - the number of folds to use</li>
 *    <li>-s int - the seed for the random number generator</li>
 *    <li>-c int - the class index, "first" and "last" are accepted as well;
 *    "last" is used by default</li>
 *    <li>-W classifier - classname and options, enclosed by double quotes; 
 *    the classifier to cross-validate</li>
 * </ul>
 *
 * Example command-line:
 * <pre>
 * java CrossValidationSingleRun -t anneal.arff -c last -x 10 -s 1 -W "weka.classifiers.trees.J48 -C 0.25"
 * </pre>
 *
 * @author FracPete (fracpete at waikato dot ac dot nz)
 */
public class CrossValidationSingleRunVariant {

  /**
   * Performs the cross-validation. See Javadoc of class for information
   * on command-line parameters.
   *
   * @param args        the command-line parameters
   * @throws Excecption if something goes wrong
   */
  public static void main(String[] args) throws Exception {
    // loads data and set class index
    Instances data = DataSource.read(Utils.getOption("t", args));
    String clsIndex = Utils.getOption("c", args);
    if (clsIndex.length() == 0)
      clsIndex = "last";
    if (clsIndex.equals("first"))
      data.setClassIndex(0);
    else if (clsIndex.equals("last"))
      data.setClassIndex(data.numAttributes() - 1);
    else
      data.setClassIndex(Integer.parseInt(clsIndex) - 1);

    // classifier
    String[] tmpOptions;
    String classname;
    tmpOptions     = Utils.splitOptions(Utils.getOption("W", args));
    classname      = tmpOptions[0];
    tmpOptions[0]  = "";
    Classifier cls = (Classifier) Utils.forName(Classifier.class, classname, tmpOptions);

    // other options
    int seed  = Integer.parseInt(Utils.getOption("s", args));
    int folds = Integer.parseInt(Utils.getOption("x", args));

    // randomize data
    Random rand = new Random(seed);
    Instances randData = new Instances(data);
    randData.randomize(rand);
    if (randData.classAttribute().isNominal())
      randData.stratify(folds);

    // perform cross-validation
    System.out.println();
    System.out.println("=== Setup ===");
    System.out.println("Classifier: " + cls.getClass().getName() + " " + Utils.joinOptions(cls.getOptions()));
    System.out.println("Dataset: " + data.relationName());
    System.out.println("Folds: " + folds);
    System.out.println("Seed: " + seed);
    System.out.println();
    Evaluation evalAll = new Evaluation(randData);
    for (int n = 0; n < folds; n++) {
      Evaluation eval = new Evaluation(randData);
      Instances train = randData.trainCV(folds, n);
      Instances test = randData.testCV(folds, n);
      // the above code is used by the StratifiedRemoveFolds filter, the
      // code below by the Explorer/Experimenter:
      // Instances train = randData.trainCV(folds, n, rand);

      // build and evaluate classifier
      Classifier clsCopy = Classifier.makeCopy(cls);
      clsCopy.buildClassifier(train);
      eval.evaluateModel(clsCopy, test);
      evalAll.evaluateModel(clsCopy, test);

      // output evaluation
      System.out.println();
      System.out.println(eval.toMatrixString("=== Confusion matrix for fold " + (n+1) + "/" + folds + " ===\n"));
    }

    // output evaluation
    System.out.println();
    System.out.println(evalAll.toSummaryString("=== " + folds + "-fold Cross-validation ===", false));
  }
}


CrossValidationMultipleRuns.java

import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.Utils;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;

import java.util.Random;

/**
 * Performs multiple runs of cross-validation.
 *
 * Command-line parameters:
 * <ul>
 *    <li>-t filename - the dataset to use</li>
 *    <li>-x int - the number of folds to use</li>
 *    <li>-r int - the number of runs to perform</li>
 *    <li>-c int - the class index, "first" and "last" are accepted as well;
 *    "last" is used by default</li>
 *    <li>-W classifier - classname and options, enclosed by double quotes; 
 *    the classifier to cross-validate</li>
 * </ul>
 *
 * Example command-line:
 * <pre>
 * java CrossValidationMultipleRuns -t labor.arff -c last -x 10 -r 10 -W "weka.classifiers.trees.J48 -C 0.25"
 * </pre>
 *
 * @author FracPete (fracpete at waikato dot ac dot nz)
 */
public class CrossValidationMultipleRuns {

  /**
   * Performs the cross-validation. See Javadoc of class for information
   * on command-line parameters.
   *
   * @param args        the command-line parameters
   * @throws Excecption if something goes wrong
   */
  public static void main(String[] args) throws Exception {
    // loads data and set class index
    Instances data = DataSource.read(Utils.getOption("t", args));
    String clsIndex = Utils.getOption("c", args);
    if (clsIndex.length() == 0)
      clsIndex = "last";
    if (clsIndex.equals("first"))
      data.setClassIndex(0);
    else if (clsIndex.equals("last"))
      data.setClassIndex(data.numAttributes() - 1);
    else
      data.setClassIndex(Integer.parseInt(clsIndex) - 1);

    // classifier
    String[] tmpOptions;
    String classname;
    tmpOptions     = Utils.splitOptions(Utils.getOption("W", args));
    classname      = tmpOptions[0];
    tmpOptions[0]  = "";
    Classifier cls = (Classifier) Utils.forName(Classifier.class, classname, tmpOptions);

    // other options
    int runs  = Integer.parseInt(Utils.getOption("r", args));
    int folds = Integer.parseInt(Utils.getOption("x", args));

    // perform cross-validation
    for (int i = 0; i < runs; i++) {
      // randomize data
      int seed = i + 1;
      Random rand = new Random(seed);
      Instances randData = new Instances(data);
      randData.randomize(rand);
      if (randData.classAttribute().isNominal())
        randData.stratify(folds);

      Evaluation eval = new Evaluation(randData);
      for (int n = 0; n < folds; n++) {
        Instances train = randData.trainCV(folds, n);
        Instances test = randData.testCV(folds, n);
        // the above code is used by the StratifiedRemoveFolds filter, the
        // code below by the Explorer/Experimenter:
        // Instances train = randData.trainCV(folds, n, rand);

        // build and evaluate classifier
        Classifier clsCopy = Classifier.makeCopy(cls);
        clsCopy.buildClassifier(train);
        eval.evaluateModel(clsCopy, test);
      }

      // output evaluation
      System.out.println();
      System.out.println("=== Setup run " + (i+1) + " ===");
      System.out.println("Classifier: " + cls.getClass().getName() + " " + Utils.joinOptions(cls.getOptions()));
      System.out.println("Dataset: " + data.relationName());
      System.out.println("Folds: " + folds);
      System.out.println("Seed: " + seed);
      System.out.println();
      System.out.println(eval.toSummaryString("=== " + folds + "-fold Cross-validation run " + (i+1) + "===", false));
    }
  }
}

CrossValidationAddPrediction.java

import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.converters.ConverterUtils.DataSink;
import weka.core.Utils;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;
import weka.filters.Filter;
import weka.filters.supervised.attribute.AddClassification;

import java.util.Random;

/**
 * Performs a single run of cross-validation and adds the prediction on the 
 * test set to the dataset.
 *
 * Command-line parameters:
 * <ul>
 *    <li>-t filename - the dataset to use</li>
 *    <li>-o filename - the output file to store dataset with the predictions
 *    in</li>
 *    <li>-x int - the number of folds to use</li>
 *    <li>-s int - the seed for the random number generator</li>
 *    <li>-c int - the class index, "first" and "last" are accepted as well;
 *    "last" is used by default</li>
 *    <li>-W classifier - classname and options, enclosed by double quotes; 
 *    the classifier to cross-validate</li>
 * </ul>
 *
 * Example command-line:
 * <pre>
 * java CrossValidationAddPrediction -t anneal.arff -c last -o predictions.arff -x 10 -s 1 -W "weka.classifiers.trees.J48 -C 0.25"
 * </pre>
 *
 * @author FracPete (fracpete at waikato dot ac dot nz)
 */
public class CrossValidationAddPrediction {

  /**
   * Performs the cross-validation. See Javadoc of class for information
   * on command-line parameters.
   *
   * @param args        the command-line parameters
   * @throws Excecption if something goes wrong
   */
  public static void main(String[] args) throws Exception {
    // loads data and set class index
    Instances data = DataSource.read(Utils.getOption("t", args));
    String clsIndex = Utils.getOption("c", args);
    if (clsIndex.length() == 0)
      clsIndex = "last";
    if (clsIndex.equals("first"))
      data.setClassIndex(0);
    else if (clsIndex.equals("last"))
      data.setClassIndex(data.numAttributes() - 1);
    else
      data.setClassIndex(Integer.parseInt(clsIndex) - 1);

    // classifier
    String[] tmpOptions;
    String classname;
    tmpOptions     = Utils.splitOptions(Utils.getOption("W", args));
    classname      = tmpOptions[0];
    tmpOptions[0]  = "";
    Classifier cls = (Classifier) Utils.forName(Classifier.class, classname, tmpOptions);

    // other options
    int seed  = Integer.parseInt(Utils.getOption("s", args));
    int folds = Integer.parseInt(Utils.getOption("x", args));

    // randomize data
    Random rand = new Random(seed);
    Instances randData = new Instances(data);
    randData.randomize(rand);
    if (randData.classAttribute().isNominal())
      randData.stratify(folds);

    // perform cross-validation and add predictions
    Instances predictedData = null;
    Evaluation eval = new Evaluation(randData);
    for (int n = 0; n < folds; n++) {
      Instances train = randData.trainCV(folds, n);
      Instances test = randData.testCV(folds, n);
      // the above code is used by the StratifiedRemoveFolds filter, the
      // code below by the Explorer/Experimenter:
      // Instances train = randData.trainCV(folds, n, rand);

      // build and evaluate classifier
      Classifier clsCopy = Classifier.makeCopy(cls);
      clsCopy.buildClassifier(train);
      eval.evaluateModel(clsCopy, test);

      // add predictions
      AddClassification filter = new AddClassification();
      filter.setClassifier(cls);
      filter.setOutputClassification(true);
      filter.setOutputDistribution(true);
      filter.setOutputErrorFlag(true);
      filter.setInputFormat(train);
      Filter.useFilter(train, filter);  // trains the classifier
      Instances pred = Filter.useFilter(test, filter);  // perform predictions on test set
      if (predictedData == null)
        predictedData = new Instances(pred, 0);
      for (int j = 0; j < pred.numInstances(); j++)
        predictedData.add(pred.instance(j));
    }

    // output evaluation
    System.out.println();
    System.out.println("=== Setup ===");
    System.out.println("Classifier: " + cls.getClass().getName() + " " + Utils.joinOptions(cls.getOptions()));
    System.out.println("Dataset: " + data.relationName());
    System.out.println("Folds: " + folds);
    System.out.println("Seed: " + seed);
    System.out.println();
    System.out.println(eval.toSummaryString("=== " + folds + "-fold Cross-validation ===", false));

    // output "enriched" dataset
    DataSink.write(Utils.getOption("o", args), predictedData);
  }
}



ImageJ进阶:用Trainable Weka Segmentation给免疫组化阳性细胞做“人口普查” 本文详细介绍了如何利用ImageJ的Trainable Weka Segmentation插件进行免疫组化阳性细胞的精准定量分析。通过机器学习技术,该插件能够高效、准确地完成灰度值量化分析,显著提升免疫组化分析的客观性和可重复性,适用于临床研究和病理诊断。 阅读详情

相关推荐

r语言c5.0决策树算法参数,R语言:决策树ID3/C4.5/CART/C5.0算法的实现

在前文中,我们已经详细介绍了决策树算法中的ID3/C4.5/CART算法的原理,以及决策树的剪枝问题。ID3算法戳我C4.5算法戳我CART算法戳我决策树剪枝问题戳我本文将详细介绍如何用R语言实现决策树算法。算法区分要点R包ID3使用信息增益rpart包中rpart函数C4.5使用信息增益RWeka包中J48()CART使用ginirpart包中rpart函数C5.0C4.5的改进,比较适合于大规...

weixin_27134143的博客 1836

【使用分享】Java使用weka进行时间序列预测

本教程将向您展示如何使用Weka库在Java中进行基于时间序列数据的预测。我们将使用示例数据集,该数据集包含每月销售额的历史记录,并尝试预测未来12个月的销售额。

Ry1的博客 3402

基于weka的中文文本分类(java版)

本例子是用springboot完成,基于weka实现中文文本分类 , 本例子只是一个简单版,可以在简单版基础上进行扩展分词后再分类,最后达到程序帮我们分词、分类,大大提高效率、简化了人工分类的成本......

一杯咖啡半杯糖的博客 8028

java weka 聚类_数据挖掘学习02 - 使用weka的kmeans聚类分析

本文目的weka是一套使用java开发的数据挖掘工具集合,提供GUI/CLI界面和Java API使用方式。所以,在学习和解决数据挖掘问题时,可以先尝试用weka的GUI或CLI做出合适的分析,找到适当的算法,然后在将此算法集成到自己的项目中。最近在的项目中遇到了文本聚类的问题,kmeans是一种常见的聚类算法,这里先拿此算法和示例数据做一些实验,以便熟悉weka的界面操作。什么是kmeans详细...

weixin_27727467的博客 1482

Java机器学习:Weka与深度学习

1. 背景介绍 1.1 机器学习的崛起 随着大数据时代的到来,机器学习已经成为了计算机科学领域的热门话题。机器学习是一种让计算机系统通过数据学习和提高性能的方法,而无需进行明确的编程。在过去的几年里,机器学习技术在各个领域取得了显著的进展,例如自然语言处理、计算机视觉、推荐系统等。

AI天才研究院 495

Java实现对Weka算法的应用案例

Java实现对Weka算法的应用案例。Java实现对Weka算法的应用案例。Java实现对Weka算法的应用案例。

java怎么用weka_使用保存的模型通过Java代码测试数据(Weka)

我是机器学习的新手,所以在某些情况下我的理解可能是错误的 . 我正在尝试通过使用weka通过Java代码加载已保存的模型来测试数据 .Instances testingData = readArffFile(testFile);try{LibSVM cls = (LibSVM) weka.core.SerializationHelper.read(model);Evaluation eval = ...

weixin_39533052的博客 371

Blazor Session设置

微软官方封装了一些浏览器的操作,其中就有Session的操作的封装ProtectedSessionStorage 微软文档因为我们知道,依赖注入的生命周期是Singleton程序Scoped网页:刷新,url直接跳转都会重置。Transient路由C# Blazor 学习笔记(10):依赖注入但是没有一个和浏览器绑定的生命周期。即浏览器关闭才会退出。这个是后端无法获取的,因为后端根本不知道浏览器何时关闭。这个只能用浏览器自带的缓存。

qq_44695769的博客 1788

Java机器学习库(Java ML)(一、分类)

本文章翻译至Java ML技术文档classification.pdf,代码部分是参考该文档使用IDEA编写,同时加入了运行结果。 分类 本文介绍与分类相关的功能。 该文章假设您已熟悉Java ML的基础知识,如入门教程中所述(http://java-ml.sourceforge.net)。数据集下载地址:https://download.csdn.net/download/dbzzcz/1...

dbzzcz的博客 4891

深入解析SAP MM模块OBYC自动科目分配机制:从T030表到实战配置

本文深入解析SAP MM模块中OBYC自动科目分配机制,阐明其作为连接物流与财务核心桥梁的作用。文章以T030表为核心,详细拆解其字段结构与检索逻辑,并通过采购收货、生产发料等实战场景,手把手演示配置步骤与关键要点,帮助读者掌握从原理到实践的完整知识体系,实现业财无缝对接。

nft7creator的博客 358

【从零搭建到实战运行】基于PX4-1.13与XTDrone的FAST-LIVO2 Gazebo仿真全流程解析

本文详细解析了从零开始搭建基于PX4-1.13飞控、XTDrone仿真框架与Gazebo的FAST-LIVO2无人机仿真平台的全流程。内容涵盖环境配置、Livox雷达插件定制、算法部署与参数调试,旨在帮助开发者快速构建完整的激光-惯性-视觉SLAM仿真环境,并解决集成过程中的常见问题。

weixin_29218509的博客 521

Java调用weka.jar利用交叉验证方法进行分类

http://blog.sina.com.cn/s/blog_629e606f0102v44j.html

searching555的专栏 682

systrace分析 之 问题初步定位

如下surfaceflinger空缺点,上面对应的bufferTX 中有buffer,但VSYNC-SF 过来后,SurfaceFlinger却没有去取,检查测试app “android.settings”, 也没有GPU completion 时间长的问题,所以该部分可以请SurfaceFlinger的owner 进一步确认为何不取buffer。. GPU拿的是acquireFence HWC拿的是releaseFence, GPU是绘图,HWC是合成显示,这两个是互相等待的关系,

yangzex的专栏 3195

weka(评估机器学习算法性能的标准方法,交叉验证)

用不同的随机种子来运行预留法(百分比分割),这叫重复预留法 交叉验证系统性重复运行预留法,它通过减少预测误差来提高预留法的性能 分层交叉验证 重复预留法 交叉验证 只分割一次,分成10份9份用作训练数据,剩余一份作为测试数据,接着用另外9份作为训练数据,.....重复10次,每次都用分割的不同的数据作为测试数据。换句话说,数据分为10份,每份轮流做测试集,其余作为训练集,平均10次的结果(10层交叉验证)。 分层交叉验证为交叉验证变体 选择一种能确保每一部分数据都具有分类代表性的分割

dujuancao11的博客 3454

GAMIT基线解算实战:从RINEX数据准备到精度报告解读(附2024年tables更新攻略)

本文详细解析了2024年GAMIT基线解算全流程,从RINEX数据准备到精度报告解读,特别更新了tables配置攻略。涵盖工程目录设计、数据预处理、关键配置文件更新及基线解算策略优化,帮助用户掌握高精度GNSS数据处理技术,提升解算效率和结果可靠性。

weixin_42520374的博客 305

从零构建智慧农业监测终端:STM32数据采集与LoRa组网实战

本文详细介绍了如何从零构建智慧农业监测终端,涵盖STM32数据采集与LoRa组网实战。通过DHT22温湿度传感器和YL-69土壤湿度传感器实现精准环境监测,结合LoRa无线传输技术解决偏远农田信号问题。文章还分享了硬件选型、电路设计、低功耗优化及Flutter跨平台应用开发等关键技巧,助力农业智能化升级。

weixin_29172963的博客 357

java代码实现将无表头.txt文本文件转化为weka能识别.arff文件

首先,我们要有一个.txt文件,每一行中的元素个数是相同的(因为每一行中的每一个元素就代表了一种类型的属性值),文尾已奉上,读者自行下载。有的就不用下载了, 然后,,, 代码如下,具体的就不细讲了 import java.io.*; import java.util.ArrayList; /** * Created by Administrator on 2016/10/20. */

二杠青年 2505

基于stm32平台上的IC-MU磁绝对值编码器SPI通讯和码盘数据处理

基于stm32平台上的IC-MU磁绝对值编码器SPI通讯和码盘数据处理

watch361的博客 1万+

java手写识别项目(一):初识KNN算法和GUI框架搭建

这篇博客深入探索了一个基于KNN算法的手写识别项目的初步构建。作者以Java为基础,从搭建GUI界面、介绍KNN算法的Java实现示例开始,逐步展示了项目的整体结构和GUI的搭建过程。重点关注了细节问题,如继承JPanel而非JFrame、setPreferredSize()函数的运用等,并展示了鼠标事件处理以实现手绘功能。博客给出了代码示例和相关的注意事项,为读者提供了探索和学习该项目的良好起点。

weixin_73541770的博客 1176

手把手教你用键盘在Ubuntu上给Lerobot机械臂采集HIL-SERL训练数据(附完整配置文件)

本文详细介绍了在Ubuntu系统中使用键盘控制Lerobot机械臂进行HIL-SERL训练数据采集的完整流程。从环境准备、机械臂校准到键盘遥操系统配置和数据采集优化,提供了实战指南和常见问题解决方案,帮助读者高效获取高质量训练数据,推动具身智能和强化学习应用的发展。

weixin_30733003的博客 479

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

weka实战001:一篇博文简单了解weka

关于weka 的简单介绍

大数据和机器学习研究 3924

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

java weka 聚类_使用weka进行文本聚类的例子

先看上篇会容易看懂些,这篇的注释不多!import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import weka.clusterers.Clusterer;import weka.clusterers.SimpleKMeans;import weka.core.Attribute;import we...

weixin_39608748的博客 293

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

java 实例写入.arff_将实例添加到Weka中的实例

小编典典这是从邮件列表。我以前保存过如何将两个数据文件a.arff和b.arff合并到一个数据列表中?取决于您在说什么合并。您是否只想追加第二个文件(两个都具有相同的属性)还是要添加合并属性(两个都具有相同的实例数)?In the first case ("append"):java weka.core.Instances append filename1 filename2 > outpu...

weixin_35797963的博客 195

数据挖掘与机器学习:Weka Java 编程接口 API

文章目录1 环境配置2 数据模型2.1 Instances:数据集2.2 Instance:数据实例2.3 Attribute:属性类3 DataSource4 DataSink5 数据集处理5.1 创建数据集5.2 添加数据6 过滤7 分类8 聚类 1 环境配置 在 Idea 上创建 Maven Java 项目,并添加依赖: <dependency> <groupId>nz.ac.waikato.cms.weka</groupId> &l

抱朴守拙 6663

Weka一些基础内容

<br />无意间在网上看到了:http://weka.wiki.sourceforge.net/Use+Weka+in+your+Java+code,相对我写的代码,它的当然更有权威性。翻译完了,第一次翻译,术语的汉语很多不清楚。还没有校对,有什么错误请告诉我。<br />你可能要用的最常用的组件(components)是:<br />l  Instances 你的数据<br />l  Filter 对数据的预处理<br />l  Classifiers/Clusterer 被建立在预处理的数据上,分类/

Wayne's Road to Rome! 4461

WekaAPI的学习(加载数据)

Weka数据加载,由于weka是基于java的因此数据加载相对比较简单上手。

狼行千里 6635
上一篇: A*、Dijkstra、动态规划、红黑树、优先搜索、KMP
下一篇: 在Java中使用weka:创建一个ARFF文件
Bryan__
博客等级 码龄12年 2500粉丝 166原创
评论 6
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值