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.4.tar.gz
(9.2 MB
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
File details
Details for the file tranpy_ai-0.1.4.tar.gz.
File metadata
- Download URL: tranpy_ai-0.1.4.tar.gz
- Upload date:
- Size: 9.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41aed90c5e7fabf9c20a742905c5ef2b827c39709203779cd7aa7f19173feccc
|
|
| MD5 |
06d2afe20e45eb1b7819ac13a9dd5c67
|
|
| BLAKE2b-256 |
e690fd3883eae9b42be85367f217e44d1deeeff98223d036ce01b67334f151db
|
File details
Details for the file tranpy_ai-0.1.4-py3-none-any.whl.
File metadata
- Download URL: tranpy_ai-0.1.4-py3-none-any.whl
- Upload date:
- Size: 9.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9037644851d2e8947d711bbcd426b36728ed7e6fdd78b806208b404d7cae434
|
|
| MD5 |
7e241721d5ca00cff331822d7f95dd66
|
|
| BLAKE2b-256 |
3507ce74cec38b19888e58908759e8ca5575b4ae74e52af19dfea98fcb99d3a9
|