This commit is contained in:
Oliver Kennedy 2017-09-13 01:08:56 -04:00
parent b13f1f10df
commit 000dc43d22
2 changed files with 7 additions and 102979 deletions

View file

@ -8,11 +8,12 @@ headers = input.shift.every(2, 1).map { |h| h.gsub(/[^0-9a-zA-Z]/, "_").gsub(/_+
p headers
# outputs = Hash.new { |hash, key| hash[key] = File.new("output_#{headers[key]}.csv", "w+") }
ret = input.map do |l|
(0..(l.length / 2).floor).map do |i|
{ x: l[i*2], y: l[i*2+1], c: i } if l[i*2] != ""
end.compact.flatten(1)
end
File.open("predictions.json", "w+") do |f|
input.each do |l|
(0..(l.length / 2).floor).each do |i|
f.puts({ x: l[i*2], y: l[i*2+1], c: i }.to_json) if l[i*2] != ""
end
end
f.puts(ret.to_json)
end
# outputs.values.each { |f| f.close }

File diff suppressed because one or more lines are too long