StepShifter3 🛠️:
A general purpose Python package for time series analysis of tabular data
StepShifter3 is a Python package designed to facilitate time series analysis of tabular data. It is developed and maintained by the Peace Research Institute Oslo (PRIO) as part of the VIEWS project.
📚 Table of Contents
🛠 Installation
To install StepShifter3, you have two options:
-
Using pip: 📦
pip install StepShifter3
-
From GitHub: 🐱💻
git clone https://github.com/YourUsername/StepShifter3.git cd StepShifter3 python setup.py install
📝 Usage
The Stepshifter class is the main class of the package. It handles all models which is herited from the sklearn BaseEstimator class.
Basic Usage with XGBRegressor and dummy data from synthetic data generator
from StepShifter3 import StepShifter, SyntheticDataGenerator
from xgboost import XGBRegressor
# generates a pandas multiindex dataframe with dummy data Indexes: month_id, country_id
df = SyntheticDataGenerator("cm", 516, 60000, 242).generate_dataframe()
#initialize the StepShifter3 object with the relevant parameters:
# define some XGBRegressor parameters:
params_xgb_reg = {
'objective': 'reg:squarederror',
'n_estimators': 500,
'max_depth': 3,
'learning_rate': 0.1,
'n_jobs': -1,
'eval_metric': 'rmse',
'early_stopping_rounds': 30
}
stepshifter_config_xgb_reg = { "target_column" : "ln_ged_sb_dep",
"ID_columns" : ["month_id","country_id"],
"time_column" : "month_id",
"run_name" : 'xgb_reg_test_run_0',
"experiment_name" : 'xgb_reg_experiment_0',
"mlflow_tracking_uri" : 'http://127.0.0.1:5000',
"tau^e_0" : 121, # training period start
"tau^e_t" : 141, # training period end
"tau^e_c" : 146, # calibration period end
"tau^e_f" : 468, # forecast period end
"tau_f" : 516, # Test Forfecast end
"k": 13,
"S": 5,
"metrics_report": True,
"combine_method": 'mean_of_all',
}
# initialize class
stepshifter = StepShifter(XGBRegressor(**params_xgb_reg),df, stepshifter_config_xgb_reg)
# fit and predict
models = stepshifter.fit(stepshifter_config_xgb_reg['tau^e_0'],stepshifter_config_xgb_reg['tau^e_t'])
predictions = stepshifter.predict(stepshifter_config_xgb_reg['tau^e_t'],stepshifter_config_xgb_reg['tau^e_c'])
# Make model ensamble from training models and predict with a blended mean algorithm:
M_ssa = stepshifter.stepcombine()
X_test = stepshifter.X.loc[slice(136,136),slice(None),:]
# Make predictions for 1 and 3 months ahead of time:
blended_predictions = stepshifter.predict_ansamble(X_test,steps=[1,3])
Contributing
Contributions are welcome! To contribute:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please read our Contributing Guidelines for more information.
References
License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for stepshifter3 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stepshifter3-0.0.1.tar.gz | 12.7 kB | Without provenance | Details for stepshifter3-0.0.1.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stepshifter3-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for stepshifter3-0.0.1-py3-none-any.whl |
| stepshifter3-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for stepshifter3-0.0.1-py2.py3-none-any.whl |
Total release size: 35.3 kB
Release files / stepshifter3-0.0.1.tar.gz
| Download URL | stepshifter3-0.0.1.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b107b466a4e01d735aab746b7edaf761d60d72594b0cef5c119324ddfe778a5f
|
|
BLAKE2b-256 checksum How to use checksums |
9d3e8034b6613e3a9c01814353e2ca20ac4fe916f649745f691c78c8bff98644
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / stepshifter3-0.0.1-py3-none-any.whl
| Download URL | stepshifter3-0.0.1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45ef2dd7cdd033e9ffd10525b123a5c79933456adb46f62c2ed73b028275cd3e
|
|
BLAKE2b-256 checksum How to use checksums |
a8f7b2901be0cfd46a32d23a4d581d73ffbf2277e3b39493b18fae6386b54738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / stepshifter3-0.0.1-py2.py3-none-any.whl
| Download URL | stepshifter3-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d173e8ecded87decbb26ae8c6e88785876564cac6075d3eeafb9172fdbd83944
|
|
BLAKE2b-256 checksum How to use checksums |
c1a424f8bec828aedbfb315fd58d8c6e19326aa702bd3f895f751a02c30fbe3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for stepshifter3 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.