From a45efc2a559cd62b25523e6d37a4c1a35c66884f Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 27 Jan 2016 17:30:29 +0100 Subject: util/convlr.rb: generate directly applyable learning rates from update and gradient histories learned with AdaDelta --- util/convlr.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 util/convlr.rb (limited to 'util') diff --git a/util/convlr.rb b/util/convlr.rb new file mode 100755 index 0000000..864f397 --- /dev/null +++ b/util/convlr.rb @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby + +require 'zipf' + +updates = SparseVector.new +ReadFile.readlines_strip(ARGV[0]).each { |line| + k,v = line.split + updates[k] = v.to_f +} +grads = SparseVector.new +ReadFile.readlines_strip(ARGV[1]).each { |line| + k,v = line.split + grads[k] = v.to_f +} + +smooth = 0.000001 + +ks = updates.keys + grads.keys + +rates = SparseVector.new +ks.each { |k| + rates[k] = -1*(Math.sqrt(updates[k]+smooth)/Math.sqrt(grads[k]+smooth)) +} + +rates.each { |k,v| + puts "#{k} #{v}" +} + -- cgit v1.2.3