From 8ebb209d00fd11ccdc86bc1e695f4bb9b9300f33 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 22 Jan 2016 11:13:41 +0100 Subject: example with relevant features only --- application.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/application.rb b/application.rb index 703932f..7ff09be 100644 --- a/application.rb +++ b/application.rb @@ -4,11 +4,10 @@ require_relative 'nanoparticles.rb' also_reload './nanoparticles.rb' get '/?' do - @data = JSON.parse(File.read("./data.json")) - @example = @data[@data.keys.sample]["physchem"] + data = JSON.parse(File.read("./data.json")) + relevant_features = JSON.parse(File.read("./relevant-features.json")) + @example = data[data.keys.sample]["physchem"].select{|f,v| relevant_features.keys.include? f} # create a data entry form with @example as default values - #content_type :json - #JSON.pretty_generate(@example) end post '/?' do @@ -16,6 +15,4 @@ post '/?' do # display prediction with # query + prediction (or match if available) # neighbors: id, composition, physchem, tox, similarity - #content_type :json - #JSON.pretty_generate(@example) end -- cgit v1.2.3