Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update pandas version #51 #52

Merged
merged 6 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] # add windows-2019 when poetry allows installation with `-f` flag
python-version: [3.8, 3.9]
tf-version: [2.4.1, 2.8.1, 2.10.1]
python-version: [3.9, '3.11']
tf-version: [2.13.1, 2.15.1]

exclude:
- python-version: 3.9
tf-version: 2.4.1
tf-version: 2.13.1

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -67,6 +67,7 @@ jobs:
run: |
poetry install --no-interaction --no-root
poetry run python -m pip install tensorflow==${{ matrix.tf-version }}
poetry run python -m pip install matplotlib

- name: Run unittest
shell: bash
Expand Down Expand Up @@ -100,7 +101,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.9

- name: Cache pip
uses: actions/cache@v2
Expand Down
7 changes: 6 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ coverage:
status:
project:
default:
threshold: 0.2%
threshold: 1%

patch:
default:
enabled: false
changes: no
3 changes: 2 additions & 1 deletion docs/requirements_docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ sphinx-autobuild
cloudpickle

pandas >= 1.3
tensorflow>=2.10.0
numpy < 2
tensorflow==2.10.0
matplotlib
optuna>=2.0
scikit-learn>0.23
4,453 changes: 1,908 additions & 2,545 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
Expand All @@ -53,15 +53,12 @@ documentation = "https://time-series-prediction.readthedocs.io"
homepage = "https://time-series-prediction.readthedocs.io"

[tool.poetry.dependencies]
python = ">=3.7.1,<3.11"
python = ">=3.8,<=3.12"

optuna = "^2.3.0"
pandas = "^1.2.0"
numpy = "*"
matplotlib = "*"
tensorflow = "^2.4.1" # better install independently,
pandas = ">=1.3.0"

[tool.poetry.dev-dependencies]
tensorflow = "^2.3.1" # better install independently,
[tool.poetry.group.dev.dependencies]

# checks and make tools
pre-commit = "^2.20.0"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import unittest

import matplotlib.pyplot as plt
import tensorflow as tf

import tfts
Expand All @@ -23,7 +22,8 @@ def test_demo(self):
trainer.train((x_train, y_train), (x_valid, y_valid), n_epochs=3)

pred = trainer.predict(x_valid)
trainer.plot(history=x_valid, true=y_valid, pred=pred)
# trainer.plot(history=x_valid, true=y_valid, pred=pred)
print(pred)

def test_demo2(self):
train_length = 24
Expand All @@ -37,8 +37,8 @@ def test_demo2(self):
trainer.train((x_train, y_train), n_epochs=3)

pred = trainer.predict(x_valid)
trainer.plot(history=x_valid, true=y_valid, pred=pred)
# plt.show()
# trainer.plot(history=x_valid, true=y_valid, pred=pred)
print(pred)

# def test_auto_model(self):
# predict_length = 2
Expand Down
4 changes: 1 addition & 3 deletions tests/test_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ def test_tuner(self):
print(train[0].shape, valid[0].shape)

config = AutoConfig("rnn").get_config()

tuner = AutoTuner("rnn")
tuner.run(config)
print(config)
7 changes: 4 additions & 3 deletions tfts/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Type, Union

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
Expand All @@ -20,7 +19,7 @@ def __init__(
self,
model: Union[tf.keras.Model, tf.keras.Sequential],
loss_fn: Union[Callable] = tf.keras.losses.MeanSquaredError(),
optimizer: tf.keras.optimizers = tf.keras.optimizers.Adam(0.003),
optimizer: tf.keras.optimizers = tf.keras.optimizers.legacy.Adam(0.003),
lr_scheduler: Optional[tf.keras.optimizers.Optimizer] = None,
strategy: Optional[tf.keras.optimizers.schedules.LearningRateSchedule] = None,
**kwargs: Dict[str, Any]
Expand Down Expand Up @@ -218,7 +217,7 @@ def __init__(
self,
model: Union[tf.keras.Model, tf.keras.Sequential],
loss_fn: Union[Callable] = tf.keras.losses.MeanSquaredError(),
optimizer: tf.keras.optimizers = tf.keras.optimizers.Adam(0.003),
optimizer: tf.keras.optimizers = tf.keras.optimizers.legacy.Adam(0.003),
lr_scheduler: Optional[tf.keras.optimizers.Optimizer] = None,
strategy: Optional[tf.keras.optimizers.schedules.LearningRateSchedule] = None,
run_eagerly: bool = True,
Expand Down Expand Up @@ -353,6 +352,8 @@ def save_model(self, model_dir, only_pb: bool = True, checkpoint_dir: Optional[s
return

def plot(self, history, true, pred):
import matplotlib.pyplot as plt

train_length = history.shape[1]
pred_length = true.shape[1]
example = np.random.choice(range(history.shape[0]))
Expand Down
5 changes: 4 additions & 1 deletion tfts/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Type, Union

import numpy as np
import optuna

from tfts.models.auto_config import AutoConfig
from tfts.models.auto_model import AutoModel
Expand All @@ -18,7 +17,11 @@ def __init__(self, use_model: str) -> None:
self.use_model = use_model

def generate_parameter(self) -> None:
import optuna

return

def run(self, config, direction: str = "maximize") -> None:
import optuna

return
Loading