Help In Generating Graph From Executing Algorithm - java

I am suppose to generate graph from the results/execution of my algorithm . I have heard something about using CSV file in Excel and generating the graph. I have no idea what this CSV file is and how to do it. I googled CSV file but the answer i got was in connection with databases.
I am asking if someone can show me or point me to a tutorial where this kind of thing has been done before. For instance i have to generate a graph from a Quicksort algorithm and also generate another graph with many algorithms at the same time.
Need help please
Thanks

CSV == "comma separated values". It's a file that has one row per line, where each value is separated by a comma.
I'm not sure how this is relevant to your algorithm or generating graphs.
Since you're using Java, you can easily generate a nice looking graph using GraphViz from AT&T. I think it's a terrific tool.

Related

CMUSphinx merge multiple dictionary into single one?

Im working on cmusphinx speech to text, I need to train/add words to my dictionary, so i used lmtool and uploaded a corpus file and used the .dict and .lm file and used these as parameters for pocketsphinx and it worked. Im wondering how to add these files to default files. i.e i want to add the new words .dict and .lm files to /edu/cmu/sphinx/models/en-us/cmudict-en-us.dict and /edu/cmu/sphinx/models/en-us/en-us.lm.bin
Im not sure, if this is feasible and im wondering how to combine dictionaries into single one. I found this link but not sure how to achieve the same.
When i use the TranscriberDemo.java my wav file has different words and the output prints different. how to improve the accuracy ?
Dictionary and language model extension is covered in the following part of tutorial
http://cmusphinx.sourceforge.net/wiki/tutoriallmadvanced

Using WEKA classifier model in Java for classifying real time text

I had used the GUI to train a classifier for some sample arff files . After training I saved the obtained model .
Now that I need to use this model file in my java code to classify some text , could you please tell me how should I proceed ? I dont want to do an evaluation but would like to classify the input text given .
I had gone thru the http://weka.wikispaces.com/Serialization & http://weka.wikispaces.com/Use+Weka+in+your+Java+code .
But still couldn't find code for it .I just got an way to load a model file .But didn't get any clue on classifying text directly to classes . Any help on this regard would be helpfull .
Although the previously suggested post is very nice, I believe that the one I produced some time ago better fits your needs, as it specifically deals with text, and it is generic regarding the classifier. Please check "A Simple Text Classifier in Java with WEKA".
See here, similar tutorial by Hidalgo - Java code with slides and textual dataset. It trains a machine, loads the model and classify real time unseen textual data. Very easy to follow
https://github.com/drelhaj/MachineLearning

How should I save a dictionary database with java?

When I google "how to make a dictionary", it gives me a great measure of the explanation of "make", which is very helpful. But I need something else, so I put this question here.
I want to make a small project. I want to make a dictionary with java or android. But I don't know how should I organize the words. I have considered a JSON file, a XML file or I can also simply output all the words as ojbects into a file. Could anyone please give me some adivce?
Assuming that you want to be able to read (quickly) values from your dictionary, and maybe update values or create new values then I suggest that you store your dictionary in a Database. For a simple Java database I suggest that you use an embedded Derby Database.
see http://db.apache.org/derby/

Organizing data in java (on a mac)

I'm writing a tool to analyze stock market data. For this I download data and then save all the data corresponding to a stock as a double[][] 20*100000 array in a data.bin on my hd, I know I should put it in some database but this is simply performance wise the best method.
Now here is my problem: I need to do updates and search on the data:
Updates: I have to append new data to the end of the array as time progresses.
Search: I want to iterate over different data files to find a minimum or calculate moving averages etc.
I could do both of them by reading the whole file in and update it writing or do search in a specific area... but this is somewhat overkill since I don't need the whole data.
So my question is: Is there a library (in Java) or something similar to open/read/change parts of the binary file without having to open the whole file? Or searching through the file starting at a specific point?
RandomAccessFile allows seeking into particular position in a file and updating parts of the file or adding new data to the end without rewriting everything. See the tutorial here: http://docs.oracle.com/javase/tutorial/essential/io/rafs.html
You could try looking at Random Access Files:
Tutorial: http://docs.oracle.com/javase/tutorial/essential/io/rafs.html
API: http://docs.oracle.com/javase/6/docs/api/java/io/RandomAccessFile.html
... but you will still need to figure out the exact positions you want to read in a binary file.
You might want to consider moving to a database, maybe a small embedded one like H2 (http://www.h2database.com)

Palm Database (PDB) files in Java?

Has anybody written any classes for reading and writing Palm Database (PDB) files in Java? (I mean on a server, not on the Palm device itself.) I tried to google, but all I got were Protein Data Bank references.
I wrote a Perl program that does it using Palm::PDB.pm, but I want to turn it into a servlet for a GWT app.
The jSyncManager project at http://www.jsyncmanager.org/ is under the LGPL and includes classes to read and write PDB files -- look in jSyncManager/API/Protocol/Util/DLPDatabase.java in its source code. It looks like the core code you need from this could be isolated from the rest of the library with a little effort.
There are a few ways that you can go about this;
Easiest but slowest: Find a perl-> java bridge. This will not be quick, but it will work and it should involve the least amount of work.
Find a C++/C# implementation that you have the source to and convert it (this should be the fastest solution)
Find a Java reader ... there seems to be a few listed under google... however I do not have any experience with these.
Depending on what your intended usage is, you might look into writing a simple reader yourself. The format is pretty simple and you only need to handle a couple of simple fields to parse it.
Basically there is a header for the entire file which has a 2 byte integer at the end which specifies the number of record. So just skip your way through the bytes for all the other fields in the header and then read the last field which is the number of records in the file. Be aware that the PDB format writes integers with most significant byte first.
Following this, there will be a record header for each record, the first field of which is the actual offset into the file for the record itself. Again, be aware of the byte order.
So, now you have the offsets into the file for each record in the file, which should make it very easy to read the actual records as long as you know the format of these for the type of PDB file you are trying to read.
Wikipedia has a nice overview of the header formats.
Maybe JPilot can help? They must have a lot of Java code dealing with Palm OS data.

Categories