lecrapaud 0.1.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lecrapaud might be problematic. Click here for more details.

lecrapaud/config.py CHANGED
@@ -22,4 +22,5 @@ DB_PASSWORD = (
22
22
  DB_HOST = os.getenv("TEST_DB_HOST") if PYTHON_ENV == "Test" else os.getenv("DB_HOST")
23
23
  DB_PORT = os.getenv("TEST_DB_PORT") if PYTHON_ENV == "Test" else os.getenv("DB_PORT")
24
24
  DB_NAME = os.getenv("TEST_DB_NAME") if PYTHON_ENV == "Test" else os.getenv("DB_NAME")
25
+ DB_URI = os.getenv("DB_URI", None)
25
26
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
lecrapaud/db/session.py CHANGED
@@ -3,20 +3,30 @@
3
3
  from contextlib import contextmanager
4
4
  from sqlalchemy import create_engine, text
5
5
  from sqlalchemy.orm import sessionmaker
6
- from lecrapaud.config import DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_NAME
6
+ from urllib.parse import urlparse
7
+
8
+ from lecrapaud.config import DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_NAME, DB_URI
7
9
 
8
10
  _engine = None
9
11
  _SessionLocal = None
10
- DATABASE_URL = f"mysql+pymysql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
12
+ DATABASE_URL = (
13
+ f"mysql+pymysql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" or DB_URI
14
+ )
11
15
 
12
16
 
13
17
  def init_db(uri: str = None):
14
18
  global _engine, _SessionLocal
15
19
 
20
+ uri = uri if uri else DATABASE_URL
21
+ # Extract DB name from URI to connect without it
22
+ parsed = urlparse(uri)
23
+ db_name = parsed.path.lstrip("/") # remove leading slash
24
+
25
+ # Build root engine (no database in URI)
26
+ root_uri = uri.replace(f"/{db_name}", "/")
27
+
16
28
  # Step 1: Connect to MySQL without a database
17
- root_engine = create_engine(
18
- uri if uri else f"mysql+pymysql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/"
19
- )
29
+ root_engine = create_engine(root_uri)
20
30
 
21
31
  # Step 2: Create database if it doesn't exist
22
32
  with root_engine.connect() as conn:
@@ -24,7 +34,7 @@ def init_db(uri: str = None):
24
34
  conn.commit()
25
35
 
26
36
  # Step 3: Connect to the newly created database
27
- _engine = create_engine(DATABASE_URL, echo=False)
37
+ _engine = create_engine(uri, echo=False)
28
38
 
29
39
  # Step 4: Create session factory
30
40
  _SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=_engine)
@@ -589,7 +589,6 @@ class PreprocessFeature:
589
589
 
590
590
  if transformer:
591
591
  transformed = transformer.transform(X)
592
- print(len(transformed), len(transformed[0]))
593
592
  else:
594
593
  transformer = ColumnTransformer(
595
594
  transformers=[
@@ -811,12 +811,10 @@ class PreprocessModel:
811
811
  if duplicates:
812
812
  raise ValueError(f"Doublons détectés dans columns_to_keep: {duplicates}")
813
813
 
814
- logger.info(self.all_features)
815
-
816
814
  self.train = train[columns_to_keep]
817
- if val:
815
+ if isinstance(val, pd.DataFrame):
818
816
  self.val = val[columns_to_keep]
819
- if test:
817
+ if isinstance(test, pd.DataFrame):
820
818
  self.test = test[columns_to_keep]
821
819
 
822
820
  def run(self):
@@ -894,12 +894,9 @@ class ModelSelectionEngine:
894
894
  # instantiate model
895
895
  model = ModelEngine(
896
896
  model_name=model_name,
897
- recurrent=recurrent,
898
- need_scaling=need_scaling,
899
897
  search_params=config["search_params"],
900
898
  target_type=self.target_type,
901
899
  create_model=config["create_model"],
902
- scaler_y=self.scaler_y,
903
900
  plot=self.plot,
904
901
  log_dir=log_dir,
905
902
  )
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.3
2
+ Name: lecrapaud
3
+ Version: 0.2.1
4
+ Summary: Framework for machine and deep learning, with regression, classification and time series analysis
5
+ License: Apache License
6
+ Author: Pierre H. Gallet
7
+ Requires-Python: ==3.12.*
8
+ Classifier: License :: Other/Proprietary License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Requires-Dist: backoff (>=2.2.1)
12
+ Requires-Dist: category-encoders (>=2.8.1)
13
+ Requires-Dist: celery (>=5.5.1)
14
+ Requires-Dist: curl-cffi (>=0.11.1)
15
+ Requires-Dist: deep-translator (>=1.11.4)
16
+ Requires-Dist: degiro-connector (>=3.0.26)
17
+ Requires-Dist: fake-useragent (>=2.1.0)
18
+ Requires-Dist: ftfy (>=6.3.1)
19
+ Requires-Dist: honeybadger (>=0.21)
20
+ Requires-Dist: joblib (>=1.4.2)
21
+ Requires-Dist: keras (>=3.9.0)
22
+ Requires-Dist: keras-tcn (>=3.1.2)
23
+ Requires-Dist: lightgbm (>=4.6.0)
24
+ Requires-Dist: matplotlib (>=3.10.1)
25
+ Requires-Dist: mlxtend (>=0.23.4)
26
+ Requires-Dist: numpy (>=2.1.3)
27
+ Requires-Dist: openai (>=1.86.0)
28
+ Requires-Dist: pandas (>=2.2.3)
29
+ Requires-Dist: pandas-market-calendars (>=4.6.1)
30
+ Requires-Dist: playwright (>=1.52.0)
31
+ Requires-Dist: pydantic (>=2.10.6)
32
+ Requires-Dist: python-dotenv (>=1.0.1)
33
+ Requires-Dist: pytz (>=2025.1)
34
+ Requires-Dist: ratelimit (>=2.2.1)
35
+ Requires-Dist: scikit-learn (>=1.6.1)
36
+ Requires-Dist: scipy (>=1.15.2)
37
+ Requires-Dist: seaborn (>=0.13.2)
38
+ Requires-Dist: sentence-transformers (>=3.4.1)
39
+ Requires-Dist: sqlalchemy (>=2.0.39)
40
+ Requires-Dist: tensorboardx (>=2.6.2.2)
41
+ Requires-Dist: tensorflow (>=2.19.0)
42
+ Requires-Dist: tf-keras (>=2.19.0)
43
+ Requires-Dist: tiktoken (>=0.9.0)
44
+ Requires-Dist: tqdm (>=4.67.1)
45
+ Requires-Dist: xgboost (>=3.0.0)
46
+ Requires-Dist: yahoo-fin (>=0.8.9.1)
47
+ Requires-Dist: yfinance (>=0.2.55)
48
+ Description-Content-Type: text/markdown
49
+
50
+ <div align="center">
51
+
52
+ <div style="font-size:50rem;">🐸</div>
53
+
54
+ ## Welcome to LeCrapaud
55
+
56
+ **An all-in-one machine learning framework**
57
+
58
+ </div>
59
+
60
+ ## 🚀 Introduction
61
+
62
+ LeCrapaud is a high-level Python library for end-to-end machine learning workflows on tabular data, with a focus on financial and stock datasets. It provides a simple API to handle feature engineering, model selection, training, and prediction, all in a reproducible and modular way.
63
+
64
+ ## ✨ Key Features
65
+
66
+ - 🧩 Modular pipeline: Feature engineering, preprocessing, selection, and modeling as independent steps
67
+ - 🤖 Automated model selection and hyperparameter optimization
68
+ - 📊 Easy integration with pandas DataFrames
69
+ - 🔬 Supports both regression and classification tasks
70
+ - 🛠️ Simple API for both full pipeline and step-by-step usage
71
+ - 📦 Ready for production and research workflows
72
+
73
+ ## ⚡ Quick Start
74
+
75
+
76
+ ### ⚙️ Install the package
77
+
78
+ ```sh
79
+ pip install lecrapaud
80
+ ```
81
+
82
+ ### 🛠️ How it works
83
+
84
+ This package provides a high-level API to manage experiments for feature engineering, model selection, and prediction on tabular data (e.g. stock data).
85
+
86
+ ### Typical workflow
87
+
88
+ ```python
89
+ from lecrapaud import LeCrapaud
90
+
91
+ # 1. Create the main app
92
+ app = LeCrapaud()
93
+
94
+ # 2. Define your experiment context (see your notebook or api.py for all options)
95
+ context = {
96
+ "data": your_dataframe,
97
+ "columns_drop": [...],
98
+ "columns_date": [...],
99
+ # ... other config options
100
+ }
101
+
102
+ # 3. Create an experiment
103
+ experiment = app.create_experiment(**context)
104
+
105
+ # 4. Run the full training pipeline
106
+ experiment.train(your_dataframe)
107
+
108
+ # 5. Make predictions on new data
109
+ predictions = experiment.predict(new_data)
110
+ ```
111
+
112
+ ### Modular usage
113
+
114
+ You can also use each step independently:
115
+
116
+ ```python
117
+ data_eng = experiment.feature_engineering(data)
118
+ train, val, test = experiment.preprocess_feature(data_eng)
119
+ features = experiment.feature_selection(train)
120
+ std_data, reshaped_data = experiment.preprocess_model(train, val, test)
121
+ experiment.model_selection(std_data, reshaped_data)
122
+ ```
123
+
124
+ ## 🤝 Contributing
125
+
126
+ ### Reminders for Github usage
127
+
128
+ 1. Creating Github repository
129
+
130
+ ```sh
131
+ $ brew install gh
132
+ $ gh auth login
133
+ $ gh repo create
134
+ ```
135
+
136
+ 2. Initializing git and first commit to distant repository
137
+
138
+ ```sh
139
+ $ git init
140
+ $ git add .
141
+ $ git commit -m 'first commit'
142
+ $ git remote add origin <YOUR_REPO_URL>
143
+ $ git push -u origin master
144
+ ```
145
+
146
+ 3. Use conventional commits
147
+ https://www.conventionalcommits.org/en/v1.0.0/#summary
148
+
149
+ 4. Create environment
150
+
151
+ ```sh
152
+ $ pip install virtualenv
153
+ $ python -m venv .venv
154
+ $ source .venv/bin/activate
155
+ ```
156
+
157
+ 5. Install dependencies
158
+
159
+ ```sh
160
+ $ make install
161
+ ```
162
+
163
+ 6. Deactivate virtualenv (if needed)
164
+
165
+ ```sh
166
+ $ deactivate
167
+ ```
168
+
169
+ ---
170
+
171
+ Pierre Gallet © 2025
@@ -1,6 +1,6 @@
1
1
  lecrapaud/__init__.py,sha256=oCxbtw_nk8rlOXbXbWo0RRMlsh6w-hTiZ6e5PRG_wp0,28
2
2
  lecrapaud/api.py,sha256=VpVj6zRanLzHo2bwbkar-HcOKsJPEDghWhxbrqDOxp4,9749
3
- lecrapaud/config.py,sha256=NMHQw98wqnva9uVaheJH1Peq6QmssvGkFECwi0tYb90,992
3
+ lecrapaud/config.py,sha256=Jf7kknumJ9NudVoLugOxqLqB7zTSl67IVV2VVWA0Pv4,1027
4
4
  lecrapaud/db/__init__.py,sha256=82o9fMfaqKXPh2_rt44EzNRVZV1R4LScEnQYvj_TjK0,34
5
5
  lecrapaud/db/alembic/README,sha256=MVlc9TYmr57RbhXET6QxgyCcwWP7w-vLkEsirENqiIQ,38
6
6
  lecrapaud/db/alembic/env.py,sha256=OwO56oeL7o3XQe2pnhMxK9C3Yeoz-ZCnGUSnXkNU-rg,2164
@@ -32,17 +32,17 @@ lecrapaud/db/models/model_selection.py,sha256=Lj2WZBWvaVpJeDjdiAs8wvkoI-XrWv2IIj
32
32
  lecrapaud/db/models/model_training.py,sha256=2xv9SOh8IUV1ROSsKlooAGanl9G8nBdmr7vaV4GAWtw,1618
33
33
  lecrapaud/db/models/score.py,sha256=I6kA55ZQhReo9dA_JEgeRSqDoFKmYyL3l-zCffwsofs,1719
34
34
  lecrapaud/db/models/target.py,sha256=scEtXVO3oysEvg9uwm_ncsS3-4o2A6z6XiDVGrg5WHE,1644
35
- lecrapaud/db/session.py,sha256=lk_H-oCWgvK8HKahyk96HBgWp0SLw7PCeaOgCgg8aPc,1387
35
+ lecrapaud/db/session.py,sha256=eD3zNodgC_ZEiNrSnhooMsaMiyccK9xgeReABWrbAuk,1629
36
36
  lecrapaud/directory_management.py,sha256=wrHmAJ-cBKb0GhJifxrb_RoLhZJX8xdkeirrWs7jQHk,791
37
37
  lecrapaud/experiment.py,sha256=8Y7HX5MGifrcquOML1lYXG-q40Wn4WBBRqLfPs1tLuk,1994
38
- lecrapaud/feature_engineering.py,sha256=jlqqUeRj4SnCpklZdnXkEpwFGaz3S-fy8frAuDOFcpc,30384
39
- lecrapaud/feature_selection.py,sha256=N8yRhx544hk__rJV-MFq28IetVwhev4iKHruBalYpjU,43011
38
+ lecrapaud/feature_engineering.py,sha256=zia2qxe_KLBUZV2KYVPqGd2K55AjHiyeeCm_GhobJHE,30327
39
+ lecrapaud/feature_selection.py,sha256=2h3S_c0hYZM-EKenpVRYTFFqT4T7fg2lJ5pY2gUDalk,43023
40
40
  lecrapaud/integrations/openai_integration.py,sha256=hHLF3fk5Bps8KNbNrEL3NUFa945jwClE6LrLpuMZOd4,7459
41
41
  lecrapaud/jobs/__init__.py,sha256=ZkrsyTOR21c_wN7RY8jPhm8jCrL1oCEtTsf3VFIlQiE,292
42
42
  lecrapaud/jobs/config.py,sha256=AmO0j3RFjx8H66dfKw_7vnshaOJb9Ox5BAZ9cwwLFMY,377
43
43
  lecrapaud/jobs/scheduler.py,sha256=SiYWPxokpKnR8V6btLOO6gbK0PEjSRoeG0kCbQvYPf4,990
44
44
  lecrapaud/jobs/tasks.py,sha256=evzhOHpgp6Gvoz__jUipi-_HSNny7bWgAauHv2Hpxyk,1640
45
- lecrapaud/model_selection.py,sha256=500OZaZ2hRfn54WES0uVijbGedJzXMxiE_4Gp5Lpvp4,61273
45
+ lecrapaud/model_selection.py,sha256=3BGp9mM9pZECcEcxLvm5YBJZ9Q7CJxZEC2zVWOm9g2o,61153
46
46
  lecrapaud/predictions.py,sha256=Uw6Ghm05KcoZIB1m9YLBe4v7sV42_Hv1oPgYfKsF2iY,10754
47
47
  lecrapaud/preprocessing.py,sha256=GfOTdVpubf9w13bbgKjcx12oP3mefaTgm1HK1V3tVeQ,34424
48
48
  lecrapaud/search_space.py,sha256=6kVXDSmvpTuLKTlqQkKIzrJOM2P7HpqRiO3PR37VrsM,34123
@@ -57,7 +57,7 @@ lecrapaud/speed_tests/tests.ipynb,sha256=RjI7LDHSsbadUkea_hT14sD7ivljtIQk4NB5McX
57
57
  lecrapaud/speed_tests/trash.py,sha256=E4zrrRyVqeNEumWg8rYKquR9VTIULN52eCRqjmv_s58,1647
58
58
  lecrapaud/training.py,sha256=a-p-06-h-oRj5A728-xwekHZ7mxTnrPnKjAjoZhNZME,8071
59
59
  lecrapaud/utils.py,sha256=J2lMRo8J1CoZ1AYIPcdbFWXg-PxtQTs8qmeINioXWfk,8107
60
- lecrapaud-0.1.0.dist-info/LICENSE,sha256=MImCryu0AnqhJE_uAZD-PIDKXDKb8sT7v0i1NOYeHTM,11350
61
- lecrapaud-0.1.0.dist-info/METADATA,sha256=k3hj1_rsu1xXKg5wQIWtgpIVEzvxOQ3lnJRkvS08fOw,2519
62
- lecrapaud-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
- lecrapaud-0.1.0.dist-info/RECORD,,
60
+ lecrapaud-0.2.1.dist-info/LICENSE,sha256=MImCryu0AnqhJE_uAZD-PIDKXDKb8sT7v0i1NOYeHTM,11350
61
+ lecrapaud-0.2.1.dist-info/METADATA,sha256=g2qZx1kl3Qf1GT7LE-NNmTOwJluyZel0tgL1FCSYmt4,4460
62
+ lecrapaud-0.2.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
+ lecrapaud-0.2.1.dist-info/RECORD,,
@@ -1,105 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: lecrapaud
3
- Version: 0.1.0
4
- Summary: Framework for machine and deep learning, with regression, classification and time series analysis
5
- License: Apache License
6
- Author: Pierre H. Gallet
7
- Requires-Python: ==3.12.*
8
- Classifier: License :: Other/Proprietary License
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.12
11
- Requires-Dist: backoff (>=2.2.1)
12
- Requires-Dist: category-encoders (>=2.8.1)
13
- Requires-Dist: celery (>=5.5.1)
14
- Requires-Dist: curl-cffi (>=0.11.1)
15
- Requires-Dist: deep-translator (>=1.11.4)
16
- Requires-Dist: degiro-connector (>=3.0.26)
17
- Requires-Dist: fake-useragent (>=2.1.0)
18
- Requires-Dist: ftfy (>=6.3.1)
19
- Requires-Dist: honeybadger (>=0.21)
20
- Requires-Dist: joblib (>=1.4.2)
21
- Requires-Dist: keras (>=3.9.0)
22
- Requires-Dist: keras-tcn (>=3.1.2)
23
- Requires-Dist: lightgbm (>=4.6.0)
24
- Requires-Dist: matplotlib (>=3.10.1)
25
- Requires-Dist: mlxtend (>=0.23.4)
26
- Requires-Dist: numpy (>=2.1.3)
27
- Requires-Dist: openai (>=1.86.0)
28
- Requires-Dist: pandas (>=2.2.3)
29
- Requires-Dist: pandas-market-calendars (>=4.6.1)
30
- Requires-Dist: playwright (>=1.52.0)
31
- Requires-Dist: pydantic (>=2.10.6)
32
- Requires-Dist: python-dotenv (>=1.0.1)
33
- Requires-Dist: pytz (>=2025.1)
34
- Requires-Dist: ratelimit (>=2.2.1)
35
- Requires-Dist: scikit-learn (>=1.6.1)
36
- Requires-Dist: scipy (>=1.15.2)
37
- Requires-Dist: seaborn (>=0.13.2)
38
- Requires-Dist: sentence-transformers (>=3.4.1)
39
- Requires-Dist: sqlalchemy (>=2.0.39)
40
- Requires-Dist: tensorboardx (>=2.6.2.2)
41
- Requires-Dist: tensorflow (>=2.19.0)
42
- Requires-Dist: tf-keras (>=2.19.0)
43
- Requires-Dist: tiktoken (>=0.9.0)
44
- Requires-Dist: tqdm (>=4.67.1)
45
- Requires-Dist: xgboost (>=3.0.0)
46
- Requires-Dist: yahoo-fin (>=0.8.9.1)
47
- Requires-Dist: yfinance (>=0.2.55)
48
- Description-Content-Type: text/markdown
49
-
50
- # Stock
51
-
52
- ## Overview
53
-
54
- ## Project description
55
-
56
- ## Quick Start
57
-
58
- 1. Create environment
59
-
60
- ```sh
61
- $ pip install virtualenv
62
- $ python -m venv .venv
63
- $ source .venv/bin/activate
64
- ```
65
-
66
- 2. Install dependencies
67
-
68
- ```sh
69
- $ pip install -r requirements.txt
70
- $ pip freeze > requirements.txt
71
- ```
72
-
73
- 3. Deactivate virtualenv (if needed)
74
-
75
- ```sh
76
- $ deactivate
77
- ```
78
-
79
- ## Reminders for Github usage
80
-
81
- 1. Creating Github repository
82
-
83
- ```sh
84
- $ brew install gh
85
- $ gh auth login
86
- $ gh repo create
87
- ```
88
-
89
- 2. Initializing git and first commit to distant repository
90
-
91
- ```sh
92
- $ git init
93
- $ git add .
94
- $ git commit -m 'first commit'
95
- $ git remote add origin <YOUR_REPO_URL>
96
- $ git push -u origin master
97
- ```
98
-
99
- 3. use conventional commits
100
- https://www.conventionalcommits.org/en/v1.0.0/#summary
101
-
102
-
103
- ***
104
-
105
- Pierre Gallet © 2024