summaryrefslogtreecommitdiff
path: root/views/prediction.haml
blob: 0187f8707e4f2800591d6998b28d2092cb0bae0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
.predictions
  %table
    %tr
      %th= @title.gsub(/_lazar_.*$/,' ').capitalize
      %th Prediction
      %th 
        %a{:href => "#", :id => "linkConfidence#{p.object_id}"} Confidence
        :javascript
          $("a#linkConfidence#{p.object_id}").click(function () {
            $("dl#confidence").toggle();  
          });
      %th Relevant features
    %tr
      %th
        %img{:src => @compound.image_uri, :alt => @compound.smiles}
        %td
          - if @measured_activities
            %br
            - @measured_activities.each do |a|
              - if activity(a) == 'active'
                .active
                  = activity(a)
              - elsif activity(a) == 'inactive'
                .inactive
                  = activity(a)
              - else
                = a
            %br
              (
              %a{:href => "#", :id => "linkTrainingData#{p.object_id}"} Training data
              :javascript
                $("a#linkTrainingData#{p.object_id}").click(function () {
                  $("dl#training_data").toggle();  
                });
              )

          - else
            - if activity(@activity) == 'active'
              .active
                = activity(@activity)
            - elsif activity(@activity) == 'inactive'
              .inactive
                = activity(@activity)
            - elsif @activity.is_a?(Float)
              .other
                = sprintf('%.03g', @activity)
            - else
              .other
                %em= @activity.to_s
        %td
          = sprintf('%.03g', @confidence.to_f.abs) if @confidence
        %td
          %table
            %tr
              %th{:colspan => 2} activating
              %th p value
            - if @features[:activating]
              - @features[:activating].sort{|a,b| b.last <=> a.last }.each do |f|
                %tr
                  %th= f[0]
                  %td= f[1]
            %tr
              %th{:colspan => 2} deactivating
              %th p value
            - if @features[:deactivating]
              - @features[:deactivating].sort{|a,b| b.last <=> a.last }.each do |f|
                %tr
                  %th= f[0]
                  %td= f[1]
    %tr
      %th Neighbors
      %th Activity
      %th Similarity (activity specific)
      %th Relevant features
    - @neighbors.sort{|a,b| b.last[:similarity] <=> a.last[:similarity]}.each do |uri,data|
      - c = OpenTox::Compound.new(:uri => uri)
      %tr
        %th 
          %br= c.smiles
          %br
            %a{:href => c.image_uri, :target => "_blank"} Image
          %br
            %img{:src => c.image_uri, :alt => c.smiles}
        %td
          - data[:activities].each do |act|
            - if activity(act) == 'active'
              .active
                = activity(act)
            - elsif activity(act) == 'inactive'
              .inactive
                = activity(act)
            - elsif act.is_a?(Float)
              .other
                = sprintf('%.03g', act)
            - else
              .other
                %em= act.to_s
        %td
          = sprintf('%.03g', data[:similarity])
        %td
          %table
            %tr
              %th{:colspan => 2} activating
              %th p value
              -#%td= data[:features].inspect
            -# data[:features][:activating].each do |f|
            - data[:features][:activating].sort{|a,b| b.last[:p_value] <=> a.last[:p_value] }.each do |f|
              -# f.inspect
              %tr
                %th= f[:smarts]
                %td= f[:p_value]
                %td=# f[:p_value]
            %tr
              %th{:colspan => 2} deactivating
              %th p value
            -# data[:features][:deactivating].sort{|a,b| b.last[:p_value] <=> a.last[:p_value] }.each do |f|
            - data[:features][:deactivating].each do |f|
              %tr
                %th= f[:smarts]
                %td= f[:p_value]



%dl#confidence{ :style => "display: none;" }
  %dt Confidence:
  %dd Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence &gt; 0.025 is a sensible (hard) cutoff to distiguish between reliable and unreliable predictions.


%dl#training_data{ :style => "display: none;" }
  %dt Training data:
  %dd Experimental result(s) from the training dataset are displayed here.