Skip to content

Commit

Permalink
refactor: Rename src to ibat (#51)
Browse files Browse the repository at this point in the history
* refactor: Rename src to ibat

* refactor: Rename src to ibat
  • Loading branch information
kajanan1212 authored May 12, 2024
1 parent 70f5a9a commit fe10fc2
Show file tree
Hide file tree
Showing 55 changed files with 51 additions and 53 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ setup-conda-env:

.PHONY: format
format:
./venv/bin/black ./src
./venv/bin/black ./ibat
./venv/bin/black ./examples

.PHONY: lint
lint:
./venv/bin/flake8 ./src
./venv/bin/flake8 ./ibat

.PHONY: clean
clean:
Expand Down
4 changes: 2 additions & 2 deletions examples/concept_drift_detector/adwin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd
from src.concept_drift_detector import CDD
from src.concept_drift_detector.strategies import ADWIN
from ibat.concept_drift_detector import CDD
from ibat.concept_drift_detector.strategies import ADWIN


sorted_mean_arrival_time = pd.read_csv("../../asserts/datasets/input.csv")
Expand Down
4 changes: 2 additions & 2 deletions examples/concept_drift_detector/ddm.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pandas as pd
from xgboost import XGBRegressor
from sklearn.pipeline import Pipeline
from src.concept_drift_detector import CDD
from src.concept_drift_detector.strategies import DDM
from ibat.concept_drift_detector import CDD
from ibat.concept_drift_detector.strategies import DDM


def split_train_test(split_date, df):
Expand Down
4 changes: 2 additions & 2 deletions examples/concept_drift_detector/page_hinkley.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd
from src.concept_drift_detector import CDD
from src.concept_drift_detector.strategies import PageHinkley
from ibat.concept_drift_detector import CDD
from ibat.concept_drift_detector.strategies import PageHinkley


sorted_mean_arrival_time = pd.read_csv("../../asserts/datasets/input.csv")
Expand Down
6 changes: 3 additions & 3 deletions examples/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from datetime import datetime

from src.concept_drift_detector.strategies import DDM
from src.datasets import BUS_654_FEATURES_ENCODED_DWELL_TIMES
from src.pipeline import run_dt_exp
from ibat.concept_drift_detector.strategies import DDM
from ibat.datasets import BUS_654_FEATURES_ENCODED_DWELL_TIMES
from ibat.pipeline import run_dt_exp


def datetime_from_string(datetime_string: str) -> datetime:
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/_pipeline.py → ibat/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
mean_absolute_percentage_error,
root_mean_squared_error,
)
from src.concept_drift_detector.strategies import IStrategy
from src.datasets import (
from ibat.concept_drift_detector.strategies import IStrategy
from ibat.datasets import (
BUS_654_FEATURES_ADDED_RUNNING_TIMES,
BUS_654_FEATURES_ENCODED_DWELL_TIMES,
)
from src.models.use_cases.arrival_time.bus import MME4BAT
from ibat.models.use_cases.arrival_time.bus import MME4BAT


def run_exp(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pandas import DataFrame
from src.concept_drift_detector.strategies.istrategy import IStrategy
from ibat.concept_drift_detector.strategies.istrategy import IStrategy

# from src.models.base_models import BaseModel
# from ibat.models.base_models import BaseModel


class CDD:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from river.drift import ADWIN as rADWIN
from matplotlib import gridspec, pyplot as plt
from src.concept_drift_detector.strategies.istrategy import IStrategy
from ibat.concept_drift_detector.strategies.istrategy import IStrategy


class ADWIN(IStrategy):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from sklearn.metrics import accuracy_score, mean_absolute_percentage_error, r2_score
from frouros.detectors.concept_drift import DDM as fDDM, DDMConfig
from frouros.metrics import PrequentialError
from src.concept_drift_detector.strategies.istrategy import IStrategy
from ibat.concept_drift_detector.strategies.istrategy import IStrategy

# from src.models.base_models import BaseModel
# from ibat.models.base_models import BaseModel


class DDM(IStrategy):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pandas import DataFrame

# from src.models.base_models.base_models import BaseModel
# from ibat.models.base_models.base_models import BaseModel


class IStrategy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from river.drift import PageHinkley as rPageHinkley
from matplotlib import gridspec, pyplot as plt
from src.concept_drift_detector.strategies.istrategy import IStrategy
from ibat.concept_drift_detector.strategies.istrategy import IStrategy


class PageHinkley(IStrategy):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 pandas import concat, DataFrame, Series
from xgboost import Booster, DMatrix, train
from river.stream import iter_pandas
from src.models.base_models.ibase_model import IBaseModel
from ibat.models.base_models.ibase_model import IBaseModel


class BaseModel(IBaseModel, ABC):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from river.tree import HoeffdingTreeClassifier
from river.ensemble import AdaBoostClassifier as ExAdaBoostClassifier
from src.models.base_models.base_models import RiverStreamBaseModel
from ibat.models.base_models.base_models import RiverStreamBaseModel


class AdaBoostClassifier(RiverStreamBaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from river.tree import ExtremelyFastDecisionTreeClassifier
from src.models.base_models.base_models import RiverStreamBaseModel
from ibat.models.base_models.base_models import RiverStreamBaseModel


class DecisionTreeClassifier(RiverStreamBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
HoeffdingTreeClassifier as ExHoeffdingTreeClassifier,
HoeffdingTreeRegressor as ExHoeffdingTreeRegressor,
)
from src.models.base_models.base_models import RiverStreamBaseModel
from ibat.models.base_models.base_models import RiverStreamBaseModel

"""
Tree-based models are popular due to their interpretability. Hoeffding Tree uses a tree data structure to model
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from river.forest import (ARFClassifier as ExARFClassifier, ARFRegressor as ExARFRegressor)
# from river.preprocessing import StandardScaler
# from src.models.base_models.base_models import RiverStreamBaseModel
# from ibat.models.base_models.base_models import RiverStreamBaseModel
#
# """
# The 3 most important aspects of ARF are:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from river.tree import SGTRegressor as ExSGTRegressor
from river.tree.splitter import DynamicQuantizer
from src.models.base_models.base_models import RiverStreamBaseModel
from ibat.models.base_models.base_models import RiverStreamBaseModel


class SGTRegressor(RiverStreamBaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from river.ensemble import SRPClassifier as ExSRPClassifier
from river.tree import HoeffdingTreeClassifier
from src.models.base_models.base_models import RiverStreamBaseModel
from ibat.models.base_models.base_models import RiverStreamBaseModel

"""
SRP is an ensemble method that simulates bagging or random subspaces.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from src.models.base_models.base_models import XGBoost
from ibat.models.base_models.base_models import XGBoost


class XGBClassifier(XGBoost):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
)
from river.optim import SGD
from river.preprocessing import StandardScaler
from src.models.base_models.base_models import RiverBatchBaseModel
from ibat.models.base_models.base_models import RiverBatchBaseModel


class LinearRegression(RiverBatchBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PassiveAggressiveClassifier as ExPassiveAggressiveClassifier,
PassiveAggressiveRegressor as ExPassiveAggressiveRegressor,
)
from src.models.base_models.base_models import SKLearnBaseModel
from ibat.models.base_models.base_models import SKLearnBaseModel


class PassiveAggressiveClassifier(SKLearnBaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sklearn.linear_model import Perceptron
from src.models.base_models.base_models import SKLearnBaseModel
from ibat.models.base_models.base_models import SKLearnBaseModel


class PerceptronClassifier(SKLearnBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SGDClassifier as ExSGDClassifier,
SGDRegressor as ExSGDRegressor,
)
from src.models.base_models.base_models import SKLearnBaseModel
from ibat.models.base_models.base_models import SKLearnBaseModel


class SGDClassifier(SKLearnBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BernoulliNB as ExBernoulliNB,
MultinomialNB as ExMultinomialNB,
)
from src.models.base_models.base_models import SKLearnBaseModel
from ibat.models.base_models.base_models import SKLearnBaseModel


class BernoulliNB(SKLearnBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BernoulliNB as ExBernoulliNB,
MultinomialNB as ExMultinomialNB,
)
from src.models.base_models.base_models import RiverBatchBaseModel
from ibat.models.base_models.base_models import RiverBatchBaseModel


class BernoulliNB(RiverBatchBaseModel):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
MLPClassifier as ExMLPClassifier,
MLPRegressor as ExMLPRegressor,
)
from src.models.base_models.base_models import SKLearnBaseModel
from ibat.models.base_models.base_models import SKLearnBaseModel


class MLPClassifier(SKLearnBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from river.neural_net.activations import ReLU
from river.optim import SGD
from river.preprocessing import StandardScaler
from src.models.base_models.base_models import RiverBatchBaseModel
from ibat.models.base_models.base_models import RiverBatchBaseModel


class MLPRegressor(RiverBatchBaseModel):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from copy import deepcopy
from typing import Optional

from src.concept_drift_detector import CDD
from src.concept_drift_detector.strategies import IStrategy
from src.models.base_models.ensemble.xgboost import XGBClassifier, XGBRegressor
from ibat.concept_drift_detector import CDD
from ibat.concept_drift_detector.strategies import IStrategy
from ibat.models.base_models.ensemble.xgboost import XGBClassifier, XGBRegressor


class MME4BAT:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from copy import deepcopy
from typing import Optional

from src.concept_drift_detector import CDD
from src.concept_drift_detector.strategies import IStrategy
from src.models.base_models.ensemble.xgboost import XGBClassifier, XGBRegressor
from ibat.concept_drift_detector import CDD
from ibat.concept_drift_detector.strategies import IStrategy
from ibat.models.base_models.ensemble.xgboost import XGBClassifier, XGBRegressor


class MME4BDT:
Expand Down
4 changes: 2 additions & 2 deletions src/pipeline.py → ibat/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
mean_absolute_error,
root_mean_squared_error,
)
from src.concept_drift_detector.strategies import IStrategy
from src.models.use_cases.dwell_time.bus import MME4BDT
from ibat.concept_drift_detector.strategies import IStrategy
from ibat.models.use_cases.dwell_time.bus import MME4BDT


def run_dt_exp(
Expand Down
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup
from codecs import open
from os import path


HERE = path.abspath(path.dirname(__file__))

with open(path.join(HERE, "README.md"), "r", encoding='utf-8') as f:
with open(path.join(HERE, "README.md"), "r", encoding="utf-8") as f:
long_description = f.read()

with open(path.join(HERE, "requirements.txt"), "r", encoding='utf-8') as f:
with open(path.join(HERE, "requirements.txt"), "r", encoding="utf-8") as f:
requirements = f.read().splitlines()

classifiers = [
Expand Down Expand Up @@ -40,19 +40,17 @@
"Incremental learning",
],
author="Aaivu",
author_email='[email protected]',
author_email="[email protected]",
license="MIT",
python_requires=">=3.9",
classifiers=classifiers,
packages=find_packages(where="src"),
package_dir={"": "src"},
packages=find_packages(exclude=["tests", "tests.*"]),
include_package_data=True,
install_requires=requirements,
project_urls={
"Homepage": "https://github.com/aaivu/ibat",
"Source Code": "https://github.com/aaivu/ibat",
"Download": "https://github.com/aaivu/ibat/releases",
"Documentation": "https://github.com/aaivu/ibat/blob/master/README.md",
"Bug Tracker": "https://github.com/aaivu/ibat/issues",
}
},
)

0 comments on commit fe10fc2

Please sign in to comment.