add: a short-term feature in pred model

This commit is contained in:
alikia2x (寒寒) 2025-03-16 15:10:32 +08:00
parent 93bdddc21e
commit 2ed909268e
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6
2 changed files with 6 additions and 5 deletions

View File

@ -37,6 +37,7 @@ class VideoPlayDataset(Dataset):
] ]
else: else:
self.feature_windows = [ self.feature_windows = [
( 5 * MINUTE, 0 * MINUTE),
( 15 * MINUTE, 0 * MINUTE), ( 15 * MINUTE, 0 * MINUTE),
( 40 * MINUTE, 0 * MINUTE), ( 40 * MINUTE, 0 * MINUTE),
( 1 * HOUR, 0 * HOUR), ( 1 * HOUR, 0 * HOUR),

View File

@ -8,16 +8,16 @@ def main():
model.load_state_dict(torch.load('./pred/checkpoints/model_20250315_0530.pt')) model.load_state_dict(torch.load('./pred/checkpoints/model_20250315_0530.pt'))
model.eval() model.eval()
# inference # inference
initial = 999269 initial = 99906
last = initial last = initial
start_time = '2025-03-15 01:03:21' start_time = '2025-03-16 14:48:42'
for i in range(1, 48): for i in range(1, 48):
hour = i / 0.5 hour = i / 4
sec = hour * 3600 sec = hour * 3600
time_d = np.log2(sec) time_d = np.log2(sec)
data = [time_d, np.log2(initial+1), # time_delta, current_views data = [time_d, np.log2(initial+1), # time_delta, current_views
2.801318, 3.455128, 3.903391, 3.995577, 4.641488, 5.75131, 6.723868, 6.105322, 8.141023, 9.576701, 10.665067, # grows_feat 2.456146, 3.562719, 4.106399, 1.0, 1.0, 5.634413, 6.619818, 1.0, 8.608774, 10.19127, 11.412958, # grows_feat
0.043993, 0.72057, 28.000902 # time_feat 0.617153, 0.945308, 22.091431 # time_feat
] ]
np_arr = np.array([data]) np_arr = np.array([data])
tensor = torch.from_numpy(np_arr).to('cpu', dtype=torch.float32) tensor = torch.from_numpy(np_arr).to('cpu', dtype=torch.float32)