Home > Enterprise >  How to compare one set of data to another and choose the smallest degree value?
How to compare one set of data to another and choose the smallest degree value?

Time:10-24

I have a code for determining some value by two methods. My data is in dataframe and I choose two time intervals and by changing the times within these two time intervals and find the smallest degree value. My data is in following form: It's just an example.

df:
epoch                r1         r2      r3
2020-07-07T08:17    -6.366163  11.8    -1.2
2020-07-07T08:18    -5.163     10.38   -2.5
2020-07-07T08:19    -4.3        9.4     5.2
...........
2020-07-07T14:00    1 0.25      22.2    1.5

enter image description here

>>> ix
(Timestamp('2020-07-07 00:01:00', freq='T'),
 Timestamp('2020-07-07 00:02:00', freq='T'),
 Timestamp('2020-07-07 00:27:00', freq='T'),
 Timestamp('2020-07-07 00:28:00', freq='T'))

>>> y
0.1649...

Plot df, the two "big" intervals to chose from, and the two intervals found:

ax = df.plot()
ax.axvspan(*interval0, color='grey', alpha=0.1)
ax.axvspan(*interval1, color='grey', alpha=0.1)
ax.axvspan(ix[0], ix[1], color='grey', alpha=0.3)
ax.axvspan(ix[2], ix[3], color='grey', alpha=0.3)

Discussion

We need more information about the meaning of the measure being minimized. Not only is it very possible that drastically more efficient optimization techniques can be applied, the actual validity of the measure is called in question.

The meaning of the measure calculated is important and deserves scrutiny. Additionally, we should note conditions by which the measure can be unstable and yield unexpected results. For example, the axis of minimum variance (found by PCA) can be arbitrarily unstable: a close to spherical cloud of points (more precisely, one with close to spherical inertia) will yield a random direction that can be completely affected by as little as a single point added or removed.

Likewise, the direction orthogonal to the two barycenters can be arbitrarily unstable if the two are too close to each other.

  • Related