Skip to content

Commit

Permalink
Merge pull request #19 from vaskonov/waves
Browse files Browse the repository at this point in the history
improvements learing curves
  • Loading branch information
erelsgl committed Apr 8, 2014
2 parents 930dd3b + 96f036a commit 8617abb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utils/learning_curves.js
Expand Up @@ -101,7 +101,7 @@ module.exports.learning_curves = function(classifiers, dataset, parameters, step

_.each(classifiers, function(value, key, list) {
stats = trainAndTest_hash(value, mytrainset, test, 5)
report.push(stats[1]['stats'])
report.push(stats[2]['stats'])
})

_.each(parameters, function(value, key, list){
Expand All @@ -111,15 +111,17 @@ module.exports.learning_curves = function(classifiers, dataset, parameters, step

_.each(parameters, function(value, key, list){
plotfor = "plot "
_(numOfFolds).times(function(n){
_(fold+1).times(function(n){
// _.each(parameters, function(value, key, list){
plotfor = plotfor + " for [i=2:"+ (_.size(classifiers) + 1)+"] \'"+dir+value+"-fold"+n+"\' using 1:i with lines linecolor i, "
plotfor = plotfor + " for [i=2:"+ (_.size(classifiers) + 1)+"] \'"+dir+value+"-fold"+n+"\' using 1:i with linespoints linecolor i pt "+n+" ps 3, "
// fs.writeFileSync(dir+value+"-fold"+n, header, 'utf-8', function(err) {console.log("error "+err); return 0 })
// },this)
},this)
plotfor = plotfor.substring(0,plotfor.length-2);
command = "gnuplot -p -e \"reset; set term png truecolor; set grid ytics; set grid xtics; set key bottom right; set output \'"+dir + value+".png\'; set key autotitle columnhead; "+plotfor +"\""
command = "gnuplot -p -e \"reset; set term png truecolor size 1024,1024; set grid ytics; set grid xtics; set key bottom right; set output \'"+dir + value+".png\'; set key autotitle columnhead; "+plotfor +"\""
result = execSync.run(command)
// console.log(command)
// process.exit(0)
}, this)
}

Expand Down
4 changes: 4 additions & 0 deletions utils/trainAndTest.js
Expand Up @@ -45,6 +45,10 @@ module.exports.testLite2 = function(classifier, testSet1, explain) {
inputnormal = inputnormal.replace(/\./g," .")
inputnormal = inputnormal.replace(/\?/g," ?")
inputnormal = inputnormal.replace(/\!/g," !")
inputnormal = inputnormal.replace(/\%/g," %")
inputnormal = inputnormal.replace(/\$/g," $")



am = util.intent_attr_label_ambiguity(classes)
if (am.length > 0)
Expand Down

0 comments on commit 8617abb

Please sign in to comment.