Skip to main content

wavetrainer

PyPi

A library for automatically finding the optimal model within feature and hyperparameter space on time series models.

wavetrain

Dependencies :globe_with_meridians:

Python 3.11.6:

Raison D'être :thought_balloon:

wavetrainer aims to split out the various aspects of creating a good model into different composable pieces and searches the space of these different pieces to find an optimal model. This came about after doing code like this multiple times on multiple projects. This is specifically geared towards time series models, validating itself through walk-forward analysis.

Architecture :triangular_ruler:

wavetrainer is an object orientated library. The entities are organised like so:

  • Trainer: A sklearn compatible object that can fit and predict data.
    • Reducer: An object that can reduce the feature space based on heuristics.
    • Weights: An object that adds weights to the features.
    • Selector: An object that can select which features to include from the training set.
    • Calibrator: An object that can calibrate the probabilities produced by the model.
    • Model: An object that represents the underlying model architecture being used.
    • Windower: An object that represents the lookback window of the data.

Installation :inbox_tray:

This is a python package hosted on pypi, so to install simply run the following command:

pip install wavetrainer

or install using this local repository:

python setup.py install --old-and-unmanageable

Usage example :eyes:

The use of wavetrainer is entirely through code due to it being a library. It attempts to hide most of its complexity from the user, so it only has a few functions of relevance in its outward API.

Training

To train a model:

import wavetrainer as wt
import pandas as pd
import numpy as np
import random

data_size = 10
df = pd.DataFrame(
    np.random.randint(0, 30, size=data_size),
    columns=["X"],
    index=pd.date_range("20180101", periods=data_size),
)
df["Y"] = [random.choice([True, False]) for _ in range(data_size)]

X = df["X"]
Y = df["Y"]

wavetrainer = wt.create("my_wavetrain")
wavetrainer = wavetrainer.fit(X, y=Y)

This will save it to the folder my_wavetrain.

Load

To load a trainer (as well as its composite states):

import wavetrainer as wt

wavetrainer = wt.load("my_wavetrain")

Predict

To make a prediction from new data:

import wavetrainer as wt
import pandas as pd
import numpy as np

wavetrainer = wt.load("my_wavetrain")
data_size = 1
df = pd.DataFrame(
    np.random.randint(0, 30, size=data_size),
    columns=["X"],
    index=pd.date_range("20180101", periods=data_size),
)
X = df["X"]

preds = wavetrainer.predict(X)

preds will now contain both the predictions and the probabilities associated with those predictions.

License :memo:

The project is available under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wavetrainer-0.3.22.tar.gz (45.5 kB view details)

Uploaded Source

File details

Details for the file wavetrainer-0.3.22.tar.gz.

File metadata

  • Download URL: wavetrainer-0.3.22.tar.gz
  • Upload date:
  • Size: 45.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for wavetrainer-0.3.22.tar.gz
Algorithm Hash digest
SHA256 bb455628ba74d1205e53cf7ecff6b0bffdf1b31c748659f99e24881004c9da2d
MD5 a87c536982dbe3988fde7536387de915
BLAKE2b-256 a98d529cb927d23375f228e1cd838621c07757a23ea76d9c3d0a549b1f3bc0f4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.22 This release

1 file

0.3.21

1 file

0.3.20

1 file

0.3.19

1 file

0.3.18

1 file

0.3.17

1 file

0.3.16

1 file

0.3.15

1 file

0.3.14

1 file

0.3.13

1 file

0.3.12

1 file

0.3.11

1 file

0.3.10

1 file

0.3.9

1 file

0.3.8

1 file

0.3.7

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.45

1 file

0.2.44

1 file

0.2.43

1 file

0.2.42

1 file

0.2.41

1 file

0.2.40

1 file

0.2.39

1 file

0.2.38

1 file

0.2.37

1 file

0.2.36

1 file

0.2.35

1 file

0.2.34

1 file

0.2.33

1 file

0.2.32

1 file

0.2.31

1 file

0.2.30

1 file

0.2.29

1 file

0.2.28

1 file

0.2.27

1 file

0.2.26

1 file

0.2.25

1 file

0.2.24

1 file

0.2.23

1 file

0.2.22

1 file

0.2.21

1 file

0.2.20

1 file

0.2.19

1 file

0.2.18

1 file

0.2.17

1 file

0.2.16

1 file

0.2.15

1 file

0.2.14

1 file

0.2.13

1 file

0.2.12

1 file

0.2.11

1 file

0.2.10

1 file

0.2.9

1 file

0.2.8

1 file

0.2.7

1 file

0.2.6

1 file

0.2.5

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.21

1 file

0.1.20

1 file

0.1.19

1 file

0.1.18

1 file

0.1.17

1 file

0.1.16

1 file

0.1.15

1 file

0.1.14

1 file

0.1.13

1 file

0.1.12

1 file

0.1.11

1 file

0.1.10

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

0.0.52

1 file

0.0.51

1 file

0.0.50

1 file

0.0.49

1 file

0.0.48

1 file

0.0.47

1 file

0.0.46

1 file

0.0.45

1 file

0.0.44

1 file

0.0.43

1 file

0.0.42

1 file

0.0.41

1 file

0.0.40

1 file

0.0.39

1 file

0.0.38

1 file

0.0.37

1 file

0.0.36

1 file

0.0.35

1 file

0.0.34

1 file

0.0.33

1 file

0.0.32

1 file

0.0.31

1 file

0.0.30

1 file

0.0.29

1 file

0.0.28

1 file

0.0.27

1 file

0.0.26

1 file

0.0.25

1 file

0.0.24

1 file

0.0.23

1 file

0.0.22

1 file

0.0.21

1 file

0.0.20

1 file

0.0.19

1 file

0.0.18

1 file

0.0.17

1 file

0.0.16

1 file

0.0.15

1 file

0.0.14

1 file

0.0.13

1 file

0.0.12

1 file

0.0.11

1 file

0.0.10

1 file

0.0.9

1 file

0.0.8

1 file

0.0.7

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page