lecrapaud 0.7.0__tar.gz → 0.8.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 (43) hide show
  1. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/PKG-INFO +1 -1
  2. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/feature_engineering.py +33 -0
  3. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/feature_selection.py +1 -0
  4. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/pyproject.toml +1 -1
  5. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/LICENSE +0 -0
  6. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/README.md +0 -0
  7. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/__init__.py +0 -0
  8. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/api.py +0 -0
  9. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/config.py +0 -0
  10. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/__init__.py +0 -0
  11. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic/README +0 -0
  12. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic/env.py +0 -0
  13. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic/script.py.mako +0 -0
  14. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic/versions/2025_06_23_1748-f089dfb7e3ba_.py +0 -0
  15. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic/versions/2025_06_24_1216-c62251b129ed_.py +0 -0
  16. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic/versions/2025_06_24_1711-86457e2f333f_.py +0 -0
  17. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/alembic.ini +0 -0
  18. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/__init__.py +0 -0
  19. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/base.py +0 -0
  20. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/experiment.py +0 -0
  21. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/feature.py +0 -0
  22. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/feature_selection.py +0 -0
  23. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/feature_selection_rank.py +0 -0
  24. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/model.py +0 -0
  25. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/model_selection.py +0 -0
  26. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/model_training.py +0 -0
  27. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/score.py +0 -0
  28. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/models/target.py +0 -0
  29. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/db/session.py +0 -0
  30. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/directories.py +0 -0
  31. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/experiment.py +0 -0
  32. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/integrations/openai_integration.py +0 -0
  33. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/jobs/__init__.py +0 -0
  34. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/jobs/config.py +0 -0
  35. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/jobs/scheduler.py +0 -0
  36. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/jobs/tasks.py +0 -0
  37. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/model_selection.py +0 -0
  38. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/search_space.py +0 -0
  39. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/speed_tests/test-gpu-bilstm.ipynb +0 -0
  40. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/speed_tests/test-gpu-resnet.ipynb +0 -0
  41. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/speed_tests/test-gpu-transformers.ipynb +0 -0
  42. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/speed_tests/tests.ipynb +0 -0
  43. {lecrapaud-0.7.0 → lecrapaud-0.8.0}/lecrapaud/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lecrapaud
3
- Version: 0.7.0
3
+ Version: 0.8.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
@@ -122,8 +122,41 @@ class FeatureEngineeringEngine:
122
122
  # Cyclic encode dates
123
123
  self.data = self.cyclic_encode_date()
124
124
 
125
+ # Remove constant columns if training (feature selection methods need independent features)
126
+ if self.for_training:
127
+ self.data = self.remove_constant_columns()
128
+
125
129
  return self.data
126
130
 
131
+ def remove_constant_columns(
132
+ self,
133
+ threshold: float = 0.99,
134
+ ) -> pd.DataFrame:
135
+ """
136
+ Removes constant or almost constant columns from a DataFrame.
137
+
138
+ Parameters:
139
+ threshold (float): Max proportion for a single value (default 0.99 = 99%).
140
+
141
+ Returns:
142
+ pd.DataFrame: Cleaned DataFrame.
143
+ """
144
+
145
+ to_drop = []
146
+
147
+ for col in self.data.columns:
148
+ value_counts = self.data[col].value_counts(dropna=False, normalize=True)
149
+ if value_counts.empty:
150
+ to_drop.append(col)
151
+ elif value_counts.iloc[0] >= threshold:
152
+ to_drop.append(col)
153
+
154
+ if to_drop:
155
+ logger.info(f"🔍 Removed {len(to_drop)} constant/almost constant columns:")
156
+ logger.info(to_drop)
157
+
158
+ return self.data.drop(columns=to_drop, errors="ignore")
159
+
127
160
  def cyclic_encode_date(self) -> pd.DataFrame:
128
161
  """
129
162
  Adds cyclic (sine and cosine) encoding for common date parts: day of week, day of month, and month.
@@ -1140,6 +1140,7 @@ def get_features_by_types(df: pd.DataFrame, sample_categorical_threshold: int =
1140
1140
  for col in df.columns
1141
1141
  if df[col].nunique() <= sample_categorical_threshold
1142
1142
  and df[col].dtype in ["int64", "Int64"]
1143
+ and (df[col] >= 0).all()
1143
1144
  ]
1144
1145
  df_categorical = df[categorical_features]
1145
1146
  logger.info(f"Number of categorical features: {len(categorical_features)}")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lecrapaud"
3
- version = "0.7.0"
3
+ version = "0.8.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"}
File without changes
File without changes
File without changes
File without changes
File without changes