0

I don't have a real question but I'm more like seeking for creative input for a problem.

I want to compare two (most likely unequal) Date values and calculate the ratio of their similarity. So for example if I'd compare 08.01.2013 and 10.01.2013 I would get a relative high value but between 08.01.2013 and 17.04.1998it would be really low.

But now I'm not sure how I should exactly calculate the similarity. First I was thinking about turning the Date values into Strings and then use the EditDistance on them (number of single char operations to transform one String into another). This seems like a good idea for some cases and I'll definitly implement it but I also need an appropriate calculation for something like 31.01.2013 and 02.02.2013

4

2 に答える 2

1

2 つの日付の日数差を出発点として使用してみませんか? 類似した日付の場合は「低」、等しくない日付の場合は「高」であり、算術演算を使用して、要件に一致する「類似度」を取得します。

行き詰まった場合は、過去の「十分に早い」固定基準日を検討してください。

于 2013-01-08T12:28:15.073 に答える
0

編集距離は、レーベンシュタイン距離を使用して計算できます。

年の変化は、日の変化よりもはるかに多くの「距離」を意味します。日を比較する通常の方法は、距離を日または時間で計算することです。これを行うには、両方の日付をシリアル日番号に変換します。Microsoft は、日付の比較と距離の計算のためにDateDiff()関数を提供しています。

于 2013-01-08T12:27:43.787 に答える