You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
2 weeks ago
|
try:
|
||
|
for i in range(1, 3):
|
||
|
k = i
|
||
|
model = pca_train_k.pca(train_data, k)
|
||
|
if al_type == "SPE":
|
||
|
limit = model["QCUL_95"]
|
||
|
elif al_type == "FAI":
|
||
|
limit = model["Kesi_95"]
|
||
|
else:
|
||
|
limit = model["T2CUL_95"]
|
||
|
_, test_data, f_m = get_test_data_1(train_data, samples, amplitudes, fault_index, 1)
|
||
|
data = (test_data - model["Train_X_mean"]) / model["Train_X_std"]
|
||
|
t_r = get_rb_pca(data, model, limit, al_type, f_m)
|
||
|
result.append(t_r)
|
||
|
except Exception as e:
|
||
|
with open('log.log', "a") as f:
|
||
|
f.write(f"{str(datetime.datetime.now())}{traceback.format_exc()}")
|
||
|
|
||
|
|
||
|
|
||
|
# for index in range(data.shape[0]):
|
||
|
# line = data[index] @ m @ data[index].T
|
||
|
# lines.append(line)
|
||
|
# x = list(range(data.shape[0]))
|
||
|
# limits_line = list(repeat(limit, data.shape[0]))
|
||
|
# plt.plot(x, lines)
|
||
|
# plt.plot(x, limits_line)
|
||
|
# plt.title(f'k={k},limit={limit}')
|