weka

Eclipse - Setting .classpath file for existing project

风格不统一 提交于 2019-12-08 19:55:36
问题 I have a java project. The working folder from someone else's Eclipse project (It was a Repast Simphony project I think). In my eclipse I created a new Java project and told it to use the existing code. So it seems to have brought in all the code. However after loading the project I get this error: Project 'My Project' is missing required Java project: 'Weka 3-7' It has a .classpath file with these contents: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path=

Support Vector Machine on R and WEKA

回眸只為那壹抹淺笑 提交于 2019-12-08 17:35:30
My data generated strange results with svm on R from the e1071 package, so I tried to check if the R svm can generate same result as WEKA (or python), since I've been using WEKA in the past. I googled the question and found one that has the exact same confusion with me but without an answer. This is the question . So I hope that I could get an answer here. To make things easier, I'm also using the iris data set, and train a model (SMO in WEKA, and svm from R package e1071) using the whole iris data, and test on itself. WEKA parameters : weka.classifiers.functions.SMO -C 1.0 -L 0.001 -P 1.0E-12

How to calculate the nearest neighbors using weka from the command line?

风流意气都作罢 提交于 2019-12-08 16:14:24
问题 I have a csv file, where each row is a vector of numbers representing a data point. I want to use weka from the command line to calculate the nearest neighbor of each data point in the csv file. I know how to do k nearest neighbor classification from the command line, but that's not what I want. I want the actual neighbors. How do I do this? I want to do this using weka and not some other tool. 回答1: Weka doesn't have a one liner to do what I think you are suggesting (ingest a file, convert it

How To Call WekaSharp Commands From C#

浪尽此生 提交于 2019-12-08 12:59:43
问题 Thank you all for you help on my F# and C# question and am really beginning to enjoy the fruits of the learning. I have asked a question like this before and I know these are on the line of the purposes of this forum, but I think this is useful and would provide some help to all us F# data miners out there :-). I am utilizing Yin Zhu's WekaSharp for my experiments and am interested in the rates of computation between F# and C#. I have written a snippet based on his example in the F# and would

SMO,Sequential Minimal Optimization in WEKA

ⅰ亾dé卋堺 提交于 2019-12-08 08:51:27
I'm new with Weka. I want to use Sequential Minimal Optimization in WEKA. Could anyone tell me how to proceed? here is my Java code but it doesn't work: public class SVMTest { public void test(File input) throws Exception{ File tmp = new File("tmp-file-duplicate-pairs.arff"); String path = input.getParent(); //tmp.deleteOnExit(); ////removeFeatures(input,tmp,useType,useNames, useActivities, useOccupation,useFriends,useMailAndSite,useLocations); Instances data = new weka.core.converters.ConverterUtils.DataSource(tmp.getAbsolutePath()).getDataSet(); data.setClassIndex(data.numAttributes() - 1);

Save and load SMO weka model from file

蓝咒 提交于 2019-12-08 06:09:18
问题 I am using Weka SMO to classify my training data and I want to save and load easily to/from file my SMO model. I have created a save method in order to store Classifier to file. My code is the following: private static Classifier loadModel(Classifier c, String name, File path) throws Exception { FileInputStream fis = new FileInputStream("/weka_models/" + name + ".model"); ObjectInputStream ois = new ObjectInputStream(fis); return c; } private static void saveModel(Classifier c, String name,

How to merge two sets of weka Instances together

﹥>﹥吖頭↗ 提交于 2019-12-08 01:54:22
问题 Currently, I'm copying one instance at a time from one dataset to the other. Is there a way to do this so that string mappings remain intact? The mergeInstances works horizontally, is there an equivalent vertical merge? This is one step of a loop I use to read datasets of the same structure from multiple arff files into one large dataset. There has got to be a simpler way. Instances iNew = new ConverterUtils.DataSource(name).getDataSet(); for (int i = 0; i < iNew.numInstances(); i++) {

Using a arff file for storing data

痞子三分冷 提交于 2019-12-08 01:10:35
问题 I am using this example to create my .arff file for my weka projext enter link description here. double[][] data = {{4058.0, 4059.0, 4060.0, 214.0, 1710.0, 2452.0, 2473.0, 2474.0, 2475.0, 2476.0, 2477.0, 2478.0, 2688.0, 2905.0, 2906.0, 2907.0, 2908.0, 2909.0, 2950.0, 2969.0, 2970.0, 3202.0, 3342.0, 3900.0, 4007.0, 4052.0, 4058.0, 4059.0, 4060.0}, {19.0, 20.0, 21.0, 31.0, 103.0, 136.0, 141.0, 142.0, 143.0, 144.0, 145.0, 146.0, 212.0, 243.0, 244.0, 245.0, 246.0, 247.0, 261.0, 270.0, 271.0, 294

How to use date type in weka in java code?

淺唱寂寞╮ 提交于 2019-12-07 18:06:49
问题 I am trying to create training instances with one date attribute and one numeric attribute. I get error because of my date value. The error is: java.lang.IllegalArgumentException: Attribute neither nominal nor string! I guess I do not understand how to deal with this format. I have searched for it a lot but all of the examples are about using it in arff file and I couldn't find any example for java code. I will be so thankful if you could tell where I am going wrong or send me some links

weka: how to get class name from testing single instance

走远了吗. 提交于 2019-12-07 15:22:09
问题 i want to make a single test for single instance i use j48 in FilteredClassifier like this: Remove rm = new Remove(); rm.setAttributeIndices("1"); // remove 1st attribute // classifier J48 j48 = new J48(); j48.setUnpruned(true); // using an unpruned J48 // meta-classifier FilteredClassifier fc_J48 = new FilteredClassifier(); fc_J48.setFilter(rm); fc_J48.setClassifier(j48); tdta.dataSet.setClassIndex(tdta.dataSet.numAttributes() - 1); fc_J48.buildClassifier(tdta.dataSet); now, i try those