SEAGAN: an edge-aware graph attention network for node classification on A-Ci curve graphs.
Project description
SEAGAN
SEAGAN is an edge-aware Graph Attention Network (GAT) for node classification on A-Ci curve graphs. The packaged model uses two GAT layers with edge attributes and a weighted focal-loss training objective. For the bundled SEAGAN checkpoint, the focal lambda/gamma is 0.0.
Model Overview
SEAGAN represents each curve as a graph:
- Node features:
Ci,Anet, computedAc, and computedAj - Edge index: k-nearest-neighbor graph in the
[Ci, Anet]space - Edge features: pairwise differences
[dAc, dAj] - GAT layer 1: input dimension
4, output dimension64,5attention heads, dropout0.2 - GAT layer 2: input dimension
320, output dimension64,5attention heads, dropout0.2 - MLP head: maps
64hidden features to3node classes
The package includes the saved checkpoint:
EdgeGAT_checkpoint_G0_0_model_17.pt
Installation
For local development:
pip install -e .
For building the distribution:
python -m pip install -U build twine
python -m build
twine check dist/*
To upload after verifying the package:
twine upload dist/*
It is usually safest to test on TestPyPI first:
twine upload --repository testpypi dist/*
Quick Start
from seagan import build_graphs_from_df, load_pretrained_seagan, standardize_graphs_from_checkpoint
# df_points needs curve_id, Ci, Anet, and ID columns.
# df_params needs curve_id and Tleaf columns.
graphs, class_map = build_graphs_from_df(df_points, df_params)
model, checkpoint = load_pretrained_seagan()
graphs = standardize_graphs_from_checkpoint(graphs, checkpoint)
Run inference on a single graph:
from seagan import predict_graph
predicted_classes = predict_graph(model, graphs[0])
print(predicted_classes)
By default, predictions are returned as zero-indexed class ids (0, 1, 2). Add one_indexed=True to return labels as 1, 2, 3.
Expected Data Format
df_points should contain one row per point in a curve:
| column | meaning |
|---|---|
curve_id |
curve identifier |
Ci |
intercellular CO2 concentration |
Anet |
net assimilation |
ID |
node class label, commonly 1, 2, or 3 |
df_params should contain one row per curve:
| column | meaning |
|---|---|
curve_id |
curve identifier |
Tleaf |
leaf temperature in Celsius |
If curve_id is already the DataFrame index, the helper functions will use it directly.
Python API
from seagan import (
EdgeGAT,
compute_edge_Ac_Aj,
edge_index_knn_from_ci_anet,
make_edge_attr_from_edges,
build_graphs_single,
build_graphs_from_df,
focal_loss_multiclass,
load_pretrained_seagan,
predict_graph,
)
Repository Contents
src/seagan/: importable Python packagesrc/seagan/assets/: bundled SEAGAN checkpointGNN_FC_GAT_Focal.ipynb: original training and testing notebookFig5b_GAT_architecture.png: architecture overviewEdgeGAT_checkpoint_G0_0_model_17.pt: original saved checkpoint
Notes Before Public PyPI Release
- Confirm the final PyPI package name is available. If
seaganis taken, changeproject.nameinpyproject.toml. - Add the final license before public release if this will be open source.
- Add your email and project links in
pyproject.tomlif you want them displayed on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seagan-0.1.0.tar.gz.
File metadata
- Download URL: seagan-0.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bfd334bdae74054d073f3e7cd75ac2fc42a85ceed45124b39faa2697ae7c5d8
|
|
| MD5 |
0e77f75dbb9dc5429c55593bbe72b163
|
|
| BLAKE2b-256 |
a58e06f2634376c9bce603dbd8a8a149858b15bdec7606a83a035fb787f1eaa2
|
File details
Details for the file seagan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: seagan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 420.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c7d52f18dc9a9d663bb220dfc9d412299c2c1ddd51030abf8606c65357327bc
|
|
| MD5 |
b7cdc8ea9b260b86166204bad3d4d378
|
|
| BLAKE2b-256 |
20bef58412d0b96a161e881d7880bef39059938301521977470f7b1c6e379ace
|