lecrapaud 0.1.0__tar.gz → 0.2.0__tar.gz

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.

Files changed (64) hide show
  1. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/PKG-INFO +70 -11
  2. lecrapaud-0.2.0/README.md +115 -0
  3. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/config.py +1 -0
  4. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/session.py +16 -6
  5. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/feature_engineering.py +0 -1
  6. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/feature_selection.py +2 -4
  7. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/pyproject.toml +1 -1
  8. lecrapaud-0.1.0/README.md +0 -56
  9. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/LICENSE +0 -0
  10. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/__init__.py +0 -0
  11. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/api.py +0 -0
  12. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/__init__.py +0 -0
  13. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/README +0 -0
  14. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/env.py +0 -0
  15. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/script.py.mako +0 -0
  16. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_04_06_1738-7390745388e4_initial_setup.py +0 -0
  17. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_04_06_1755-40cd8d3e798e_unique_constraint_for_data.py +0 -0
  18. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_23_1724-2360941fa0bd_longer_string.py +0 -0
  19. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_27_1159-b96396dcfaff_add_env_to_trading_tables.py +0 -0
  20. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_27_1337-40cbfc215f7c_fix_nb_character_on_portfolio.py +0 -0
  21. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_27_1526-3de994115317_to_datetime.py +0 -0
  22. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_27_2003-25c227c684f8_add_fees_to_transactions.py +0 -0
  23. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_27_2047-6b6f2d38e9bc_double_instead_of_float.py +0 -0
  24. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_31_1111-c175e4a36d68_generalise_stock_to_group.py +0 -0
  25. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_31_1256-5681095bfc27_create_investment_run_and_portfolio_.py +0 -0
  26. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_31_1806-339927587383_add_investment_run_id.py +0 -0
  27. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_31_1834-52b809a34371_make_nullablee.py +0 -0
  28. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_31_1849-3b8550297e8e_change_date_to_datetime.py +0 -0
  29. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_05_31_1852-e6b8c95d8243_add_date_to_portfolio_history.py +0 -0
  30. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_06_10_1136-db8cdd83563a_addnewsandoptiontodata.py +0 -0
  31. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/alembic/versions/2025_06_17_1652-c45f5e49fa2c_make_fields_nullable.py +0 -0
  32. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/__init__.py +0 -0
  33. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/base.py +0 -0
  34. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/dataset.py +0 -0
  35. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/feature.py +0 -0
  36. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/feature_selection.py +0 -0
  37. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/feature_selection_rank.py +0 -0
  38. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/model.py +0 -0
  39. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/model_selection.py +0 -0
  40. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/model_training.py +0 -0
  41. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/score.py +0 -0
  42. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/db/models/target.py +0 -0
  43. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/directory_management.py +0 -0
  44. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/experiment.py +0 -0
  45. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/integrations/openai_integration.py +0 -0
  46. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/jobs/__init__.py +0 -0
  47. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/jobs/config.py +0 -0
  48. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/jobs/scheduler.py +0 -0
  49. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/jobs/tasks.py +0 -0
  50. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/model_selection.py +0 -0
  51. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/predictions.py +0 -0
  52. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/preprocessing.py +0 -0
  53. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/search_space.py +0 -0
  54. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/services/__init__.py +0 -0
  55. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/services/embedding_categorical.py +0 -0
  56. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/services/indicators.py +0 -0
  57. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/speed_tests/experiments.py +0 -0
  58. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/speed_tests/test-gpu-bilstm.ipynb +0 -0
  59. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/speed_tests/test-gpu-resnet.ipynb +0 -0
  60. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/speed_tests/test-gpu-transformers.ipynb +0 -0
  61. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/speed_tests/tests.ipynb +0 -0
  62. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/speed_tests/trash.py +0 -0
  63. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/training.py +0 -0
  64. {lecrapaud-0.1.0 → lecrapaud-0.2.0}/lecrapaud/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lecrapaud
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Framework for machine and deep learning, with regression, classification and time series analysis
5
5
  License: Apache License
6
6
  Author: Pierre H. Gallet
@@ -47,13 +47,30 @@ Requires-Dist: yahoo-fin (>=0.8.9.1)
47
47
  Requires-Dist: yfinance (>=0.2.55)
48
48
  Description-Content-Type: text/markdown
49
49
 
50
- # Stock
50
+ <div align="center">
51
51
 
52
- ## Overview
52
+ # 🐸
53
53
 
54
- ## Project description
54
+ ## Welcome to LeCrapaud
55
55
 
56
- ## Quick Start
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
57
74
 
58
75
  1. Create environment
59
76
 
@@ -66,8 +83,7 @@ $ source .venv/bin/activate
66
83
  2. Install dependencies
67
84
 
68
85
  ```sh
69
- $ pip install -r requirements.txt
70
- $ pip freeze > requirements.txt
86
+ $ make install
71
87
  ```
72
88
 
73
89
  3. Deactivate virtualenv (if needed)
@@ -76,7 +92,51 @@ $ pip freeze > requirements.txt
76
92
  $ deactivate
77
93
  ```
78
94
 
79
- ## Reminders for Github usage
95
+ ## 🛠️ How it works
96
+
97
+ This package provides a high-level API to manage experiments for feature engineering, model selection, and prediction on tabular data (e.g. stock data).
98
+
99
+ ### Typical workflow
100
+
101
+ ```python
102
+ from lecrapaud.api import LeCrapaud
103
+
104
+ # 1. Create the main app
105
+ app = LeCrapaud()
106
+
107
+ # 2. Define your experiment context (see your notebook or api.py for all options)
108
+ context = {
109
+ "data": your_dataframe,
110
+ "columns_drop": [...],
111
+ "columns_date": [...],
112
+ # ... other config options
113
+ }
114
+
115
+ # 3. Create an experiment
116
+ experiment = app.create_experiment(**context)
117
+
118
+ # 4. Run the full training pipeline
119
+ experiment.train(your_dataframe)
120
+
121
+ # 5. Make predictions on new data
122
+ predictions = experiment.predict(new_data)
123
+ ```
124
+
125
+ ### Modular usage
126
+
127
+ You can also use each step independently:
128
+
129
+ ```python
130
+ data_eng = experiment.feature_engineering(data)
131
+ train, val, test = experiment.preprocess_feature(data_eng)
132
+ features = experiment.feature_selection(train)
133
+ std_data, reshaped_data = experiment.preprocess_model(train, val, test)
134
+ experiment.model_selection(std_data, reshaped_data)
135
+ ```
136
+
137
+ ## 🤝 Contributing
138
+
139
+ ### Reminders for Github usage
80
140
 
81
141
  1. Creating Github repository
82
142
 
@@ -96,10 +156,9 @@ $ git remote add origin <YOUR_REPO_URL>
96
156
  $ git push -u origin master
97
157
  ```
98
158
 
99
- 3. use conventional commits
159
+ 3. Use conventional commits
100
160
  https://www.conventionalcommits.org/en/v1.0.0/#summary
101
161
 
102
-
103
- ***
162
+ ---
104
163
 
105
164
  Pierre Gallet © 2024
@@ -0,0 +1,115 @@
1
+ <div align="center">
2
+
3
+ # 🐸
4
+
5
+ ## Welcome to LeCrapaud
6
+
7
+ **An all-in-one machine learning framework**
8
+
9
+ </div>
10
+
11
+ ## 🚀 Introduction
12
+
13
+ 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.
14
+
15
+ ## ✨ Key Features
16
+
17
+ - 🧩 Modular pipeline: Feature engineering, preprocessing, selection, and modeling as independent steps
18
+ - 🤖 Automated model selection and hyperparameter optimization
19
+ - 📊 Easy integration with pandas DataFrames
20
+ - 🔬 Supports both regression and classification tasks
21
+ - 🛠️ Simple API for both full pipeline and step-by-step usage
22
+ - 📦 Ready for production and research workflows
23
+
24
+ ## ⚡ Quick Start
25
+
26
+ 1. Create environment
27
+
28
+ ```sh
29
+ $ pip install virtualenv
30
+ $ python -m venv .venv
31
+ $ source .venv/bin/activate
32
+ ```
33
+
34
+ 2. Install dependencies
35
+
36
+ ```sh
37
+ $ make install
38
+ ```
39
+
40
+ 3. Deactivate virtualenv (if needed)
41
+
42
+ ```sh
43
+ $ deactivate
44
+ ```
45
+
46
+ ## 🛠️ How it works
47
+
48
+ This package provides a high-level API to manage experiments for feature engineering, model selection, and prediction on tabular data (e.g. stock data).
49
+
50
+ ### Typical workflow
51
+
52
+ ```python
53
+ from lecrapaud.api import LeCrapaud
54
+
55
+ # 1. Create the main app
56
+ app = LeCrapaud()
57
+
58
+ # 2. Define your experiment context (see your notebook or api.py for all options)
59
+ context = {
60
+ "data": your_dataframe,
61
+ "columns_drop": [...],
62
+ "columns_date": [...],
63
+ # ... other config options
64
+ }
65
+
66
+ # 3. Create an experiment
67
+ experiment = app.create_experiment(**context)
68
+
69
+ # 4. Run the full training pipeline
70
+ experiment.train(your_dataframe)
71
+
72
+ # 5. Make predictions on new data
73
+ predictions = experiment.predict(new_data)
74
+ ```
75
+
76
+ ### Modular usage
77
+
78
+ You can also use each step independently:
79
+
80
+ ```python
81
+ data_eng = experiment.feature_engineering(data)
82
+ train, val, test = experiment.preprocess_feature(data_eng)
83
+ features = experiment.feature_selection(train)
84
+ std_data, reshaped_data = experiment.preprocess_model(train, val, test)
85
+ experiment.model_selection(std_data, reshaped_data)
86
+ ```
87
+
88
+ ## 🤝 Contributing
89
+
90
+ ### Reminders for Github usage
91
+
92
+ 1. Creating Github repository
93
+
94
+ ```sh
95
+ $ brew install gh
96
+ $ gh auth login
97
+ $ gh repo create
98
+ ```
99
+
100
+ 2. Initializing git and first commit to distant repository
101
+
102
+ ```sh
103
+ $ git init
104
+ $ git add .
105
+ $ git commit -m 'first commit'
106
+ $ git remote add origin <YOUR_REPO_URL>
107
+ $ git push -u origin master
108
+ ```
109
+
110
+ 3. Use conventional commits
111
+ https://www.conventionalcommits.org/en/v1.0.0/#summary
112
+
113
+ ---
114
+
115
+ Pierre Gallet © 2024
@@ -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")
@@ -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):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lecrapaud"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Framework for machine and deep learning, with regression, classification and time series analysis"
5
5
  authors = [
6
6
  {name = "Pierre H. Gallet"}
lecrapaud-0.1.0/README.md DELETED
@@ -1,56 +0,0 @@
1
- # Stock
2
-
3
- ## Overview
4
-
5
- ## Project description
6
-
7
- ## Quick Start
8
-
9
- 1. Create environment
10
-
11
- ```sh
12
- $ pip install virtualenv
13
- $ python -m venv .venv
14
- $ source .venv/bin/activate
15
- ```
16
-
17
- 2. Install dependencies
18
-
19
- ```sh
20
- $ pip install -r requirements.txt
21
- $ pip freeze > requirements.txt
22
- ```
23
-
24
- 3. Deactivate virtualenv (if needed)
25
-
26
- ```sh
27
- $ deactivate
28
- ```
29
-
30
- ## Reminders for Github usage
31
-
32
- 1. Creating Github repository
33
-
34
- ```sh
35
- $ brew install gh
36
- $ gh auth login
37
- $ gh repo create
38
- ```
39
-
40
- 2. Initializing git and first commit to distant repository
41
-
42
- ```sh
43
- $ git init
44
- $ git add .
45
- $ git commit -m 'first commit'
46
- $ git remote add origin <YOUR_REPO_URL>
47
- $ git push -u origin master
48
- ```
49
-
50
- 3. use conventional commits
51
- https://www.conventionalcommits.org/en/v1.0.0/#summary
52
-
53
-
54
- ***
55
-
56
- Pierre Gallet © 2024
File without changes
File without changes
File without changes