From 082d7e8407b1f73f1b7f3b1a3082e0ccf4783c5a Mon Sep 17 00:00:00 2001 From: Roman Joeres Date: Mon, 19 Aug 2024 16:06:44 +0200 Subject: [PATCH] Started full downstream training --- configs/downstream/all.yaml | 96 ++++++++++++++++++------------------- gifflar/metrics.py | 2 + gifflar/utils.py | 4 +- 3 files changed, 52 insertions(+), 50 deletions(-) diff --git a/configs/downstream/all.yaml b/configs/downstream/all.yaml index e9255b2..d5bd024 100644 --- a/configs/downstream/all.yaml +++ b/configs/downstream/all.yaml @@ -9,30 +9,30 @@ datasets: task: classification - name: Taxonomy_Domain task: multilabel - #- name: Taxonomy_Kingdom - # task: multilabel - #- name: Taxonomy_Phylum - # task: multilabel - #- name: Taxonomy_Class - # task: multilabel - #- name: Taxonomy_Order - # task: multilabel - #- name: Taxonomy_Family - # task: multilabel - #- name: Taxonomy_Genus - # task: multilabel - #- name: Taxonomy_Species - # task: multilabel + - name: Taxonomy_Kingdom + task: multilabel + - name: Taxonomy_Phylum + task: multilabel + - name: Taxonomy_Class + task: multilabel + - name: Taxonomy_Order + task: multilabel + - name: Taxonomy_Family + task: multilabel + - name: Taxonomy_Genus + task: multilabel + - name: Taxonomy_Species + task: multilabel pre-transforms: model: - #- name: rf - # n_estimators: 500 - # n_jobs: -1 - # random_state: 42 - #- name: svm - # random_state: 42 - #- name: xgb - # random_state: 42 + - name: rf + n_estimators: 500 + n_jobs: -1 + random_state: 42 + - name: svm + random_state: 42 + - name: xgb + random_state: 42 - name: mlp hidden_dim: 1024 batch_size: 256 @@ -41,29 +41,29 @@ model: patience: 30 learning_rate: 0 optimizer: Adam - #- name: sweetnet - # hidden_dim: 1024 - # batch_size: 512 - # num_layers: 16 - # epochs: 1 - # patience: 30 - # learning_rate: 0.001 - # optimizer: Adam - # suffix: - #- name: gnngly - # hidden_dim: 1024 - # batch_size: 512 - # num_layers: 8 - # epochs: 1 - # patience: 30 - # learning_rate: 0.001 - # optimizer: Adam - # suffix: - #- name: gifflar - # hidden_dim: 1024 - # batch_size: 256 - # num_layers: 8 - # epochs: 100 - # learning_rate: 0.001 - # optimizer: Adam - # suffix: + - name: sweetnet + hidden_dim: 1024 + batch_size: 512 + num_layers: 16 + epochs: 100 + patience: 30 + learning_rate: 0.001 + optimizer: Adam + suffix: + - name: gnngly + hidden_dim: 1024 + batch_size: 512 + num_layers: 8 + epochs: 100 + patience: 30 + learning_rate: 0.001 + optimizer: Adam + suffix: + - name: gifflar + hidden_dim: 1024 + batch_size: 256 + num_layers: 8 + epochs: 100 + learning_rate: 0.001 + optimizer: Adam + suffix: diff --git a/gifflar/metrics.py b/gifflar/metrics.py index d23945f..b52bbb2 100644 --- a/gifflar/metrics.py +++ b/gifflar/metrics.py @@ -10,6 +10,8 @@ def __init__(self, threshold=0.5, dist_sync_on_step=False, **kwargs): self.add_state("false_negatives", default=torch.tensor(0), dist_reduce_fx="sum") def update(self, preds: torch.Tensor, target: torch.Tensor): + print(preds.shape) + print(target.shape) preds = (preds > self.threshold).int() target = target.int() diff --git a/gifflar/utils.py b/gifflar/utils.py index 73987cb..08a6768 100644 --- a/gifflar/utils.py +++ b/gifflar/utils.py @@ -15,7 +15,7 @@ from sklearn.svm import LinearSVR, SVC, SVR from torchmetrics import MetricCollection, Accuracy, AUROC, MatthewsCorrCoef, MeanAbsoluteError, MeanSquaredError, \ R2Score -from gifflar.metrics import Sensitivity +from gifflar.sensitivity import Sensitivity # MASK: +1 | Other: +2 => len(...) | len(...) + 1 @@ -116,7 +116,7 @@ def get_metrics( Accuracy(**metric_args), AUROC(**metric_args), MatthewsCorrCoef(**metric_args), - # Sensitivity(**metric_args), + Sensitivity(**metric_args), ]) return {"train": m.clone(prefix="train/"), "val": m.clone(prefix="val/"), "test": m.clone(prefix="test/")}