2
$\begingroup$

I am running analysis on data for this type of sensor my company makes. I want to quantify the health of the sensor based on three features using the following formula:

sensor health index = feature1 * A + feature2 * B + feature3 *C

We also need to pick a threshold so that if this index exceeds the threshold, the sensor is considered as bad sensor.

We only have a legacy list which shows about 100 sensors are bad. But now we have data for more than 10,000 sensors. Anything not in that 100 sensor list is NOT necessarily bad. So I guess the linear regression methods don't work in this scenario.

The only way I can think of is the brute force fitting. Pseudo code is as follows:

# class definition for params(coefficients)
class params{
  a
  b
  c
  th
}


# dictionary of parameter and accuracy rate
map = {}

for thold in range (1..20):
   for a in range (1..10):
      for b in range (1..10):
        for b in range (1..10):
           # bad sensor list
           bad_list = []
           params = new params[a, b, c, thold]
           for each sensor:
             health_index = sensor.feature1*a+sensor.feature2*b+sensor.feature3*c
             if health_index > thold:
               bad_list.append(sensor.id)
           accuracy = percentage of common sensors between bad_list and known_bad_sensors
           map[params] = accuracy

# rank params based on accuracy
rank(map)
# the params with most accuracy is the best model
print map.index(0)

I really don't like this method since it is using 5 for loops which is very efficient. I wonder if there is a better way to do it. Using existing library such as sk-learn perhaps?

$\endgroup$
1
$\begingroup$

If you don't know which of the 10,000 sensors are good and which are bad, the data from those 10,000 sensors is useless for training a regression line / classifier. You need labelled data, where you know both the value of the features and the health of the sensor.

Moreover, to be effective, you probably need your training set to contain both healthy sensors and bad sensors (where you know which ones are healthy and which ones are bad); it's not enough to just have data from bad sensors, because that doesn't tell you what healthy sensors look like. In a pinch you could use one-class classification, but I don't recommend it -- your results will probably be poor, and you'll probably be better off obtaining labelled data from both healthy sensors and bad sensors.

| improve this answer | |
$\endgroup$
  • $\begingroup$ If I had at least a few thousands sensors with both "bad" and "good" labels, I wouldn't be asking this question. The thing is the 100 bad sensors is all I got. That's why I need some magic to work something out with limited knowledge. At this point, I don't care how poor the fitting is and the accuracy of the prediction. $\endgroup$ – ddd Mar 31 '18 at 3:57
  • $\begingroup$ @ddd, sorry to be the bearer of bad news, but I gotta tell it like it is. Sometimes the truth is unpleasant. I did give you a link to an alternative -- see the "in a pinch". I suggest exploring that direction. $\endgroup$ – D.W. Mar 31 '18 at 6:46
1
$\begingroup$

Given that only have labels for a small subset of data, you should use unsupervised methods. You can cluster all the sensors data. Then see if there is a pattern to where the 100 bad sensors are and can generalize to the other sensors. If a majority of the 100 bad sensors are in the same region, you can label that cluster as bad and make a threshold based on that.

There is also the field of semi-supervised learning that might be appropriate.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.