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.3.tar.gz
(62.0 kB
view details)
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
tranpy_ai-0.1.3-py3-none-any.whl
(65.8 kB
view details)
File details
Details for the file tranpy_ai-0.1.3.tar.gz.
File metadata
- Download URL: tranpy_ai-0.1.3.tar.gz
- Upload date:
- Size: 62.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd7ee8fc7ad748f2113d5c9fbabd5c736d409939c7187fef8dbafd5c11e9a52
|
|
| MD5 |
e77e3a3298ed0d69acee9ac3e6584499
|
|
| BLAKE2b-256 |
751095037cc601643eade6dc563303d895069818ed936741b82a016014db3232
|
File details
Details for the file tranpy_ai-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tranpy_ai-0.1.3-py3-none-any.whl
- Upload date:
- Size: 65.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bb75e44680afade3db151696e06b0563b0afcd4ff08aa549346fc8016ac03b5
|
|
| MD5 |
d9370586678671914a120163457ec3f0
|
|
| BLAKE2b-256 |
c58d00f15dea8e005aae6bae4c758e9d6cd357cf00c9bce41126deb1dc12ff47
|