title: Several sensors - noise filtering algorithm needed
body: <p>My software receives information from several sensors. The number of sensors is not fixed - they can be added and removed, each sensor one has its own unique identifier. Sensors send data irregularly - they can keep silent for weeks or push data every second. Each sensor generates a value from a fixed set of values ​​- so sensors are discrete. My program logs each message from each sensor into an SQL database table (sensorId, time, value).</p>
  
  <p>The task is to filter the information. I need to select only one record from this log, which I'm considering to be the actual information. For example, if I get the latest record from a single sensor, which says that value is A, but before it 10 different sensors told me that the value is B, then I shall still consider B to be the actual information. At the same time the problem is not just the usual noise filtering, because if there was one sensor which told me for a month every second that value was C, and then five sensors recently tell that in fact the value is D, I shall immediately consider D to be the actual data despite long history - I want to say that the number of independent sources also must have weight.</p>
  
  <p>So, I think I get a kind of a function of two variables - time (ageing) and the number of unique sensors in the moment of time. So, I think, I must somehow calculate the weight of each record and then just select the one with the biggest weight. And I suppose that to calculate the record weight I should use not only the information from current record, but information from all the previous ones.</p>
  
  <p>I need some help with the algorithm. Maybe there is actually some well-known solution which I'm not aware of?</p>