Skip to main content

Power System Transient Stability Analysis with Machine Learning and Explainability

Project description

TranPy

Machine learning tool for power system transient stability analysis with a simple, sklearn-style API.

Quick Start

pip install tranpy
from tranpy.datasets import load_newengland
from tranpy.models import SVMClassifier

X_train, X_test, y_train, y_test = load_newengland(test_size=0.2, random_state=42)
model = SVMClassifier(kernel='rbf')
model.fit(X_train, y_train)

accuracy = model.score(X_test, y_test)
print(f"Accuracy: {accuracy:.4f}")

results = model.evaluate(X_test, y_test, verbose=True)

XAI

from tranpy.explainers import SHAPExplainer

# Create explainer
explainer = SHAPExplainer(model, X_train, X_test)

# Generate global explanations
shap_values = explainer.explain_global()

# Visualize
explainer.plot_summary(save_path='shap_summary.png')

# Important features
top_features = explainer.get_top_features(n_features=10)
print(top_features)
``

Check out the [examples/](examples/) directory for Jupyter notebooks:

- `01_load_dataset.ipynb`
- `02_train_models.ipynb`
- `03_explainability.ipynb`
- `04_generate_data.ipynb` - > Requires PowerFactory local installation

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

tranpy_ai-0.1.0.tar.gz (61.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tranpy_ai-0.1.0-py3-none-any.whl (65.7 kB view details)

Uploaded Python 3

File details

Details for the file tranpy_ai-0.1.0.tar.gz.

File metadata

  • Download URL: tranpy_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 61.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tranpy_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b27f260d5e27f4632aa7b6634c6a4cc776bb006e53f11492e72f5463c7c7228a
MD5 960ffb0d34b7f31321726a28f0bbb88c
BLAKE2b-256 ffa05ecb7938fe5df39a0fcd8826f300a5424469c9681782d2c1df083f4409d9

See more details on using hashes here.

File details

Details for the file tranpy_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tranpy_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 65.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tranpy_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2f43efcecdcdd641189e05fa088d4e01f2b8daad6da01a227c823c02bbd27d0
MD5 25c828634c292c0810d56dc423a51f66
BLAKE2b-256 808bb2e14fadfa37d1509c86cdce7af418bea162865396e7d41bc21a16ab5cee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page