Skip to content

Commit

Permalink
created experiment runner -- experimental version.
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnstRoell committed May 20, 2024
1 parent b952d5d commit 8b5fe28
Show file tree
Hide file tree
Showing 664 changed files with 60,538 additions and 189 deletions.
17 changes: 17 additions & 0 deletions configs/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
task: betti_numbers
model:
model_name: GCN
hidden_channels: 64
num_hidden_layers: 3
num_node_features: 8
out_channels: 3
trainer:
accelerator: cpu
max_epochs: 1
log_every_n_steps: 1
litmodel:
learning_rate: 0.01
data:
transforms: random_node_features
use_stratified: false
seed: 1234
18 changes: 18 additions & 0 deletions configs/gcn_betti_numbers_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
task: betti_numbers
model:
model_name: GCN
hidden_channels: 64
num_hidden_layers: 3
num_node_features: 9
out_channels: 3

trainer:
accelerator: auto
max_epochs: 100
log_every_n_steps: 1

litmodel:
learning_rate: .01

data:
use_stratified: False
18 changes: 18 additions & 0 deletions configs/gcn_name_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
task: name
model:
model_name: GCN
hidden_channels: 64
num_hidden_layers: 3
num_node_features: 1
out_channels: 5

trainer:
accelerator: auto
max_epochs: 100
log_every_n_steps: 1

litmodel:
learning_rate: .01

data:
use_stratified: True
18 changes: 18 additions & 0 deletions configs/gcn_orientability_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
task: orientability
model:
model_name: GCN
hidden_channels: 64
num_hidden_layers: 3
num_node_features: 1
out_channels: 1

trainer:
accelerator: auto
max_epochs: 100
log_every_n_steps: 1

litmodel:
learning_rate: .01

data:
use_stratified: True
20 changes: 20 additions & 0 deletions configs/gcn_orientability_random_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
task: orientability
model:
model_name: GCN
hidden_channels: 64
num_hidden_layers: 3
num_node_features: 8
out_channels: 1

trainer:
accelerator: cpu
max_epochs: 100
log_every_n_steps: 1

litmodel:
learning_rate: .01

data:
transforms: random_node_features
use_stratified: False
seed: 1234
64 changes: 53 additions & 11 deletions experiment_betti_gnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-25T17:47:32.798261Z",
Expand All @@ -20,6 +20,7 @@
" TriangulationToFaceTransform,\n",
" OrientableToClassTransform,\n",
" DegreeTransform,\n",
" degree_transform\n",
")\n",
"from validation.validate_homology import validate_betti_numbers\n",
"\n",
Expand All @@ -31,6 +32,57 @@
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"tensor([[0., 0., 0., 1., 0., 0., 0., 0., 0.],\n",
" [0., 0., 0., 1., 0., 0., 0., 0., 0.],\n",
" [0., 0., 0., 1., 0., 0., 0., 0., 0.],\n",
" [0., 0., 0., 1., 0., 0., 0., 0., 0.],\n",
" [1., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
" [1., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
" [1., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
" [1., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
" [1., 0., 0., 0., 0., 0., 0., 0., 0.]])\n"
]
}
],
"source": [
"tr = transforms.Compose(\n",
" [\n",
" TriangulationToFaceTransform(),\n",
" FaceToEdge(remove_faces=False),\n",
" DegreeTransform(),\n",
" OrientableToClassTransform(),\n",
" OneHotDegree(max_degree=8, cat=False),\n",
" ]\n",
")\n",
"\n",
"class TriangulationToFaceTransform:\n",
" def __call__(self, data):\n",
" data.face = torch.tensor(data.triangulation).T - 1\n",
" data.num_nodes = 9\n",
" data.triangulation = None\n",
" return data\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"dataset = SimplicialDataset(root=\"./data\",transform=tr)\n",
"dl = DataLoader(dataset, batch_size=1) \n",
"\n",
"for batch in dl:\n",
" print(batch.x)\n",
" break\n"
]
},
{
"cell_type": "code",
"execution_count": 56,
Expand Down Expand Up @@ -63,17 +115,7 @@
}
],
"source": [
"tr = transforms.Compose(\n",
" [\n",
" TriangulationToFaceTransform(),\n",
" FaceToEdge(remove_faces=False),\n",
" DegreeTransform(),\n",
" OrientableToClassTransform(),\n",
" OneHotDegree(max_degree=8, cat=False),\n",
" ]\n",
")\n",
"\n",
"dataset = SimplicialDataset(root=\"./data\", transform=tr)\n",
"\n",
"\n",
"print()\n",
Expand Down
2 changes: 1 addition & 1 deletion experiments/betti_numbers/graphs/GATSimplex2Vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
DegreeTransform,
Simplex2VecTransform,
)
from models.graphs.GAT import GATNetwork
from models.GAT import GATNetwork


class GATSimplexToVecModule(GraphCommonModuleBettiNumbers):
Expand Down
2 changes: 1 addition & 1 deletion experiments/betti_numbers/graphs/GCN.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from mantra.simplicial import SimplicialDataset
from mantra.transforms import TriangulationToFaceTransform, DegreeTransform
from models.graphs.GCN import GCNetwork
from models.GCN import GCNetwork


class GCNModule(GraphCommonModuleBettiNumbers):
Expand Down
2 changes: 1 addition & 1 deletion experiments/betti_numbers/graphs/TAG.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from mantra.simplicial import SimplicialDataset
from mantra.transforms import TriangulationToFaceTransform, DegreeTransform
from models.graphs.TAG import TAGNetwork
from models.TAG import TAGNetwork


class TAGModule(GraphCommonModuleBettiNumbers):
Expand Down
2 changes: 1 addition & 1 deletion experiments/betti_numbers/graphs/TransformerConv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from mantra.simplicial import SimplicialDataset
from mantra.transforms import TriangulationToFaceTransform, DegreeTransform
from models.graphs.TransformerConv import TransformerConvNetwork
from models.TransformerConv import TransformerConvNetwork


class TransformerConvModule(GraphCommonModuleBettiNumbers):
Expand Down
2 changes: 1 addition & 1 deletion experiments/betti_numbers/others/MLPConstantShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)
from mantra.simplicial import SimplicialDataset
from mantra.transforms import DegreeTransform, TriangulationToFaceTransform
from models.others.MLPConstantShape import MLPConstantShape
from models.MLPConstantShape import MLPConstantShape


class MLPModule(BaseBettiNumbersModule):
Expand Down
2 changes: 1 addition & 1 deletion experiments/name/graphs/GATSimplex2Vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Simplex2VecTransform,
NameToClassTransform,
)
from models.graphs.GAT import GATNetwork
from models.GAT import GATNetwork


class GATSimplexToVecModule(GraphCommonModuleName):
Expand Down
2 changes: 1 addition & 1 deletion experiments/name/graphs/GCN.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DegreeTransform,
TriangulationToFaceTransform,
)
from models.graphs.GCN import GCNetwork
from models.GCN import GCNetwork


class GCNModule(GraphCommonModuleName):
Expand Down
2 changes: 1 addition & 1 deletion experiments/name/graphs/TAG.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DegreeTransform,
NameToClassTransform,
)
from models.graphs.TAG import TAGNetwork
from models.TAG import TAGNetwork


class TAGModule(GraphCommonModuleName):
Expand Down
2 changes: 1 addition & 1 deletion experiments/name/graphs/TransformerConv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DegreeTransform,
NameToClassTransform,
)
from models.graphs.TransformerConv import TransformerConvNetwork
from models.TransformerConv import TransformerConvNetwork


class TransformerConvModule(GraphCommonModuleName):
Expand Down
2 changes: 1 addition & 1 deletion experiments/name/others/MLPConstantShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TriangulationToFaceTransform,
NameToClassTransform,
)
from models.others.MLPConstantShape import MLPConstantShape
from models.MLPConstantShape import MLPConstantShape


class MLPModule(BaseClassificationModule):
Expand Down
2 changes: 1 addition & 1 deletion experiments/orientability/graphs/GATSimplex2Vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
OrientableToClassTransform,
Simplex2VecTransform,
)
from models.graphs.GAT import GATNetwork
from models.GAT import GATNetwork


class GATSimplexToVecModule(GraphCommonModuleOrientability):
Expand Down
2 changes: 1 addition & 1 deletion experiments/orientability/graphs/GCN.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DegreeTransform,
OrientableToClassTransform,
)
from models.graphs.GCN import GCNetwork
from models.GCN import GCNetwork


class GCNModule(GraphCommonModuleOrientability):
Expand Down
2 changes: 1 addition & 1 deletion experiments/orientability/graphs/TAG.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DegreeTransform,
OrientableToClassTransform,
)
from models.graphs.TAG import TAGNetwork
from models.TAG import TAGNetwork


class TAGModule(GraphCommonModuleOrientability):
Expand Down
2 changes: 1 addition & 1 deletion experiments/orientability/graphs/TransformerConv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DegreeTransform,
OrientableToClassTransform,
)
from models.graphs.TransformerConv import TransformerConvNetwork
from models.TransformerConv import TransformerConvNetwork


class TransformerConvModule(GraphCommonModuleOrientability):
Expand Down
2 changes: 1 addition & 1 deletion experiments/orientability/others/MLPConstantShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TriangulationToFaceTransform,
OrientableToClassTransform,
)
from models.others.MLPConstantShape import MLPConstantShape
from models.MLPConstantShape import MLPConstantShape


class MLPModule(BaseClassificationModule):
Expand Down
Loading

0 comments on commit 8b5fe28

Please sign in to comment.