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.1.tar.gz
(61.9 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.1-py3-none-any.whl
(65.7 kB
view details)
File details
Details for the file tranpy_ai-0.1.1.tar.gz.
File metadata
- Download URL: tranpy_ai-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bc32b00ca6403ad22df582c1876bda900b7b26327abb9d0cc8e615869036584
|
|
| MD5 |
7a3974290f5ed688fd878a864cda07f2
|
|
| BLAKE2b-256 |
61a25e88f3108f34674d7f1dbf1e994c21773aff4ad839c7ad2fe9a3e578d57b
|
File details
Details for the file tranpy_ai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tranpy_ai-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7564615137240bc33b663e96af12308a576254f807b8d31cb31a6a5a7bcb47d
|
|
| MD5 |
29a3eaa165541211f571ee3c43f41cbe
|
|
| BLAKE2b-256 |
85ba59f90f207e2984e18a4ca30bb5b6086b4a92acf7f8246e08099ab81b480e
|