看到一篇关于时序相似性检测的文章 How can we quantify similarity between time series?, 里面涉及了几种算法的对比, 非常有启发性. 于是问 ChatGPT 要了几个关于相似性的算法, 也做了相关的对比.
这里记录一下相关的代码和步骤. 这个内容是在 Jupyter Notebook 写的. 主要分为4部分.
定义几种算法
import numpy as np
import pywt
# 1. 欧拉距离 1.长度相同
def euclidean_similarity(actual, predic):
return np.sqrt(np.sum((actual - predic) ** 2))
# 2. mean absolute percentage error (MAPE) 1.长度相同, 值不能为0
def mape_similarity(actual, predic):
return np.mean(np.abs((actual - predic) / actual))
# 3. Pearson correlation coefficient 1.长度相同, 1.0 表示完全相同
def correlation_similarity(actual, predic):
a_diff = actual - np.mean(actual)
p_diff = predic - np.mean(predic)
numerator = np.sum(a_diff * p_diff)
denominator = np.sqrt(np.sum(a_diff ** 2)) * np.sqrt(np.sum(p_diff ** 2))
return numerator / denominator
# 4. 余弦相似性, 1.长度相同, 1.0 表示完全相同
def cosine_similarity(x, y):
numerator = sum([a * b for a,b in zip(x,y)])
denominator = np.sqrt(sum([a**2 for a in x])) * np.sqrt(sum([b**2 for b in y]))
return numerator / denominator
# 5. 基于傅立叶变换 再使用余弦相似
def fft_similarity(x, y):
# 对两个时序数据进行傅里叶变换
fft_x = np.fft.fft(x)
fft_y = np.fft.fft(y)
# 对频谱数据进行归一化处理
norm_x = np.abs(fft_x) / len(x)
norm_y = np.abs(fft_y) / len(y)
# 计算余弦相似度
numerator = np.dot(norm_x, norm_y)
denominator = np.linalg.norm(norm_x) * np.linalg.norm(norm_y)
similarity = numerator / denominator
return similarity
# 6. 小波变换 -
def wavelet_similarity(x, y, wavelet='db4', level=3, threshold='soft', threshold_value=0.1):
# 对两个时序数据进行小波变换
coeffs_x = pywt.wavedec(x, wavelet=wavelet, level=level)
coeffs_y = pywt.wavedec(y, wavelet=wavelet, level=level)
# 对小波系数进行阈值处理
if threshold == 'hard':
thresh_coeffs_x = [pywt.threshold(c, threshold_value, mode='hard') for c in coeffs_x]
thresh_coeffs_y = [pywt.threshold(c, threshold_value, mode='hard') for c in coeffs_y]
elif threshold == 'soft':
thresh_coeffs_x = [pywt.threshold(c, threshold_value, mode='soft') for c in coeffs_x]
thresh_coeffs_y = [pywt.threshold(c, threshold_value, mode='soft') for c in coeffs_y]
else:
raise ValueError("Invalid threshold mode. Must be 'hard' or 'soft'.")
# 计算余弦相似度
flat_x = np.concatenate(thresh_coeffs_x)
flat_y = np.concatenate(thresh_coeffs_y)
numerator = np.dot(flat_x, flat_y)
denominator = np.linalg.norm(flat_x) * np.linalg.norm(flat_y)
similarity = numerator / denominator
return similarity
# 7. 傅立叶变换
# 先通过快速傅立叶变换把时域信号转成频域信号, 然后把其中一个频域和另外一个频域的复共轭做乘积, 再把结果做快速傅立叶逆变换, 得到在时域信号的互相关.
def compare_multiple_arrays_with_max_shift(reference_array, other_arrays, max_shift):
start_ns = time.time_ns()
fft_reference = np.fft.rfft(reference_array)
reference_norm = np.linalg.norm(reference_array)
results = []
for array in other_arrays:
fft_array = np.fft.rfft(array)
cross_correlation = np.fft.irfft(fft_reference * np.conj(fft_array))
max_shift_arr = np.concatenate((cross_correlation[-max_shift:], cross_correlation[:max_shift + 1]))
max_shift_abs_arr = np.abs(max_shift_arr)
lag_index = np.argmax(max_shift_abs_arr)
max_correlation = max_shift_abs_arr[lag_index]
lag = lag_index - max_shift
array_norm = np.linalg.norm(array)
norm = reference_norm * array_norm
correlation_coefficient = 0 if norm == 0 else max_correlation / norm
results.append((correlation_coefficient, lag))
print("method 0 used: ", time.time_ns() - start_ns)
return results
定义一些辅助函数
# 一些辅助函数
def __normalize(vals):
min_v = min(vals)
max_v = max(vals)
return [(x - min_v) / (max_v - min_v) * 100 for x in vals]
def __fill_0_for_empty_ts(x_values, y_values):
"""
x_values & y_values are 2 dimension array, the 1st column is the millisecond, the 2nd
column is the value of that time, ex: [[], [], []]
"""
start_time = round(min(min(x_values)[0], min(y_values)[0]) / 60000) # the min minute
end_time = round(max(max(x_values)[0], max(y_values)[0]) / 60000) # the max minute
count = int(end_time - start_time) + 1
x_vals = np.zeros(count)
y_vals = np.zeros(count)
for element in x_values:
minute = round(element[0] / 60000)
x_vals[minute - start_time] = float(element[1])
for element in y_values:
minute = round(element[0] / 60000)
y_vals[minute - start_time] = float(element[1])
return x_vals, y_vals
定义对比和测试函数
import matplotlib.pyplot as plt
import pandas as pd
from IPython.display import display
def __prepare(ts_x, ts_y):
x = ts_x[:,1]
y = ts_y[:,1]
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, figsize=(30, 8))
ax1.plot(np.array(ts_x[:,0], dtype='datetime64[ms]'), x, color='blue', label='ts_x')
ax2.plot(np.array(ts_y[:,0], dtype='datetime64[ms]'), y, color='red', label='ts_y')
nx = np.array(__normalize(x))
ny = np.array(__normalize(y))
ax3.plot(np.array(ts_y[:,0], dtype='datetime64[ms]'), nx, color='blue', label='normalized_x')
ax3.plot(np.array(ts_y[:,0], dtype='datetime64[ms]'), ny, color='red', label='normalized_y')
ax3.set_title('normalized')
plt.tight_layout()
return x, y, nx, ny
def test_similarity(x, y, similarity_func):
return similarity_func(x, y)
# calc shift
def test_similarity_with_move(ts_x, ts_y, similarity_func):
steps = 8
length = len(ts_x)
best_score = similarity_func(ts_x, ts_y)
best_shift = 0
for move in range(1, steps):
score = similarity_func(ts_x[move:], ts_y[:(length - move)])
# print(f"{best_score} vs {score} with {similarity_func.__name__} shift: {move}")
best_score, best_shift = (score, move) if score > best_score else (best_score, best_shift)
score = similarity_func(ts_y[move:], ts_x[:(length - move)])
# print(f"{best_score} vs {score} with {similarity_func.__name__} shift: {-move}")
best_score, best_shift = (score, move) if score > best_score else (best_score, best_shift)
return best_score, best_shift
def compare(ts_x, ts_y):
algorithms = [correlation_similarity, cosine_similarity, fft_similarity, wavelet_similarity]
x, y, nx, ny = __prepare(ts_x, ts_y)
result = {"algorithm":[], "raw":[], "normalized":[], "rawWithShift":[], "normalizedWithShift":[]}
for algorithm in algorithms:
result["algorithm"].append(algorithm.__name__)
result["raw"].append(test_similarity(x, y, algorithm))
result["normalized"].append(test_similarity(nx, ny, algorithm))
result["rawWithShift"].append(test_similarity_with_move(x, y, algorithm))
result["normalizedWithShift"].append(test_similarity_with_move(nx, ny, algorithm))
df = pd.DataFrame(result)
display(df)
对比测试
明显区分度测试
# 测试1 明显区分度 原始数据
ts_x = np.array([[1682638320000,0.007328675730378209],[1682638380000,0.007166630970559917],[1682638440000,0.00677495505275072],[1682638500000,0.005878961713237096],[1682638560000,0.005011434857853048],[1682638620000,0.003964435698814772],[1682638680000,0.0032577727794710354],[1682638740000,0.0028030470165349985],[1682638800000,0.0022510571486542563],[1682638860000,0.0020857610336525445],[1682638920000,0.0019790581076671865],[1682638980000,0.0018066359030913803],[1682639040000,0.0016530616743632986],[1682639100000,0.001563973077646108],[1682639160000,0.0015774015801659491],[1682639220000,0.0016635560567977992],[1682639280000,0.001684409957195654],[1682639340000,0.0018186865396723206],[1682639400000,0.0020148695825893403],[1682639460000,0.002392657604525561],[1682639520000,0.002773864429062134],[1682639580000,0.002917356551485062],[1682639640000,0.0030241732893402373],[1682639700000,0.0033943180813809093],[1682639760000,0.0039351942403756945],[1682639820000,0.004199541581432875],[1682639880000,0.004468997813243392],[1682639940000,0.004762451107713561],[1682640000000,0.004873222007784839],[1682640060000,0.004694137046307945],[1682640120000,0.004133435929098428],[1682640180000,0.0038304855350106415],[1682640240000,0.0035566636212391867],[1682640300000,0.0034563444688856526],[1682640360000,0.003563236805129044],[1682640420000,0.003652322875815628],[1682640480000,0.003764329371771402],[1682640540000,0.003709763930659138],[1682640600000,0.003527470851182768],[1682640660000,0.0031720018560328356],[1682640720000,0.0028307219739353018],[1682640780000,0.002446958588156911],[1682640840000,0.002163249357725938],[1682640900000,0.0018491573754286783],[1682640960000,0.0016054880435072416],[1682641020000,0.0016268585353828025],[1682641080000,0.0017774368812232266],[1682641140000,0.002023414635800358],[1682641200000,0.002291366977382303],[1682641260000,0.0025414255987979972],[1682641320000,0.0027056666107684313],[1682641380000,0.002782190422505826],[1682641440000,0.0027145828288908103],[1682641500000,0.002552173457510687],[1682641560000,0.0022976245080648106],[1682641620000,0.002022121416229261],[1682641680000,0.0017429114162316184],[1682641740000,0.0015257355856960197],[1682641800000,0.0013625396060445993],[1682641860000,0.0013000981455664196],[1682641920000,0.0013037985329040769],[1682641980000,0.0013252149418385706],[1682642040000,0.0013912497725716566],[1682642100000,0.0014078215964332674],[1682642160000,0.0016080090965746585],[1682642220000,0.0021592147172232456],[1682642280000,0.0029726174960073015],[1682642340000,0.003957435247782359],[1682642400000,0.004996596076256021],[1682642460000,0.005771800735675292],[1682642520000,0.0062248419561224955],[1682642580000,0.006263563752554657],[1682642640000,0.005864433036227079],[1682642700000,0.0052890639934390915],[1682642760000,0.004523157041789183],[1682642820000,0.004078585455152717],[1682642880000,0.004032869476291778],[1682642940000,0.00407780073662134],[1682643000000,0.004438500566723458],[1682643060000,0.004868589334792062],[1682643120000,0.005580639406287835],[1682643180000,0.006204796843167548],[1682643240000,0.006540594322381965],[1682643300000,0.006978832012888847],[1682643360000,0.007070061231323588],[1682643420000,0.007230046190175199],[1682643480000,0.007431167185659282],[1682643540000,0.007635387459498766],[1682643600000,0.007941957234981256],[1682643660000,0.008266612596506961],[1682643720000,0.008703058343890735],[1682643780000,0.009008689964864591],[1682643840000,0.009035894501531638],[1682643900000,0.008945351893496656],[1682643960000,0.008824816546498138],[1682644020000,0.008335362088067955],[1682644080000,0.00781502222873287],[1682644140000,0.007239937679778152],[1682644200000,0.006518150563694758],[1682644260000,0.0058600028132203],[1682644320000,0.005184361913486701],[1682644380000,0.004682281031753832],[1682644440000,0.004348967564366868],[1682644500000,0.004163255024411616],[1682644560000,0.00419656113779332],[1682644620000,0.004241947741375651],[1682644680000,0.00428298333451127],[1682644740000,0.004339898919598184],[1682644800000,0.0043190309827773055],[1682644860000,0.004108698762247842],[1682644920000,0.0038160516541266842],[1682644980000,0.0035909966426352913],[1682645040000,0.0033678108960534248],[1682645100000,0.003232182040623477],[1682645160000,0.0031679864734261987],[1682645220000,0.00308763269254142],[1682645280000,0.0030224010354535924],[1682645340000,0.002893999790712143],[1682645400000,0.0027275119021520355],[1682645460000,0.002470835125129578],[1682645520000,0.002280509501738859],[1682645580000,0.002525232903371144],[1682645640000,0.0030782302258784977],[1682645700000,0.003811473746475169],[1682645760000,0.004666075560952443],[1682645820000,0.005272957055570848],[1682645880000,0.005605267487379217],[1682645940000,0.00549216535396746],[1682646000000,0.004993662245300956],[1682646060000,0.0043942169540098774],[1682646120000,0.0036102880556789785],[1682646180000,0.0031215733333150864],[1682646240000,0.0027843230768865856],[1682646300000,0.002473532317117999],[1682646360000,0.002327839192867165],[1682646420000,0.0021224560822837857],[1682646480000,0.001950708267869361],[1682646540000,0.00175140393765838],[1682646600000,0.0015800073810331439],[1682646660000,0.0015394708645942723],[1682646720000,0.0015687023906095776],[1682646780000,0.001708640903288039],[1682646840000,0.0020302216360987835],[1682646900000,0.0025163984632992076],[1682646960000,0.0029418072306420795],[1682647020000,0.003384975209639207],[1682647080000,0.0036272010302585977],[1682647140000,0.003623455966178857],[1682647200000,0.0034589918678064047],[1682647260000,0.003108060740452001],[1682647320000,0.002825394661602032],[1682647380000,0.002666588103194978],[1682647440000,0.002649715682851328],[1682647500000,0.0028823682055378885],[1682647560000,0.0032135645334064877],[1682647620000,0.003459947824070886],[1682647680000,0.0037663489961766716],[1682647740000,0.0037257364208496124],[1682647800000,0.0035998024353294245],[1682647860000,0.0033623823641214523],[1682647920000,0.003162295566296658],[1682647980000,0.003195775651740007],[1682648040000,0.0031361723464268243],[1682648100000,0.003242792107609249],[1682648160000,0.0031746102008726185],[1682648220000,0.003142860060609487],[1682648280000,0.0029911125004538075],[1682648340000,0.0027131293240030274],[1682648400000,0.0024885990084401177],[1682648460000,0.0021708754800804364],[1682648520000,0.0020740666130409924],[1682648580000,0.0019912220124088664],[1682648640000,0.0019405473558673503],[1682648700000,0.0019347275967319666],[1682648760000,0.0019458516662160807],[1682648820000,0.0020409561978713686],[1682648880000,0.0021301816917985716],[1682648940000,0.0022887430490345917],[1682649000000,0.002770562068244997],[1682649060000,0.0035850825855235913],[1682649120000,0.004619275480323259],[1682649180000,0.005768972400642336],[1682649240000,0.006633137430365976],[1682649300000,0.007155586552817561],[1682649360000,0.007161575246032448],[1682649420000,0.00672737257736622],[1682649480000,0.006016624766026268],[1682649540000,0.0051753086622016164],[1682649600000,0.004593801305652678],[1682649660000,0.004163198340509822],[1682649720000,0.0038325590526006037],[1682649780000,0.0036156221266722133],[1682649840000,0.0033222377599410047],[1682649900000,0.0031782268963684857],[1682649960000,0.003106968471933924],[1682650020000,0.003002687829276929],[1682650080000,0.0030282696101180395],[1682650140000,0.002954503977843359],[1682650200000,0.0029196119932183295],[1682650260000,0.0028110810196320113],[1682650320000,0.0027662178732079656],[1682650380000,0.0028514335000644486],[1682650440000,0.002886132007508868],[1682650500000,0.0030097880354288398],[1682650560000,0.003180530916290447],[1682650620000,0.003237196174907586],[1682650680000,0.0032029400644095762],[1682650740000,0.003381681294171046],[1682650800000,0.003462134537248973],[1682650860000,0.003540405580070405],[1682650920000,0.0036145002762770773],[1682650980000,0.0034996376238434213],[1682651040000,0.0033830123967277803],[1682651100000,0.0029777201901944883],[1682651160000,0.002634704500189766],[1682651220000,0.0022872867121803697],[1682651280000,0.0019755982712702513],[1682651340000,0.001977914513543788],[1682651400000,0.0019632992592498733],[1682651460000,0.0019895730560886005],[1682651520000,0.0020045462460269725],[1682651580000,0.001988533858144681],[1682651640000,0.0021221725321147744],[1682651700000,0.0023389076171003165],[1682651760000,0.0025029030080270243],[1682651820000,0.002712347402250681],[1682651880000,0.002934722834328829],[1682651940000,0.0030497812068259744],[1682652000000,0.0029902790024561865],[1682652060000,0.002727873719077234],[1682652120000,0.002392853116615301],[1682652180000,0.0021400685477295234],[1682652240000,0.0019624593344927943],[1682652300000,0.0019896328293226295],[1682652360000,0.002009000707588582],[1682652420000,0.0019710345093708614],[1682652480000,0.0020518220268753717],[1682652540000,0.002008597813535018],[1682652600000,0.0019351572418411234],[1682652660000,0.0018052122046056107],[1682652720000,0.0016644525621912765],[1682652780000,0.0016511399137405514],[1682652840000,0.001616071462890556],[1682652900000,0.0016209567438129069],[1682652960000,0.0016265177504325434],[1682653020000,0.0016007398012617413],[1682653080000,0.001634723746268163],[1682653140000,0.0016626151240427545],[1682653200000,0.0017584584630750966],[1682653260000,0.001893831719001371],[1682653320000,0.0019970695701683194],[1682653380000,0.00232765810444735],[1682653440000,0.002659990756185615],[1682653500000,0.0029111305458242587],[1682653560000,0.0032191634784118905],[1682653620000,0.003316524984117941],[1682653680000,0.0034123722446546267],[1682653740000,0.0033002312352797825],[1682653800000,0.0030223228060581864],[1682653860000,0.0027233283260920116],[1682653920000,0.0022124329819012134],[1682653980000,0.0019411218239093753],[1682654040000,0.0017181319806034434],[1682654100000,0.0015343285921756156],[1682654160000,0.0015095633924568919],[1682654220000,0.0015374033310443513],[1682654280000,0.0016713365986797957],[1682654340000,0.0017135039895874726],[1682654400000,0.001737500078526466],[1682654460000,0.0017783023895173722],[1682654520000,0.001836238317368899],[1682654580000,0.0019628669204051485],[1682654640000,0.0020511071595300523],[1682654700000,0.0020919509248067403],[1682654760000,0.0020802847578447192],[1682654820000,0.0020133898893013313],[1682654880000,0.0019487157433204505],[1682654940000,0.001805898411775364],[1682655000000,0.0016502545493773946],[1682655060000,0.0016221728607574981],[1682655120000,0.0016981000296136806],[1682655180000,0.0018296560039331444],[1682655240000,0.0019355113811716507],[1682655300000,0.0020158468465454327],[1682655360000,0.0020530949360129114],[1682655420000,0.0020180653355409417],[1682655480000,0.0019211640263269159],[1682655540000,0.001773363009312745],[1682655600000,0.0015853151349297656],[1682655660000,0.0014578640314741875],[1682655720000,0.001405827753802158],[1682655780000,0.0013930104535504473],[1682655840000,0.0014235676662394114],[1682655900000,0.0014888582722065724],[1682655960000,0.0015849292356276967],[1682656020000,0.0016564799291802768],[1682656080000,0.0017166160443695677],[1682656140000,0.001752875433222001],[1682656200000,0.0017569496266973683],[1682656260000,0.0017321556267200222],[1682656320000,0.001858476775846496],[1682656380000,0.0019992890151594445],[1682656440000,0.0021491873565406827],[1682656500000,0.002316572635042702],[1682656560000,0.0023472483849754644],[1682656620000,0.002481008715267463],[1682656680000,0.0024932616003254804],[1682656740000,0.0024815872975171294],[1682656800000,0.002438305748546088],[1682656860000,0.0022468354153518666],[1682656920000,0.002227421024070697],[1682656980000,0.0022351456581477525],[1682657040000,0.002212796542173767],[1682657100000,0.0022636703788108115],[1682657160000,0.0022842578693319515],[1682657220000,0.0023460665275277792],[1682657280000,0.002447716016601653],[1682657340000,0.002360426718802877],[1682657400000,0.002255584073876382],[1682657460000,0.0022849698279282515],[1682657520000,0.002357137323888314],[1682657580000,0.0026025740492461313],[1682657640000,0.002925715828579034],[1682657700000,0.0032799688856598452],[1682657760000,0.00357265637643589],[1682657820000,0.0036104373631341558],[1682657880000,0.0035843899201150053],[1682657940000,0.003377389430974098],[1682658000000,0.003075850252918455],[1682658060000,0.0028364656965261803],[1682658120000,0.002651271053682125],[1682658180000,0.0024537666189214935],[1682658240000,0.0022910827204858375],[1682658300000,0.002376228010664283],[1682658360000,0.0024121694859116083],[1682658420000,0.0025048976227134423],[1682658480000,0.002602719159143896],[1682658540000,0.0025982781005319255],[1682658600000,0.0026006775143946337],[1682658660000,0.0024407333284679478],[1682658720000,0.02883852003407894],[1682658780000,0.1492940034375545],[1682658840000,0.3176241592866017],[1682658900000,0.45541223987530366],[1682658960000,0.5575562726001705],[1682659020000,0.6180101775080709],[1682659080000,0.6482994706319214],[1682659140000,0.655331858934281],[1682659200000,0.6440218466775072],[1682659260000,0.6242940953343561],[1682659320000,0.5857011910622789],[1682659380000,0.544735358222797],[1682659440000,0.5064806297694842],[1682659500000,0.4511789805392241],[1682659560000,0.38312493430286465],[1682659620000,0.28317922112998983],[1682659680000,0.17975552116715965],[1682659740000,0.07697727298290669],[1682659800000,0.0045456785356436935],[1682659860000,0.0037271638293786546],[1682659920000,0.0035343425457551314]])
ts_y = np.array([[1682638320000,1.2999976391715666],[1682638380000,1.3445933616363022],[1682638440000,0.8513891645166145],[1682638500000,0.580030734376455],[1682638560000,0.5366737829361838],[1682638620000,0.29213584265117487],[1682638680000,0.06666666666666667],[1682638740000,0.016666666666666666],[1682638800000,0.016666666666666666],[1682638860000,0],[1682638920000,0.016666666666666666],[1682638980000,0.041666666666666664],[1682639040000,0.049999999999999996],[1682639100000,0.14999968754412588],[1682639160000,0.16110728963202783],[1682639220000,0.15000013889120378],[1682639280000,0.14438552780642439],[1682639340000,0.3352488269002545],[1682639400000,0.4791106494858955],[1682639460000,0.4670988185285921],[1682639520000,0.47477976942200895],[1682639580000,0.4166843529964785],[1682639640000,0.5047513306649607],[1682639700000,1.1145315261277136],[1682639760000,1.3657446685411132],[1682639820000,1.3118932804610217],[1682639880000,1.3502069581635667],[1682639940000,0.8249999312100912],[1682640000000,0.5749947576282455],[1682640060000,0.425062421275175],[1682640120000,0.39166635418185697],[1682640180000,0.5333356252965927],[1682640240000,0.5416674308240772],[1682640300000,0.5416659377744454],[1682640360000,0.5499998959440148],[1682640420000,0.46666524316478064],[1682640480000,0.6336589514654256],[1682640540000,0.6913314113839778],[1682640600000,0.5028315836111288],[1682640660000,0.38466392611255945],[1682640720000,0.19999944449045007],[1682640780000,0.10833336810662474],[1682640840000,0.03333333333333333],[1682640900000,0.0250005208514185],[1682640960000,0.2667035720031638],[1682641020000,0.40833451392505926],[1682641080000,0.5416680904110321],[1682641140000,0.6833330295489726],[1682641200000,0.45832292308947503],[1682641260000,0.5583323612227931],[1682641320000,0.46665854636552123],[1682641380000,0.34166541686573676],[1682641440000,0.33333107679551194],[1682641500000,0.08333326388946759],[1682641560000,0.05000010416796876],[1682641620000,0.024999999999999998],[1682641680000,0.016666666666666666],[1682641740000,0.024999999999999998],[1682641800000,0.041669619101209456],[1682641860000,0.049999999999999996],[1682641920000,0.05833302083926493],[1682641980000,0.15000000000000005],[1682642040000,0.1333332638938078],[1682642100000,0.2083326042501437],[1682642160000,0.6653442813240605],[1682642220000,1.0819944200907627],[1682642280000,1.3986757640109924],[1682642340000,1.6500266144000366],[1682642400000,1.4083953201740684],[1682642460000,1.1167151023096336],[1682642520000,0.9916681947057309],[1682642580000,0.7666733685670183],[1682642640000,0.7583336112326406],[1682642700000,0.59166618062355],[1682642760000,0.6583337847718469],[1682642820000,0.5999875460015153],[1682642880000,0.6166656945127288],[1682642940000,0.6166678820895601],[1682643000000,0.4499863662297911],[1682643060000,0.9416896769371015],[1682643120000,0.9832976874844609],[1682643180000,0.9333240658929527],[1682643240000,1.0750055964431735],[1682643300000,0.600000903022002],[1682643360000,0.39173132611068756],[1682643420000,0.40000562689957914],[1682643480000,0.4916728171698435],[1682643540000,0.5500227058301577],[1682643600000,0.9166703126734733],[1682643660000,1.0583296540822842],[1682643720000,0.8999965974380644],[1682643780000,1.1166663542753188],[1682643840000,0.7916661458777478],[1682643900000,0.76667354487317],[1682643960000,0.7722229090747322],[1682644020000,0.4666662500708899],[1682644080000,0.7416511215169792],[1682644140000,0.8249939602133775],[1682644200000,0.7083330903728287],[1682644260000,0.8083158526792605],[1682644320000,0.6416650001313566],[1682644380000,0.724999757219176],[1682644440000,0.8166649654408255],[1682644500000,0.7666740378807257],[1682644560000,0.6083323959263589],[1682644620000,0.37500145838802307],[1682644680000,0.4499981251539282],[1682644740000,0.48333923941052465],[1682644800000,0.5333367363136681],[1682644860000,0.4833325347750283],[1682644920000,0.37500076390596115],[1682644980000,0.400000000050347],[1682645040000,0.3833338194904531],[1682645100000,0.4333312848965507],[1682645160000,0.3416668750176507],[1682645220000,0.24166645841926884],[1682645280000,0.21666690978081724],[1682645340000,0.15833458338599746],[1682645400000,0.14166677085546953],[1682645460000,0.12500935008019612],[1682645520000,0.5833696574822261],[1682645580000,1.3166618058052564],[1682645640000,1.7416512586793633],[1682645700000,2.066650247736495],[1682645760000,1.791559029251039],[1682645820000,1.1082862688662387],[1682645880000,0.7999629530472216],[1682645940000,0.44166684035257686],[1682646000000,0.4416632989306695],[1682646060000,0.39166559063438255],[1682646120000,0.29166784727343953],[1682646180000,0.3500004167204877],[1682646240000,0.1333350349949652],[1682646300000,0.1416661805839104],[1682646360000,0.11666652778009254],[1682646420000,0.049999999999999996],[1682646480000,0.05000045141334044],[1682646540000,0.0583330208398436],[1682646600000,0.15833333336313743],[1682646660000,0.30833399308608334],[1682646720000,0.45000006944965304],[1682646780000,0.5250007986621833],[1682646840000,0.7166646195307386],[1682646900000,0.6583338195005793],[1682646960000,0.6250019098239343],[1682647020000,0.8083302093174858],[1682647080000,0.5666707306083691],[1682647140000,0.4916658333865731],[1682647200000,0.424999895839844],[1682647260000,0.18333333334056726],[1682647320000,0.2916672917005231],[1682647380000,0.4166673264631103],[1682647440000,0.5083314236809866],[1682647500000,0.6333356251163261],[1682647560000,0.5749980904075438],[1682647620000,0.5666662847822608],[1682647680000,0.49166823096313755],[1682647740000,0.44166791681800815],[1682647800000,0.40841168290966934],[1682647860000,0.5083278178490974],[1682647920000,0.8000021880580872],[1682647980000,0.808369177300842],[1682648040000,0.7416622920714273],[1682648100000,0.516662570484145],[1682648160000,0.23333343756351463],[1682648220000,0.29166312539721073],[1682648280000,0.3083327778530078],[1682648340000,0.30833281374917104],[1682648400000,0.2999658981003717],[1682648460000,0.2083337153126468],[1682648520000,0.22500013893257995],[1682648580000,0.24999954868908955],[1682648640000,0.2500330162625303],[1682648700000,0.21669553983142747],[1682648760000,0.2500018418379428],[1682648820000,0.28332830256066716],[1682648880000,0.25833923988846696],[1682648940000,0.8499995834230328],[1682649000000,1.4416584068732918],[1682649060000,1.8750083767517685],[1682649120000,2.349893261454968],[1682649180000,2.0333524758803745],[1682649240000,1.6416598511596454],[1682649300000,1.38332285358811],[1682649360000,1.0000722840169565],[1682649420000,0.8083225073860746],[1682649480000,0.8583610880767096],[1682649540000,0.7166698979418432],[1682649600000,0.8416634376934256],[1682649660000,0.7166375764127267],[1682649720000,0.5916603829802607],[1682649780000,0.5916649307245302],[1682649840000,0.44166791671354294],[1682649900000,0.8167755438018871],[1682649960000,0.6333245362349534],[1682650020000,0.5499907703759365],[1682650080000,0.6416585809075712],[1682650140000,0.333335034848538],[1682650200000,0.40833444452286255],[1682650260000,0.5750007291879341],[1682650320000,0.6500013195376172],[1682650380000,0.5916653826510151],[1682650440000,0.5249992361843148],[1682650500000,0.5333403839261278],[1682650560000,0.34165434904964276],[1682650620000,0.39167813100060345],[1682650680000,0.6833485843517212],[1682650740000,0.7333358681566876],[1682650800000,0.6916698978701316],[1682650860000,0.6250143504471447],[1682650920000,0.37500197947442404],[1682650980000,0.23333298612557826],[1682651040000,0.2416672569602147],[1682651100000,0.25000034729687937],[1682651160000,0.19166746537949567],[1682651220000,0.14999975695095477],[1682651280000,0.26666697919140725],[1682651340000,0.2583343403126462],[1682651400000,0.2583332639033565],[1682651460000,0.27499979170428196],[1682651520000,0.10833333333333332],[1682651580000,0.24166607643590646],[1682651640000,0.5249989583778916],[1682651700000,0.4666668402978886],[1682651760000,0.4666667014176795],[1682651820000,0.5333335416860536],[1682651880000,0.32500006945515053],[1682651940000,0.341666944520255],[1682652000000,0.3166639589581676],[1682652060000,0.1083228263925104],[1682652120000,0.11666899364960831],[1682652180000,0.19999947917838531],[1682652240000,0.23333618115900626],[1682652300000,0.24166677083723986],[1682652360000,0.16666739586444],[1682652420000,0.07500045145385299],[1682652480000,0.06666631945428209],[1682652540000,0.12499972223148115],[1682652600000,0.11666628474088458],[1682652660000,0.11666666668952506],[1682652720000,0.12499951390162019],[1682652780000,0.08333388890740802],[1682652840000,0.09166666666666666],[1682652900000,0.07499999999999998],[1682652960000,0.049999999999999996],[1682653020000,0.03333333333333333],[1682653080000,0.04166409801422338],[1682653140000,0.09166673611168981],[1682653200000,0.1916665277835648],[1682653260000,0.2083334722291669],[1682653320000,0.38333708460812416],[1682653380000,0.6833332291818573],[1682653440000,0.6083339584305589],[1682653500000,0.5999997222314811],[1682653560000,0.5083350699424805],[1682653620000,0.16666503480887837],[1682653680000,0.14999923616232383],[1682653740000,0.14166670139250584],[1682653800000,0.05000013889120374],[1682653860000,0.041666805557870404],[1682653920000,0.0499998958346354],[1682653980000,0.05833333333333333],[1682654040000,0.07499868076443451],[1682654100000,0.09999954870066341],[1682654160000,0.1583352084586321],[1682654220000,0.17499979166927093],[1682654280000,0.15000010418099005],[1682654340000,0.15000041668750105],[1682654400000,0.11666690972931151],[1682654460000,0.1666664583385416],[1682654520000,0.23333388896123028],[1682654580000,0.20833378475680067],[1682654640000,0.16666732654443522],[1682654700000,0.09166697917838586],[1682654760000,0.04166718753255411],[1682654820000,0.049999999999999996],[1682654880000,0.050000173614728076],[1682654940000,0.04999989583463539],[1682655000000,0.041666666666666664],[1682655060000,0.24166673613831038],[1682655120000,0.26666506957175207],[1682655180000,0.27500059032364066],[1682655240000,0.27499934037311685],[1682655300000,0.06666690973799248],[1682655360000,0.04166690972931155],[1682655420000,0.033333055560474445],[1682655480000,0.024999999999999998],[1682655540000,0.041666666666666664],[1682655600000,0.049999930556134255],[1682655660000,0.041666805557870404],[1682655720000,0.049999999999999996],[1682655780000,0.041666666666666664],[1682655840000,0.041666493059172374],[1682655900000,0.049999999999999996],[1682655960000,0.041666666666666664],[1682656020000,0.03333333333333333],[1682656080000,0.025000138890046302],[1682656140000,0.024999999999999998],[1682656200000,0.024999999999999998],[1682656260000,0.24166593753515497],[1682656320000,0.3000057354140598],[1682656380000,0.34173160451081036],[1682656440000,0.34166718767839527],[1682656500000,0.1583344445028963],[1682656560000,0.23333319452632917],[1682656620000,0.2833335764301233],[1682656680000,0.29166565987079957],[1682656740000,0.2750007986517668],[1682656800000,0.14166684028428822],[1682656860000,0.05833333333333333],[1682656920000,0.29999958334114585],[1682656980000,0.349997847455124],[1682657040000,0.3499976738858207],[1682657100000,0.33333291667447906],[1682657160000,0.09166663194806131],[1682657220000,0.1916660069813356],[1682657280000,0.19166652790336464],[1682657340000,0.20833354169560273],[1682657400000,0.35000000000000014],[1682657460000,0.3583314586865936],[1682657520000,0.36666715281626355],[1682657580000,0.5583319792058726],[1682657640000,0.591667534806571],[1682657700000,0.550002084140452],[1682657760000,0.5416671180802953],[1682657820000,0.3416666320065104],[1682657880000,0.2000009723428884],[1682657940000,0.2832766527714344],[1682658000000,0.32499826397742587],[1682658060000,0.3666660764633957],[1682658120000,0.33334533077339223],[1682658180000,0.10833333333333331],[1682658240000,0.2083331944467594],[1682658300000,0.2833334375039065],[1682658360000,0.3000001388900465],[1682658420000,0.30833322916796896],[1682658480000,0.1666662847310474],[1682658540000,0.049999999999999996],[1682658600000,0.06666795152012105],[1682658660000,8.084383797038834],[1682658720000,116.95480320305296],[1682658780000,308.0927477224179],[1682658840000,452.45974097212917],[1682658900000,533.7775135001857],[1682658960000,522.5950688415487],[1682659020000,386.2247646353648],[1682659080000,289.5582848044634],[1682659140000,255.093055326594],[1682659200000,301.72496990673505],[1682659260000,268.5137052894264],[1682659320000,209.62464021632255],[1682659380000,154.51662197559196],[1682659440000,35.74179090903667],[1682659500000,0.3750076441702283],[1682659560000,0.5749999654486423],[1682659620000,0.4833326389800263],[1682659680000,0.6000003473608198],[1682659740000,0.5583334722777776],[1682659800000,0.3583328125530955],[1682659860000,0.2833344792750411],[1682659920000,0.05000180594684404]])
compare(ts_x, ts_y)
结果:
不明显区分度
# 测试2 一般区分度
ts_x = np.array([[1684142400000,0.004900725958518537],[1684142460000,0.004922043937969356],[1684142520000,0.004960918232336575],[1684142580000,0.005058410123264467],[1684142640000,0.005087717397816105],[1684142700000,0.005098378421433125],[1684142760000,0.0051021828906732125],[1684142820000,0.005035437505554685],[1684142880000,0.004963174013978611],[1684142940000,0.00483528276649936],[1684143000000,0.004708003485498047],[1684143060000,0.004543258314430032],[1684143120000,0.004368802831260399],[1684143180000,0.004305170108534817],[1684143240000,0.004287760497175719],[1684143300000,0.0043482042270891474],[1684143360000,0.004482151259800338],[1684143420000,0.0046167343763307],[1684143480000,0.004711138277918581],[1684143540000,0.004750985329534552],[1684143600000,0.0047351068827742315],[1684143660000,0.004686357648869932],[1684143720000,0.004663931326356008],[1684143780000,0.004660938182642793],[1684143840000,0.0046965282287447785],[1684143900000,0.00471875900993779],[1684143960000,0.004738158949539217],[1684144020000,0.0047408641544123276],[1684144080000,0.004766727752865685],[1684144140000,0.004778480171527266],[1684144200000,0.004768583335906462],[1684144260000,0.004817506707413544],[1684144320000,0.0047861764326061484],[1684144380000,0.004730843568752752],[1684144440000,0.004611429969401337],[1684144500000,0.004432913245822623],[1684144560000,0.004270825535747869],[1684144620000,0.004102742665797687],[1684144680000,0.004010885265347652],[1684144740000,0.0039457635198355545],[1684144800000,0.003938814632315379],[1684144860000,0.00402447023409036],[1684144920000,0.004161124952854256],[1684144980000,0.004334077719926666],[1684145040000,0.004507412451460913],[1684145100000,0.004677871628420149],[1684145160000,0.004818979890345743],[1684145220000,0.004936731380548509],[1684145280000,0.0050676786824582765],[1684145340000,0.005183837895480603],[1684145400000,0.005331445744112595],[1684145460000,0.005564821424961397],[1684145520000,0.00581424632513694],[1684145580000,0.006040605034726809],[1684145640000,0.006188493090849789],[1684145700000,0.006229405608337957],[1684145760000,0.0061583659832329385],[1684145820000,0.0059970613062201306],[1684145880000,0.005821272653661391],[1684145940000,0.0056678714470347336],[1684146000000,0.005591212593976769],[1684146060000,0.005589058943621383],[1684146120000,0.005616710742501585],[1684146180000,0.005656091421112008],[1684146240000,0.005615309463859575],[1684146300000,0.005541904650563589],[1684146360000,0.005392406282064055],[1684146420000,0.005177109981011174],[1684146480000,0.00496743943659439],[1684146540000,0.004741248869148396],[1684146600000,0.004571229262100185],[1684146660000,0.0044086300790265875],[1684146720000,0.004316458710150739],[1684146780000,0.004325066636218788],[1684146840000,0.004422280130746636],[1684146900000,0.004556450881951335],[1684146960000,0.004713264448932608],[1684147020000,0.004898379094811278],[1684147080000,0.005011945922171912],[1684147140000,0.005065271932055859],[1684147200000,0.005055845801622549],[1684147260000,0.005016241993479276],[1684147320000,0.004984851231933485],[1684147380000,0.004979735052210943],[1684147440000,0.005048347584800439],[1684147500000,0.005379527477017754],[1684147560000,0.006204008447417975],[1684147620000,0.0076726748249121846],[1684147680000,0.009706967566859626],[1684147740000,0.012133665627228729],[1684147800000,0.014658914689141267],[1684147860000,0.01687547453258398],[1684147920000,0.01867503652833169],[1684147980000,0.01966851743170328],[1684148040000,0.01981319218573141],[1684148100000,0.019253974274728303],[1684148160000,0.017964479248980814],[1684148220000,0.01619733854130423],[1684148280000,0.013976311633307259],[1684148340000,0.011606482748249825],[1684148400000,0.009341245834860179],[1684148460000,0.007324841103537483],[1684148520000,0.00591308509136157],[1684148580000,0.005104288343400043],[1684148640000,0.0047482280968130786],[1684148700000,0.004742203502123954],[1684148760000,0.0048787873758558975],[1684148820000,0.0050448580703050805],[1684148880000,0.005145478753084021],[1684148940000,0.005221141206120494],[1684149000000,0.005262224532118109],[1684149060000,0.00529036945278194],[1684149120000,0.005406007766640686],[1684149180000,0.005516651335436662],[1684149240000,0.005631431858358571],[1684149300000,0.005634023987767245],[1684149360000,0.005552681260693748],[1684149420000,0.0054384789577012205],[1684149480000,0.005289232682911926],[1684149540000,0.00520388639590641],[1684149600000,0.0054246642403067424],[1684149660000,0.006101365801179703],[1684149720000,0.0071631157892110275],[1684149780000,0.008571493536081443],[1684149840000,0.00998938592149301],[1684149900000,0.01116592271478134],[1684149960000,0.011806378270403983],[1684150020000,0.011682275750362958],[1684150080000,0.010909319356845804],[1684150140000,0.009647314061871026],[1684150200000,0.008280465369472911],[1684150260000,0.007083689842197316],[1684150320000,0.00617849459862152],[1684150380000,0.0056255725107076104],[1684150440000,0.005431332727125371],[1684150500000,0.0055105099664952695],[1684150560000,0.005729650871231673],[1684150620000,0.006042658904532261],[1684150680000,0.006354792565037126],[1684150740000,0.006694559027382807],[1684150800000,0.006920070618845808],[1684150860000,0.006969247522631172],[1684150920000,0.0069533132146326615],[1684150980000,0.006823167473044123],[1684151040000,0.0066620359802506135],[1684151100000,0.006467744591853286],[1684151160000,0.0063120152681334085],[1684151220000,0.006212972513118364],[1684151280000,0.006083728624819984],[1684151340000,0.00602294665620684],[1684151400000,0.005936331490658864],[1684151460000,0.005886692323208043],[1684151520000,0.0059084034536996954],[1684151580000,0.005931338367169858],[1684151640000,0.005983735314181504],[1684151700000,0.005995602390790333],[1684151760000,0.006098013848438],[1684151820000,0.006246662991210017],[1684151880000,0.006335094680732567],[1684151940000,0.006402006654715464],[1684152000000,0.006423645672711031],[1684152060000,0.006435233912266636],[1684152120000,0.0064370473321964106],[1684152180000,0.006437567930868693],[1684152240000,0.006516134197741108],[1684152300000,0.006543931090588595],[1684152360000,0.006519391170320299],[1684152420000,0.006444641423330011],[1684152480000,0.006239126084405799],[1684152540000,0.006055880995463947],[1684152600000,0.005849839046426775],[1684152660000,0.005757052557358366],[1684152720000,0.0057643990269227174],[1684152780000,0.00581148372231155],[1684152840000,0.005971962001960041],[1684152900000,0.006039852252704869],[1684152960000,0.006041547197728425],[1684153020000,0.0060400757365882685],[1684153080000,0.006050846410437183],[1684153140000,0.00612769628775689],[1684153200000,0.0062630034070374485],[1684153260000,0.006422044199365984],[1684153320000,0.0065931891608087545],[1684153380000,0.006907772871802442],[1684153440000,0.007277280717838841],[1684153500000,0.007727677482719186],[1684153560000,0.008251349735820868],[1684153620000,0.00873551405350792],[1684153680000,0.009274831913904102],[1684153740000,0.009635221833645513],[1684153800000,0.009917049353421192],[1684153860000,0.010080813570639169],[1684153920000,0.010099795025296343],[1684153980000,0.010153127432371845],[1684154040000,0.010104937962375105],[1684154100000,0.009909535475216114],[1684154160000,0.009504824544695367],[1684154220000,0.008951031450574187],[1684154280000,0.008256817999294452],[1684154340000,0.007520080023022513],[1684154400000,0.006841318612577085],[1684154460000,0.006281354833203134],[1684154520000,0.005906080596233654],[1684154580000,0.005728374823714688],[1684154640000,0.0056780855341880265],[1684154700000,0.005694896805279792],[1684154760000,0.005704848383808359],[1684154820000,0.005680893116271624],[1684154880000,0.0056405637441486745],[1684154940000,0.005510728369661266],[1684155000000,0.005439625648742785],[1684155060000,0.005422400625782142],[1684155120000,0.005501881204916237],[1684155180000,0.005698754135975093],[1684155240000,0.005959938283791599],[1684155300000,0.0062347147372247],[1684155360000,0.006369448475332717],[1684155420000,0.006365691234406556],[1684155480000,0.0061783844806623245],[1684155540000,0.005857004855179482],[1684155600000,0.005479493150070569],[1684155660000,0.005113579296455839],[1684155720000,0.004959372425254904],[1684155780000,0.005285896011705371],[1684155840000,0.00612503078163118],[1684155900000,0.00741645368223165],[1684155960000,0.008956592447043166],[1684156020000,0.010503416750545114],[1684156080000,0.01195682148600552],[1684156140000,0.013002253751149384],[1684156200000,0.013485417578221082],[1684156260000,0.013324035465088757],[1684156320000,0.01261056122709392],[1684156380000,0.011630793144808083],[1684156440000,0.010514514064400182],[1684156500000,0.009335816385962925],[1684156560000,0.008318058711043408],[1684156620000,0.007521376286166226],[1684156680000,0.0070652746799847455],[1684156740000,0.006892903220606872],[1684156800000,0.006799647725499014],[1684156860000,0.0067489147204093936],[1684156920000,0.006679212667524359],[1684156980000,0.0066613523794141205],[1684157040000,0.006614134560942397],[1684157100000,0.006583207249137413],[1684157160000,0.006560217487604159],[1684157220000,0.006538120111478363],[1684157280000,0.006526205407157093],[1684157340000,0.0064675825540285725],[1684157400000,0.006374867296410347],[1684157460000,0.0062061284978827125],[1684157520000,0.006060134376397852],[1684157580000,0.006028494661051487],[1684157640000,0.006116852568801456],[1684157700000,0.0063272712283963806],[1684157760000,0.006598698780666767],[1684157820000,0.006899227825485799],[1684157880000,0.007144478876370375],[1684157940000,0.00728548164352727],[1684158000000,0.007306942551220219],[1684158060000,0.007156549582141514],[1684158120000,0.006927407909538275],[1684158180000,0.006603709933958979],[1684158240000,0.006237715217158435],[1684158300000,0.005864730570119825],[1684158360000,0.005469490640543806],[1684158420000,0.005170228584278402],[1684158480000,0.004950062499204044],[1684158540000,0.00483287606889915],[1684158600000,0.0048103772214559415],[1684158660000,0.0047994195262547334],[1684158720000,0.004875642163458482],[1684158780000,0.0049977929166298285],[1684158840000,0.0051556224806798],[1684158900000,0.00535209788887725],[1684158960000,0.0055280194077818035],[1684159020000,0.005670443076822518],[1684159080000,0.005738594111867834],[1684159140000,0.005754271426655966],[1684159200000,0.005708051498998001],[1684159260000,0.005608185938720811],[1684159320000,0.0055342977575295604],[1684159380000,0.005475714231980899],[1684159440000,0.0054726742105226656],[1684159500000,0.005507374587879754],[1684159560000,0.005527989545304868],[1684159620000,0.005578759626211016],[1684159680000,0.005590589295799586],[1684159740000,0.005617104929469763],[1684159800000,0.005626262034869378],[1684159860000,0.005626086084114412],[1684159920000,0.0056795181382848225],[1684159980000,0.005704257165727533],[1684160040000,0.005752690670505989],[1684160100000,0.005798847266721641],[1684160160000,0.005798242150982902],[1684160220000,0.005811288997978337],[1684160280000,0.005796814763512459],[1684160340000,0.005739454518698062],[1684160400000,0.0056746101563055484],[1684160460000,0.005638184120607459],[1684160520000,0.005629264069230033],[1684160580000,0.005662340997874327],[1684160640000,0.005672516345190282],[1684160700000,0.005703791049816775],[1684160760000,0.005716631312589038],[1684160820000,0.005658058651098363],[1684160880000,0.0055916986419501935],[1684160940000,0.005425730107664228],[1684161000000,0.005250313099537829],[1684161060000,0.005089807173061622],[1684161120000,0.0049866676632122076],[1684161180000,0.004977238995763855],[1684161240000,0.005017794637936501],[1684161300000,0.005072349429560363],[1684161360000,0.00507983703332382],[1684161420000,0.005049211358418959],[1684161480000,0.00490074724985301],[1684161540000,0.004704899133929352],[1684161600000,0.004494770012036464],[1684161660000,0.004331600316035411],[1684161720000,0.004276826108993714],[1684161780000,0.004318433768794039],[1684161840000,0.004508835722412674],[1684161900000,0.004710454384365681],[1684161960000,0.004837408599054238],[1684162020000,0.004858682879055998],[1684162080000,0.004712715209822971],[1684162140000,0.004431398026779276],[1684162200000,0.0040594615978865045],[1684162260000,0.003633154588922105],[1684162320000,0.0032455359907118675],[1684162380000,0.00293501854461653],[1684162440000,0.0027570636939490134],[1684162500000,0.002683449141863359],[1684162560000,0.0026204308046167135],[1684162620000,0.002542782961082901],[1684162680000,0.0024261474314206666],[1684162740000,0.0022349397552436923],[1684162800000,0.0019855184154030647],[1684162860000,0.0016994347677995458],[1684162920000,0.0014446817166258175],[1684162980000,0.0012675657087105607],[1684163040000,0.0011790078967945927],[1684163100000,0.001176921635328454],[1684163160000,0.0012145709837827479],[1684163220000,0.0012653855604025654],[1684163280000,0.0012770842127123316],[1684163340000,0.0012744240945110619],[1684163400000,0.0012027040559527968],[1684163460000,0.0010690795577407153],[1684163520000,0.0009055788764191774],[1684163580000,0.0006897956962939045],[1684163640000,0.0004968154670033087],[1684163700000,0.0003069139148185185],[1684163760000,0.0001612663719525731],[1684163820000,0.00006490532427516627],[1684163880000,0.000004861730410143927],[1684163940000,0],[1684164000000,0]])
ts_y = np.array([[1684142400000,1797.0786516853918],[1684142460000,1686.6019417475734],[1684142520000,1972.7792915531331],[1684142580000,1782.9787234042565],[1684142640000,1722.208955223878],[1684142700000,3437.383177570078],[1684142760000,1658.850574712641],[1684142820000,1818.2275711159741],[1684142880000,1685.0377833753155],[1684142940000,1609.390862944162],[1684143000000,1743.3333333333323],[1684143060000,1662.8296703296696],[1684143120000,1744.1406249999993],[1684143180000,1959.541284403666],[1684143240000,1994.4836272040338],[1684143300000,1778.4967320261435],[1684143360000,1962.14463840399],[1684143420000,1814.12915851272],[1684143480000,1921.0958904109561],[1684143540000,1957.1212121212145],[1684143600000,1800.288624787774],[1684143660000,1905.5582524271824],[1684143720000,1834.8765432098758],[1684143780000,1753.9754098360668],[1684143840000,1884.2463235294113],[1684143900000,1818.1395348837214],[1684143960000,1877.2262773722632],[1684144020000,1968.478260869565],[1684144080000,1756.6037735849036],[1684144140000,2250.2087682672136],[1684144200000,1695.3846153846148],[1684144260000,1893.2000000000005],[1684144320000,1598.3471074380177],[1684144380000,1716.5931863727424],[1684144440000,1858.9261744966461],[1684144500000,1541.7901234567896],[1684144560000,1651.0805500982324],[1684144620000,1757.881548974944],[1684144680000,1635.7142857142853],[1684144740000,1718.0492813141655],[1684144800000,1661.8140243902433],[1684144860000,2162.837837837848],[1684144920000,1654.3333333333355],[1684144980000,1711.3476263399684],[1684145040000,1800.2608695652182],[1684145100000,1730.000000000001],[1684145160000,1719.0640394088675],[1684145220000,1754.7311827956955],[1684145280000,1750.2204724409462],[1684145340000,1942.0747663551408],[1684145400000,2043.820224719097],[1684145460000,1918.2149046793766],[1684145520000,1969.9456521739116],[1684145580000,1879.3951612903236],[1684145640000,1845.779661016949],[1684145700000,1961.1287758346564],[1684145760000,1831.41935483871],[1684145820000,1937.051724137929],[1684145880000,2029.1666666666579],[1684145940000,1886.7105263157878],[1684146000000,1790.6170886075947],[1684146060000,1970.7772020725401],[1684146120000,2318.32298136645],[1684146180000,1978.3999999999992],[1684146240000,1907.1269487750533],[1684146300000,1984.1686746987975],[1684146360000,1784.9827586206893],[1684146420000,1913.1955484896648],[1684146480000,1777.328],[1684146540000,2161.376404494384],[1684146600000,1835.9857142857165],[1684146660000,1858.0026281208927],[1684146720000,1899.6861626248212],[1684146780000,1922.5937031484227],[1684146840000,1674.0189445196193],[1684146900000,1763.9108910891082],[1684146960000,1880.7045009784738],[1684147020000,1843.8477801268455],[1684147080000,1787.7198211624432],[1684147140000,1781.7499999999975],[1684147200000,1828.3412322274862],[1684147260000,1733.614457831325],[1684147320000,1569.3188854489183],[1684147380000,1965.9445407279038],[1684147440000,1861.6607773851586],[1684147500000,1840.4238410596026],[1684147560000,1934.9999999999995],[1684147620000,1957.677725118484],[1684147680000,2241.261498028909],[1684147740000,2275.777777777771],[1684147800000,1964.1326530612268],[1684147860000,2364.445828144457],[1684147920000,1998.0575539568342],[1684147980000,2044.5054945054815],[1684148040000,2847.7763659466277],[1684148100000,2915.9722222222126],[1684148160000,1990.8092485549146],[1684148220000,3380.909090909099],[1684148280000,4882.432432432441],[1684148340000,4996.987951807211],[1684148400000,4956.813819577734],[1684148460000,10114.634146341443],[1684148520000,4796.183206106857],[1684148580000,3757.4753173483796],[1684148640000,4576.7973856209155],[1684148700000,3492.4731182795776],[1684148760000,3652.1551724137885],[1684148820000,2122.093023255801],[1684148880000,1708.4313725490183],[1684148940000,1780.898876404496],[1684149000000,1804.5714285714323],[1684149060000,1679.088098918082],[1684149120000,1701.4716981132042],[1684149180000,1656.241379310345],[1684149240000,1985.7187017001534],[1684149300000,1754.7862068965533],[1684149360000,1749.6015936254985],[1684149420000,1883.0515759312323],[1684149480000,1803.284574468086],[1684149540000,1812.5547445255445],[1684149600000,1890.994764397906],[1684149660000,1859.4104560622893],[1684149720000,1903.95378690629],[1684149780000,2036.1969111968956],[1684149840000,1950.3270223752138],[1684149900000,1893.6933797909396],[1684149960000,1695.7081545064375],[1684150020000,1913.7693631669506],[1684150080000,1881.993006993006],[1684150140000,2070.9424083769736],[1684150200000,1782.3203592814366],[1684150260000,1838.3606557377057],[1684150320000,1763.9661016949144],[1684150380000,1859.8338368580057],[1684150440000,1910.320855614972],[1684150500000,1980.0975609756103],[1684150560000,1759.4331983805669],[1684150620000,1971.276595744681],[1684150680000,1773.5254237288134],[1684150740000,1815.0161290322571],[1684150800000,1820.1627486437599],[1684150860000,1903.3505154639142],[1684150920000,1965.4265734265723],[1684150980000,1756.9079754601198],[1684151040000,1840.8345752608034],[1684151100000,1983.273905996757],[1684151160000,1925.3092783505153],[1684151220000,1908.604651162793],[1684151280000,1843.6071887034655],[1684151340000,1787.6822633297056],[1684151400000,1805.785234899329],[1684151460000,1860.202312138729],[1684151520000,2870.871143375676],[1684151580000,3121.2742980561516],[1684151640000,3327.3218142548585],[1684151700000,2778.5851780558273],[1684151760000,2795.159728944824],[1684151820000,2697.834158415847],[1684151880000,2841.3716814159293],[1684151940000,3076.4394829612183],[1684152000000,1378.7657430730487],[1684152060000,1381.5567765567762],[1684152120000,3033.734939759021],[1684152180000,4347.3509933774785],[1684152240000,5051.801801801774],[1684152300000,4100.322580645134],[1684152360000,1976.1247973767386],[1684152420000,1979.6071428571424],[1684152480000,1910.9078404401644],[1684152540000,1766.2827225130877],[1684152600000,1657.899842364081],[1684152660000,1830.4106468583077],[1684152720000,1784.2769230769213],[1684152780000,1779.3984962406014],[1684152840000,1953.583690987126],[1684152900000,1898.2544727070926],[1684152960000,2008.4889987064257],[1684153020000,2814.2079048843243],[1684153080000,2602.889148417723],[1684153140000,3180.644479432188],[1684153200000,3018.7361979204934],[1684153260000,2150.263975558962],[1684153320000,2077.1640144295625],[1684153380000,2187.7926836734514],[1684153440000,1952.181818181819],[1684153500000,1906.5979381443306],[1684153560000,1854.477611940299],[1684153620000,1982.8368794326248],[1684153680000,1936.9152542372883],[1684153740000,1842.6644182124787],[1684153800000,2057.1721311475285],[1684153860000,1930.3302509907521],[1684153920000,1991.5546218487402],[1684153980000,1874.9499545040942],[1684154040000,1841.875693673695],[1684154100000,1860.85889570552],[1684154160000,1827.5929752066118],[1684154220000,2642.58241758242],[1684154280000,1949.168704156479],[1684154340000,1885.8257713248631],[1684154400000,1936.5283018867901],[1684154460000,1841.707080504364],[1684154520000,1734.3518518518513],[1684154580000,1845.531914893616],[1684154640000,1856.636125654449],[1684154700000,1932.822429906544],[1684154760000,1802.0820189274452],[1684154820000,1744.559999999998],[1684154880000,1981.5044247787612],[1684154940000,1802.052980132451],[1684155000000,1963.751668891856],[1684155060000,2221.3963963963934],[1684155120000,1964.985955056179],[1684155180000,1814.299065420561],[1684155240000,1869.838709677419],[1684155300000,1827.6271186440674],[1684155360000,1905.6666666666677],[1684155420000,1746.677524429968],[1684155480000,1962.8813559322034],[1684155540000,1930.1845018450167],[1684155600000,1763.603034134007],[1684155660000,1806.207701283544],[1684155720000,1776.0456730769229],[1684155780000,1907.9721030042922],[1684155840000,1979.4346289752639],[1684155900000,1850],[1684155960000,2596.3251670378627],[1684156020000,1868.6101694915246],[1684156080000,1855.7101024890203],[1684156140000,2233.4886817576485],[1684156200000,1940.7702702702693],[1684156260000,3068.7763713080158],[1684156320000,2209.5444685466427],[1684156380000,2401.148851148847],[1684156440000,2110.0112485939153],[1684156500000,1801.420047732697],[1684156560000,1830.608365019011],[1684156620000,1864.3550624133138],[1684156680000,1779.4650205761318],[1684156740000,1791.6706161137427],[1684156800000,1854.9466192170814],[1684156860000,1687.9656160458464],[1684156920000,1968.3253588516736],[1684156980000,1764.858611825193],[1684157040000,1919.6932515337428],[1684157100000,1769.2094861660073],[1684157160000,1735.2030735455528],[1684157220000,1948.9361702127685],[1684157280000,1750.2443609022566],[1684157340000,1806.5100671140956],[1684157400000,1971.58463385354],[1684157460000,1795.0704225352108],[1684157520000,1764.2024965325922],[1684157580000,1874.3540183112905],[1684157640000,1890.6065088757414],[1684157700000,1919.3067590987848],[1684157760000,1740.9292502639917],[1684157820000,1883.8912133891235],[1684157880000,2247.024952015375],[1684157940000,1971.0535117056843],[1684158000000,1963.0633284241503],[1684158060000,2375.0000000000045],[1684158120000,2281.8991097922817],[1684158180000,2307.380952380962],[1684158240000,1841.62303664921],[1684158300000,1886.4006514657979],[1684158360000,1734.5123384253804],[1684158420000,1708.4269662921329],[1684158480000,1613.0898203592806],[1684158540000,1864.0845070422502],[1684158600000,1591.999999999999],[1684158660000,1826.4131994261124],[1684158720000,1605.6120826709066],[1684158780000,1669.6625421822282],[1684158840000,1731.3366336633708],[1684158900000,1797.1879483500682],[1684158960000,1825.505780346819],[1684159020000,1899.3865030674842],[1684159080000,1680.6249999999973],[1684159140000,1782.9172932330816],[1684159200000,1858.8267148014422],[1684159260000,1713.2421874999995],[1684159320000,1607.3873873873856],[1684159380000,1720.858725761773],[1684159440000,1588.7537993920976],[1684159500000,1650.7012195121938],[1684159560000,1662.8129205921946],[1684159620000,1708.826151560177],[1684159680000,1568.4615384615377],[1684159740000,1528.090322580645],[1684159800000,1731.8490967056314],[1684159860000,1601.6613418530362],[1684159920000,1518.2207578253679],[1684159980000,1396.5697674418586],[1684160040000,1623.604651162791],[1684160100000,1489.7496522948554],[1684160160000,1554.8637015781924],[1684160220000,1435.7885906040292],[1684160280000,1685.1741293532332],[1684160340000,1813.4756097560953],[1684160400000,1533.5937499999984],[1684160460000,1818.8415446071901],[1684160520000,1838.0295566502443],[1684160580000,1591.733021077283],[1684160640000,1396.7315175097287],[1684160700000,1357.4918918918893],[1684160760000,1597.197452229298],[1684160820000,1482.3979591836726],[1684160880000,1510.6538461538405],[1684160940000,1391.6493313521544],[1684161000000,1266.3421828908554],[1684161060000,1354.928848641655],[1684161120000,1388.2812499999955],[1684161180000,1549.1381668946628],[1684161240000,1552.0574162679409],[1684161300000,1196.1259079903136],[1684161360000,1234.6196660482337],[1684161420000,1315.2928647497326],[1684161480000,1396.98113207547],[1684161540000,1521.6216216216205],[1684161600000,1478.810289389074],[1684161660000,1438.6451612903177],[1684161720000,994.4959677419364],[1684161780000,978.4968684759922],[1684161840000,1606.6513056835638],[1684161900000,1597.032457496134],[1684161960000,1623.5437589670014],[1684162020000,1430.3545051698657],[1684162080000,869.6445497630334],[1684162140000,956.458885941644],[1684162200000,904.5634920634895],[1684162260000,836.3212435233139],[1684162320000,828.5777777777766],[1684162380000,783.8252340615243],[1684162440000,766.3223300970867],[1684162500000,3009.6874999999286],[1684162560000,1632.5087924970692],[1684162620000,1585.9181685338517],[1684162680000,1502.2391559202813],[1684162740000,1617.2050340849498],[1684162800000,1569.0939977349924],[1684162860000,1510.1306818181818],[1684162920000,1493.2784726793925],[1684162980000,1425.8500323206197],[1684163040000,584.0601503759393],[1684163100000,398.3973655323814],[1684163160000,389.6801346801341],[1684163220000,491.54566744730516],[1684163280000,371.4275256222553],[1684163340000,383.01547678482285],[1684163400000,436.19512195121996],[1684163460000,663.1407942238234],[1684163520000,855.6786366402918],[1684163580000,868.0652818991098],[1684163640000,830.8698777857647],[1684163700000,190.87328767123273],[1684163760000,177.98598130841094],[1684163820000,176.26115041525668],[1684163880000,158.09655396618976],[1684163940000,163.54401228249736],[1684164000000,154.67682363804215]])
compare(ts_x, ts_y)
结果: