MusicClassificationExperiment
Created: 2013-06-20 10:35:24
Performs a scientific experiment of classifying music into genres
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (1)
MusicClassificationExperiment |
Descriptions (1)
Performs a scientific experiment of classifying music into genres |
Dependencies (2)
somtoolbox_full.jar |
weka-3.6.6.jar |
Inputs (3)
Name |
Description |
MP3URL |
The URL from where to fetch the MP3s
|
WebServiceAuthenticationVoucher |
Voucher for authentication towards the web service
|
GroundTruthURL |
Location of the groundtruth
|
Processors (11)
Name |
Type |
Description |
fetchMP3FileListingDocument |
localworker |
Scriptif ((url == void) || (url == null)) {
throw new RuntimeException("The url must be specified");
}
URL inputURL = null;
if (base != void) {
inputURL = new URL(new URL(base), url);
}
else {
inputURL = new URL(url);
}
URLConnection con = inputURL.openConnection();
InputStream in = con.getInputStream();
StringBuffer result = new StringBuffer();
BufferedReader reader;
String encoding = con.getContentEncoding();
if (encoding == null) {
reader = new BufferedReader(new InputStreamReader(in));
} else {
reader = new BufferedReader(new InputStreamReader(in, encoding));
}
String line = null;
String NEWLINE = System.getProperty("line.separator");
while ((line = reader.readLine()) != null) {
result.append(line);
result.append(NEWLINE);
}
reader.close();
contents = result.toString();
|
extractMP3FileNamesFromHTMLDocument |
localworker |
|
fetchMP3FromURL |
localworker |
ScriptURL inputURL = new URL(new URL(baseUrl), mp3Name);
int bytesRead = 0;
int totalBytesRead = 0;
InputStream is = inputURL.openStream();
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buffer = new byte[2048];
while (true) {
bytesRead = is.read(buffer);
if (bytesRead == -1) {
break;
}
os.write(buffer, 0, bytesRead);
}
mp3ByteArray = os.toByteArray();
is.close();
os.close();
|
fetchGroundTruthDocument |
localworker |
Scriptif ((url == void) || (url == null)) {
throw new RuntimeException("The url must be specified");
}
URL inputURL = null;
if (base != void) {
inputURL = new URL(new URL(base), url);
}
else {
inputURL = new URL(url);
}
URLConnection con = inputURL.openConnection();
InputStream in = con.getInputStream();
StringBuffer result = new StringBuffer();
BufferedReader reader;
String encoding = con.getContentEncoding();
if (encoding == null) {
reader = new BufferedReader(new InputStreamReader(in));
} else {
reader = new BufferedReader(new InputStreamReader(in, encoding));
}
String line = null;
String NEWLINE = System.getProperty("line.separator");
while ((line = reader.readLine()) != null) {
result.append(line);
result.append(NEWLINE);
}
reader.close();
contents = result.toString();
|
mergeToSingleVector |
beanshell |
ScriptsomLibVector = "$TYPE vec\n";
somLibVector += "$XDIM " + featureVector.size() + "\n";
somLibVector += "$YDIM 1\n";
somLibVector += "$VEC_DIM 60\n";
for (int i=0; i |
convertSomlibToARFFFormat |
beanshell |
Scriptimport java.io.File;
import at.tuwien.ifs.somtoolbox.data.SOMLibSparseInputData;
import at.tuwien.ifs.somtoolbox.data.SOMLibClassInformation;
import at.tuwien.ifs.somtoolbox.data.InputDataWriter;
SOMLibSparseInputData data = SOMLibSparseInputData.parse(somLibVector);
SOMLibClassInformation classInfo = SOMLibClassInformation.parse(somLibClassInfo);
data.setClassInfo(classInfo);
arff = InputDataWriter.getAsWekaARFF(data, false, false, "musicFeatures").toString();
|
doClassify |
beanshell |
Scriptimport java.io.StringReader;
import java.util.Random;
import weka.classifiers.Evaluation;
import weka.classifiers.functions.SMO;
import weka.core.Instances;
import weka.core.Range;
Instances data = new Instances(new StringReader(arff));
data.setClass(data.attribute("class"));
SMO classifier = new SMO();
int splitPercentage = 66;
int trainSize = data.numInstances() * splitPercentage / 100;
int testSize = data.numInstances() - trainSize;
data.randomize(new Random(7));
Instances train = new Instances(data, 0, trainSize);
Instances test = new Instances(data, trainSize, testSize);
classifier.buildClassifier(train);
Evaluation eval = new Evaluation(data);
StringBuffer stringBuffer = new StringBuffer();
eval.evaluateModel(classifier, test, new Object[] {stringBuffer, new Range("1"), false});
accuracy=(1 - eval.errorRate()) * 100;
detailedResults=stringBuffer.toString();
|
encodeBase64 |
localworker |
Scriptimport org.apache.commons.codec.binary.Base64;
base64 = new String(Base64.encodeBase64(bytes)); |
extractRHSOMLib_input |
xmlsplitter |
|
extractRHSOMLib_output |
xmlsplitter |
|
extractRHSOMLib |
wsdl |
Wsdlhttp://localhost:8080/fex/featureExtraction?wsdlWsdl OperationextractRHSOMLib |
Beanshells (3)
Name |
Description |
Inputs |
Outputs |
mergeToSingleVector |
|
featureVector
featureVectorLabel
|
somLibVector
|
convertSomlibToARFFFormat |
|
somLibVector
somLibClassInfo
|
arff
|
doClassify |
|
arff
|
detailedResults
accuracy
|
Outputs (2)
Name |
Description |
ClassificationAccuracy |
|
DetailedClassificationResults |
|
Datalinks (17)
Source |
Sink |
MP3URL |
fetchMP3FileListingDocument:url |
fetchMP3FileListingDocument:contents |
extractMP3FileNamesFromHTMLDocument:document |
extractMP3FileNamesFromHTMLDocument:mp3Names |
fetchMP3FromURL:mp3Name |
MP3URL |
fetchMP3FromURL:baseUrl |
GroundTruthURL |
fetchGroundTruthDocument:url |
extractMP3FileNamesFromHTMLDocument:mp3Names |
mergeToSingleVector:featureVectorLabel |
extractRHSOMLib_output:fexResult |
mergeToSingleVector:featureVector |
fetchGroundTruthDocument:contents |
convertSomlibToARFFFormat:somLibClassInfo |
mergeToSingleVector:somLibVector |
convertSomlibToARFFFormat:somLibVector |
convertSomlibToARFFFormat:arff |
doClassify:arff |
fetchMP3FromURL:mp3ByteArray |
encodeBase64:bytes |
encodeBase64:base64 |
extractRHSOMLib_input:musicData |
WebServiceAuthenticationVoucher |
extractRHSOMLib_input:voucher |
extractRHSOMLib:parameters |
extractRHSOMLib_output:input |
extractRHSOMLib_input:output |
extractRHSOMLib:parameters |
doClassify:accuracy |
ClassificationAccuracy |
doClassify:detailedResults |
DetailedClassificationResults |
Uploader
License
All versions of this Workflow are
not licensed.
Version 1
(of 1)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (0)
None
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment