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

Changed all imports to be relative. Moved prsdk out of src folder #16

Merged
merged 3 commits into from
Jul 31, 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
6 changes: 2 additions & 4 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PWD/src/prsdk" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with PyLint
run: pylint ./src/prsdk
run: pylint ./prsdk
- name: Lint with Flake8
run: flake8 ./src/prsdk
run: flake8 ./prsdk
- name: Run unit tests
run: python -m unittest

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from huggingface_hub import HfApi, snapshot_download

from persistence.persistors.persistor import Persistor
from prsdk.persistence.persistors.persistor import Persistor


class HuggingFacePersistor(Persistor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from abc import ABC, abstractmethod

from persistence.serializers.serializer import Serializer
from prsdk.persistence.serializers.serializer import Serializer


class Persistor(ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import joblib
import torch

from persistence.serializers.serializer import Serializer
from predictors.neural_network.torch_neural_net import TorchNeuralNet
from predictors.neural_network.neural_net_predictor import NeuralNetPredictor
from prsdk.persistence.serializers.serializer import Serializer
from prsdk.predictors.neural_network.torch_neural_net import TorchNeuralNet
from prsdk.predictors.neural_network.neural_net_predictor import NeuralNetPredictor


class NeuralNetSerializer(Serializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import joblib

from persistence.serializers.serializer import Serializer
from predictors.sklearn_predictors.sklearn_predictor import SKLearnPredictor
from prsdk.persistence.serializers.serializer import Serializer
from prsdk.predictors.sklearn_predictors.sklearn_predictor import SKLearnPredictor


class SKLearnSerializer(Serializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter

from data.torch_data import TorchDataset
from predictors.predictor import Predictor
from predictors.neural_network.torch_neural_net import TorchNeuralNet
from prsdk.data.torch_data import TorchDataset
from prsdk.predictors.predictor import Predictor
from prsdk.predictors.neural_network.torch_neural_net import TorchNeuralNet


# pylint: disable=too-many-instance-attributes
Expand Down Expand Up @@ -189,7 +189,7 @@ def predict(self, context_actions_df: pd.DataFrame) -> pd.DataFrame:
:return: DataFrame of predictions properly labeled and indexed.
"""
X_test_scaled = self.scaler.transform(context_actions_df[self.features])
test_ds = TorchDataset(X_test_scaled, np.zeros(len(X_test_scaled)))
test_ds = TorchDataset(X_test_scaled, np.zeros(len(X_test_scaled)), device=self.device)
test_dl = DataLoader(test_ds, self.batch_size, shuffle=False)
pred_list = []
with torch.no_grad():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from sklearn.linear_model import LinearRegression

from predictors.sklearn_predictors.sklearn_predictor import SKLearnPredictor
from prsdk.predictors.sklearn_predictors.sklearn_predictor import SKLearnPredictor


class LinearRegressionPredictor(SKLearnPredictor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from sklearn.ensemble import RandomForestRegressor

from predictors.sklearn_predictors.sklearn_predictor import SKLearnPredictor
from prsdk.predictors.sklearn_predictors.sklearn_predictor import SKLearnPredictor


class RandomForestPredictor(SKLearnPredictor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pandas as pd

from predictors.predictor import Predictor
from prsdk.predictors.predictor import Predictor


class SKLearnPredictor(Predictor, ABC):
Expand Down
6 changes: 3 additions & 3 deletions tests/persistence/test_hf_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import numpy as np
import pandas as pd

from persistence.persistors.hf_persistor import HuggingFacePersistor
from persistence.serializers.neural_network_serializer import NeuralNetSerializer
from predictors.neural_network.neural_net_predictor import NeuralNetPredictor
from prsdk.persistence.persistors.hf_persistor import HuggingFacePersistor
from prsdk.persistence.serializers.neural_network_serializer import NeuralNetSerializer
from prsdk.predictors.neural_network.neural_net_predictor import NeuralNetPredictor


class TestHuggingFacePersistence(unittest.TestCase):
Expand Down
10 changes: 5 additions & 5 deletions tests/persistence/test_predictor_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import pandas as pd

from persistence.serializers.neural_network_serializer import NeuralNetSerializer
from persistence.serializers.sklearn_serializer import SKLearnSerializer
from predictors.neural_network.neural_net_predictor import NeuralNetPredictor
from predictors.sklearn_predictors.linear_regression_predictor import LinearRegressionPredictor
from predictors.sklearn_predictors.random_forest_predictor import RandomForestPredictor
from prsdk.persistence.serializers.neural_network_serializer import NeuralNetSerializer
from prsdk.persistence.serializers.sklearn_serializer import SKLearnSerializer
from prsdk.predictors.neural_network.neural_net_predictor import NeuralNetPredictor
from prsdk.predictors.sklearn_predictors.linear_regression_predictor import LinearRegressionPredictor
from prsdk.predictors.sklearn_predictors.random_forest_predictor import RandomForestPredictor


class TestPredictorSerialization(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/predictors/test_neural_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pandas as pd

from predictors.neural_network.neural_net_predictor import NeuralNetPredictor
from prsdk.predictors.neural_network.neural_net_predictor import NeuralNetPredictor


class TestNeuralNet(unittest.TestCase):
Expand Down
17 changes: 0 additions & 17 deletions tests/test_dummy.py

This file was deleted.

Loading