tsad-model-selection icon indicating copy to clipboard operation
tsad-model-selection copied to clipboard

Error in test_rank_models.ipynb

Open MaNingning825 opened this issue 1 year ago • 1 comments

I got an error when running to models_performance_matrix = rankingObj.evaluate_models(n_repeats=1, n_neighbors=[4], split='test', synthetic_ranking_criterion='f1', n_splits=100) in test_rank_models.ipynb

100%|██████████| 1/1 [00:00<00:00, 47.78it/s]
100%|██████████| 1/1 [00:00<00:00, 379.82it/s]
100%|██████████| 1/1 [00:00<00:00, 427.47it/s]
100%|██████████| 1/1 [00:00<00:00, 164.86it/s]
100%|██████████| 1/1 [00:00<00:00, 690.76it/s]
100%|██████████| 1/1 [00:00<00:00, 417.30it/s]
100%|██████████| 1/1 [00:00<00:00, 255.89it/s]
100%|██████████| 1/1 [00:00<00:00, 233.47it/s]
100%|██████████| 1/1 [00:00<00:00, 420.02it/s]
100%|██████████| 1/1 [00:00<00:00, 351.19it/s]
100%|██████████| 1/1 [00:00<00:00, 354.73it/s]
100%|██████████| 1/1 [00:00<00:00, 323.81it/s]
100%|██████████| 1/1 [00:00<00:00, 126.06it/s]
100%|██████████| 1/1 [00:00<00:00, 614.73it/s]
100%|██████████| 1/1 [00:00<00:00, 331.64it/s]
100%|██████████| 1/1 [00:00<00:00, 251.20it/s]
100%|██████████| 1/1 [00:00<00:00, 239.74it/s]
100%|██████████| 1/1 [00:00<00:00, 347.12it/s]
100%|██████████| 1/1 [00:00<00:00, 305.80it/s]
100%|██████████| 1/1 [00:00<00:00, 288.37it/s]
100%|██████████| 1/1 [00:00<00:00, 409.96it/s]
100%|██████████| 1/1 [00:00<00:00, 132.98it/s]
100%|██████████| 1/1 [00:00<00:00, 543.59it/s]
100%|██████████| 1/1 [00:00<00:00, 307.32it/s]
100%|██████████| 1/1 [00:00<00:00, 177.56it/s]
...
100%|██████████| 1/1 [00:00<00:00, 244.30it/s]
100%|██████████| 1/1 [00:00<00:00, 180.50it/s]
100%|██████████| 1/1 [00:00<00:00, 236.63it/s]
 47%|████▋     | 9/19 [01:16<01:24,  8.45s/it]
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?9a6e42cd-0069-456c-81d2-91c3176149b9) or open in a [text editor](command:workbench.action.openLargeOutput?9a6e42cd-0069-456c-81d2-91c3176149b9). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/home/lad-model-selection/tsad-model-selection/tests/test_rank_models.ipynb](https://vscode-remote+ssh-002dremote-002b10-002e140-002e32-002e207.vscode-resource.vscode-cdn.net/home/backup/maningning/lad-model-selection/tsad-model-selection/tests/test_rank_models.ipynb) 单元格 6 line 1
----> [1](vscode-notebook-cell://ssh-remote%2B10.140.32.207/home/backup/maningning/lad-model-selection/tsad-model-selection/tests/test_rank_models.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) models_performance_matrix = rankingObj.evaluate_models(n_repeats=1, n_neighbors=[4], split='test', synthetic_ranking_criterion='f1', n_splits=100)

File [/home/backup/maningning/lad-model-selection/tsad-model-selection/tests/../src/tsadams/model_selection/model_selection.py:107](https://vscode-remote+ssh-002dremote-002b10-002e140-002e32-002e207.vscode-resource.vscode-cdn.net/home/backup/maningning/lad-model-selection/tsad-model-selection/src/tsadams/model_selection/model_selection.py:107), in RankModels.evaluate_models(self, n_neighbors, n_repeats, split, synthetic_ranking_criterion, n_splits, sliding_window)
    103 for model_name in tqdm(self.MODEL_NAMES):
    104     with open(
    105             os.path.join(self.TRAINED_MODELS_PATH,
    106                          f'{model_name}.pth'), 'rb') as f:
--> 107         model = t.load(f)
    108     model.eval()  # Set model in evaluation mode
    110     eval_batch_size = get_eval_batchsizes(model_name=model_name)

File [~/miniconda3/envs/tsadams/lib/python3.9/site-packages/torch/serialization.py:712](https://vscode-remote+ssh-002dremote-002b10-002e140-002e32-002e207.vscode-resource.vscode-cdn.net/home/backup/maningning/lad-model-selection/tsad-model-selection/tests/~/miniconda3/envs/tsadams/lib/python3.9/site-packages/torch/serialization.py:712), in load(f, map_location, pickle_module, **pickle_load_args)
    710             opened_file.seek(orig_position)
    711             return torch.jit.load(opened_file)
--> 712         return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
    713 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)

File [~/miniconda3/envs/tsadams/lib/python3.9/site-packages/torch/serialization.py:1046](https://vscode-remote+ssh-002dremote-002b10-002e140-002e32-002e207.vscode-resource.vscode-cdn.net/home/backup/maningning/lad-model-selection/tsad-model-selection/tests/~/miniconda3/envs/tsadams/lib/python3.9/site-packages/torch/serialization.py:1046), in _load(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args)
   1044 unpickler = UnpicklerWrapper(data_file, **pickle_load_args)
   1045 unpickler.persistent_load = persistent_load
-> 1046 result = unpickler.load()
   1048 torch._utils._validate_loaded_sparse_tensors()
...
   1037         pass
   1038 mod_name = load_module_mapping.get(mod_name, mod_name)
-> 1039 return super().find_class(mod_name, name)

AttributeError: Can't get attribute 'EuclideanDistance64' on <module 'sklearn.metrics._dist_metrics' from '/home/metis/miniconda3/envs/tsadams/lib/python3.9/site-packages/sklearn/metrics/_dist_metrics.cpython-39-x86_64-linux-gnu.so'>
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?51006656-6231-4c6a-b4dc-450b34a7bb08) or open in a [text editor](command:workbench.action.openLargeOutput?51006656-6231-4c6a-b4dc-450b34a7bb08). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

MaNingning825 avatar Oct 25 '23 07:10 MaNingning825