gitlabds 2.1.8__tar.gz → 2.1.10__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.
- {gitlabds-2.1.8 → gitlabds-2.1.10}/PKG-INFO +37 -8
- {gitlabds-2.1.8 → gitlabds-2.1.10}/README.md +36 -7
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/memory_optimization.py +3 -5
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/missing.py +307 -93
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/model_evaluator.py +111 -5
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/serving_features.py +114 -48
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/split_data.py +143 -22
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds.egg-info/PKG-INFO +37 -8
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds.egg-info/SOURCES.txt +0 -2
- gitlabds-2.1.8/gitlabds/missing_check.py +0 -43
- gitlabds-2.1.8/gitlabds/missing_fill.py +0 -105
- {gitlabds-2.1.8 → gitlabds-2.1.10}/LICENSE +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/__init__.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/baselines.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/config_generator.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/dummy.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/feature_reduction.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/insights.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/monitoring_metrics.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/outliers.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds/trends.py +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds.egg-info/dependency_links.txt +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds.egg-info/requires.txt +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/gitlabds.egg-info/top_level.txt +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/pyproject.toml +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/setup.cfg +0 -0
- {gitlabds-2.1.8 → gitlabds-2.1.10}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitlabds
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.10
|
|
4
4
|
Summary: GitLab Data Science Tools
|
|
5
5
|
Author-email: Kevin Dietz <kdietz@gitlab.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -31,7 +31,7 @@ Requires-Dist: snowflake-ml-python; extra == "feature-store"
|
|
|
31
31
|
Dynamic: license-file
|
|
32
32
|
|
|
33
33
|
[](https://badge.fury.io/py/gitlabds)
|
|
34
|
-
[](https://www.python.org/downloads/)
|
|
35
35
|
[](https://opensource.org/licenses/MIT)
|
|
36
36
|
|
|
37
37
|
# gitlabds
|
|
@@ -148,7 +148,7 @@ test_df_transformed = gitlabds.apply_outliers(df=test_data, outlier_limits=outli
|
|
|
148
148
|
#### Description
|
|
149
149
|
Detect and optionally fill missing values in a DataFrame, with support for various filling methods and detailed reporting.
|
|
150
150
|
|
|
151
|
-
`gitlabds.missing_values(df, threshold=0.0, method=None, columns="all", constant_value=None, verbose=True, operation="both")`
|
|
151
|
+
`gitlabds.missing_values(df, threshold=0.0, method=None, columns="all", constant_value=None, groupby=None, verbose=True, operation="both")`
|
|
152
152
|
|
|
153
153
|
#### Parameters:
|
|
154
154
|
- **_df_** : Your pandas dataframe
|
|
@@ -163,6 +163,7 @@ Detect and optionally fill missing values in a DataFrame, with support for vario
|
|
|
163
163
|
- "drop_row": Remove rows with any missing values in specified columns
|
|
164
164
|
- **_columns_** : Columns to check and/or fill. If "all", processes all columns with missing values.
|
|
165
165
|
- **_constant_value_** : Value to use when method="constant" or when specified columns use the constant method.
|
|
166
|
+
- **_groupby_** : Column name or list of column names to group by when computing fill values. When provided, missing values are filled per-group rather than from the full-column statistic/distribution. A global fallback (computed across the full column) is used for any group value not seen during training. Only applies to `mean`, `median`, and `random` methods; ignored for other methods.
|
|
166
167
|
- **_verbose_** : Whether to print detailed information about missing values and filling operations.
|
|
167
168
|
- **_operation_** : Operation mode:
|
|
168
169
|
- "check": Only check for missing values, don't fill
|
|
@@ -173,7 +174,7 @@ Detect and optionally fill missing values in a DataFrame, with support for vario
|
|
|
173
174
|
- If operation="check": List of column names with missing values (or None)
|
|
174
175
|
- If operation="fill" or "both": Tuple containing:
|
|
175
176
|
- DataFrame with missing values handled
|
|
176
|
-
- Dictionary with missing value information that can be used with
|
|
177
|
+
- Dictionary with missing value information that can be used with apply_missing_values()
|
|
177
178
|
|
|
178
179
|
#### Examples:
|
|
179
180
|
```python
|
|
@@ -190,6 +191,20 @@ df_filled, missing_info = gitlabds.missing_values(
|
|
|
190
191
|
constant_value="Unknown",
|
|
191
192
|
verbose=True
|
|
192
193
|
)
|
|
194
|
+
|
|
195
|
+
# Fill using per-segment statistics (groupby) — works for mean, median, and random.
|
|
196
|
+
# A global fallback (across the full column) is used for any group value not seen
|
|
197
|
+
# during training.
|
|
198
|
+
df_filled, missing_info = gitlabds.missing_values(
|
|
199
|
+
df,
|
|
200
|
+
columns=["lam", "employee_count"],
|
|
201
|
+
method="median",
|
|
202
|
+
groupby="sales_segment",
|
|
203
|
+
operation="fill"
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
# Group medians from training are reused when applied to new data via apply_missing_values()
|
|
207
|
+
test_df_filled = gitlabds.apply_missing_values(test_df, missing_info)
|
|
193
208
|
```
|
|
194
209
|
</details>
|
|
195
210
|
|
|
@@ -508,7 +523,7 @@ df_optimized = gitlabds.memory_optimization(
|
|
|
508
523
|
#### Description
|
|
509
524
|
This function splits your data into train and test datasets, separating the outcome from the rest of the file. It supports stratified sampling, balanced upsampling for imbalanced datasets, and provides model weights for compensating sampling adjustments.
|
|
510
525
|
|
|
511
|
-
`gitlabds.split_data(df, train_pct=0.7, dv=None, dv_threshold=0.0, random_state=5435, stratify=True, sampling_strategy=None, shuffle=True, verbose=True):`
|
|
526
|
+
`gitlabds.split_data(df, train_pct=0.7, dv=None, dv_threshold=0.0, random_state=5435, stratify=True, groupby=None, sampling_strategy=None, shuffle=True, verbose=True):`
|
|
512
527
|
|
|
513
528
|
#### Parameters:
|
|
514
529
|
- **_df_** : your pandas dataframe
|
|
@@ -516,7 +531,8 @@ This function splits your data into train and test datasets, separating the outc
|
|
|
516
531
|
- **_dv_** : The column name of your outcome. If None, the function will return the entire dataframe split without separating features and target.
|
|
517
532
|
- **_dv_threshold_** : The minimum percentage of rows that must contain a positive instance (i.e. > 0) of the outcome. SMOTE/SMOTE-NC will be used to upsample positive instances until this threshold is reached. Can be disabled by setting to 0. Only accepts values 0 to 0.5.
|
|
518
533
|
- **_random_state_** : Random seed to use for splitting dataframe and for up-sampling (if needed).
|
|
519
|
-
- **_stratify_** : Controls stratified sampling. If True and dv is provided, stratifies by the outcome variable. If a list of column names, stratifies by those columns. If False, does not use stratified sampling.
|
|
534
|
+
- **_stratify_** : Controls stratified sampling. If True and dv is provided, stratifies by the outcome variable. If a list of column names, stratifies by those columns. If False, does not use stratified sampling. Note: a list is not supported when `groupby` is provided.
|
|
535
|
+
- **_groupby_** : Column name OR index level name to use for group-aware splitting. When provided, all rows belonging to the same group are kept together in either train or test (never split across both) — useful when the dataset has repeated observations per entity (e.g., the same account at multiple snapshot dates) and naive row-level splits would leak entities across train/test. When `stratify=True`, stratification is computed at the group level using the max of `dv` per group ("ever-positive" vs. "never-positive" for binary targets; best-effort and ordinal-like for multi-class). Groups whose `dv` is entirely NaN are dropped with a warning. When `groupby` refers to a regular column (not an index level), that column is NOT dropped from the returned `x_train`/`x_test` — drop it manually if you don't want it as a feature.
|
|
520
536
|
- **_sampling_strategy_** : Sampling strategy for imbalanced data. If None, will use dv_threshold. See imblearn documentation for more details on acceptable values.
|
|
521
537
|
- **_shuffle_** : Whether to shuffle the data before splitting.
|
|
522
538
|
- **_verbose_** : Whether to print information about the splitting process.
|
|
@@ -558,6 +574,17 @@ x_train, y_train, x_test, y_test, model_weights = gitlabds.split_data(
|
|
|
558
574
|
)
|
|
559
575
|
```
|
|
560
576
|
|
|
577
|
+
```python
|
|
578
|
+
# Group-aware split: keep all snapshots of an account together in train OR test,
|
|
579
|
+
# with stratification computed at the group level (ever-positive vs never-positive)
|
|
580
|
+
x_train, y_train, x_test, y_test, model_weights = gitlabds.split_data(
|
|
581
|
+
df=my_df,
|
|
582
|
+
dv='my_outcome',
|
|
583
|
+
groupby='dim_crm_account_id',
|
|
584
|
+
stratify=True
|
|
585
|
+
)
|
|
586
|
+
```
|
|
587
|
+
|
|
561
588
|
```python
|
|
562
589
|
# Split entire dataframe without separating target
|
|
563
590
|
train_df, _, test_df, _, _ = gitlabds.split_data(
|
|
@@ -640,7 +667,7 @@ A comprehensive framework for evaluating machine learning models, supporting bot
|
|
|
640
667
|
- _**x_oot**_ : Optional out-of-time validation features.
|
|
641
668
|
- _**y_oot**_ : Optional out-of-time validation labels.
|
|
642
669
|
- _**classification**_ : Whether this is a classification model. If False, regression metrics will be used.
|
|
643
|
-
- _**algo**_ : Algorithm type for feature importance calculation. Options: 'xgb', 'rf', 'mars'. For other algorithms, use `None`
|
|
670
|
+
- _**algo**_ : Algorithm type for feature importance calculation. Options: 'xgb', 'lgb', 'rf', 'mars'. For other algorithms, use `None`
|
|
644
671
|
- _**f1_threshold**_ : Threshold for binary classification.
|
|
645
672
|
- _**decile_n**_ : Number of n-tiles for lift calculation. Defaults to 10 for deciles
|
|
646
673
|
- _**top_features_n**_ : Number of top features to display in visualizations.
|
|
@@ -943,7 +970,7 @@ feature_drift = results['feature_drift']
|
|
|
943
970
|
#### Description
|
|
944
971
|
Serve features from Snowflake Feature Store with built-in distributed locking and retry logic. This function orchestrates feature retrieval from multiple feature views with support for point-in-time lookups and flexible parameter customization.
|
|
945
972
|
|
|
946
|
-
`gitlabds.serve_features(session, feature_store, feature_views_dict, spine_df=None, feature_date=None, spine_timestamp_col=None, include_feature_view_timestamp_col=False, lookback_window_value=None, lookback_window_unit=None, lock_timeout_seconds=300):`
|
|
973
|
+
`gitlabds.serve_features(session, feature_store, feature_views_dict, spine_df=None, feature_date=None, spine_timestamp_col=None, include_feature_view_timestamp_col=False, lookback_window_value=None, lookback_window_unit=None, lock_timeout_seconds=300, max_fetch_retries=3, fetch_retry_backoff_seconds=30):`
|
|
947
974
|
|
|
948
975
|
#### Parameters:
|
|
949
976
|
- **_session_** : Active Snowflake Session object
|
|
@@ -959,6 +986,8 @@ Serve features from Snowflake Feature Store with built-in distributed locking an
|
|
|
959
986
|
- **_lookback_window_value_** : Either a global integer value (e.g., 6) or a dict with feature-view-specific values
|
|
960
987
|
- **_lookback_window_unit_** : Either a global string value (e.g., 'months') or a dict with feature-view-specific values
|
|
961
988
|
- **_lock_timeout_seconds_** : Timeout in seconds for acquiring the Snowflake lock. Default is 300.
|
|
989
|
+
- **_max_fetch_retries_** : Maximum number of attempts for the result-fetch step (`retrieve_feature_values` + `to_arrow().to_pandas()`) when a transient network/streaming error occurs (e.g., `ChunkedEncodingError`, "Response ended prematurely"). Set to 1 to disable retries. Default is 3.
|
|
990
|
+
- **_fetch_retry_backoff_seconds_** : Base sleep duration between fetch retries. Sleep grows linearly with attempt number (`attempt * backoff`). With defaults (3 retries, 30s base), sleeps are 30s before attempt 2 and 60s before attempt 3. Default is 30.
|
|
962
991
|
|
|
963
992
|
#### Returns
|
|
964
993
|
- DataFrame with combined features from all feature views
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[](https://badge.fury.io/py/gitlabds)
|
|
2
|
-
[](https://www.python.org/downloads/)
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
4
|
|
|
5
5
|
# gitlabds
|
|
@@ -116,7 +116,7 @@ test_df_transformed = gitlabds.apply_outliers(df=test_data, outlier_limits=outli
|
|
|
116
116
|
#### Description
|
|
117
117
|
Detect and optionally fill missing values in a DataFrame, with support for various filling methods and detailed reporting.
|
|
118
118
|
|
|
119
|
-
`gitlabds.missing_values(df, threshold=0.0, method=None, columns="all", constant_value=None, verbose=True, operation="both")`
|
|
119
|
+
`gitlabds.missing_values(df, threshold=0.0, method=None, columns="all", constant_value=None, groupby=None, verbose=True, operation="both")`
|
|
120
120
|
|
|
121
121
|
#### Parameters:
|
|
122
122
|
- **_df_** : Your pandas dataframe
|
|
@@ -131,6 +131,7 @@ Detect and optionally fill missing values in a DataFrame, with support for vario
|
|
|
131
131
|
- "drop_row": Remove rows with any missing values in specified columns
|
|
132
132
|
- **_columns_** : Columns to check and/or fill. If "all", processes all columns with missing values.
|
|
133
133
|
- **_constant_value_** : Value to use when method="constant" or when specified columns use the constant method.
|
|
134
|
+
- **_groupby_** : Column name or list of column names to group by when computing fill values. When provided, missing values are filled per-group rather than from the full-column statistic/distribution. A global fallback (computed across the full column) is used for any group value not seen during training. Only applies to `mean`, `median`, and `random` methods; ignored for other methods.
|
|
134
135
|
- **_verbose_** : Whether to print detailed information about missing values and filling operations.
|
|
135
136
|
- **_operation_** : Operation mode:
|
|
136
137
|
- "check": Only check for missing values, don't fill
|
|
@@ -141,7 +142,7 @@ Detect and optionally fill missing values in a DataFrame, with support for vario
|
|
|
141
142
|
- If operation="check": List of column names with missing values (or None)
|
|
142
143
|
- If operation="fill" or "both": Tuple containing:
|
|
143
144
|
- DataFrame with missing values handled
|
|
144
|
-
- Dictionary with missing value information that can be used with
|
|
145
|
+
- Dictionary with missing value information that can be used with apply_missing_values()
|
|
145
146
|
|
|
146
147
|
#### Examples:
|
|
147
148
|
```python
|
|
@@ -158,6 +159,20 @@ df_filled, missing_info = gitlabds.missing_values(
|
|
|
158
159
|
constant_value="Unknown",
|
|
159
160
|
verbose=True
|
|
160
161
|
)
|
|
162
|
+
|
|
163
|
+
# Fill using per-segment statistics (groupby) — works for mean, median, and random.
|
|
164
|
+
# A global fallback (across the full column) is used for any group value not seen
|
|
165
|
+
# during training.
|
|
166
|
+
df_filled, missing_info = gitlabds.missing_values(
|
|
167
|
+
df,
|
|
168
|
+
columns=["lam", "employee_count"],
|
|
169
|
+
method="median",
|
|
170
|
+
groupby="sales_segment",
|
|
171
|
+
operation="fill"
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# Group medians from training are reused when applied to new data via apply_missing_values()
|
|
175
|
+
test_df_filled = gitlabds.apply_missing_values(test_df, missing_info)
|
|
161
176
|
```
|
|
162
177
|
</details>
|
|
163
178
|
|
|
@@ -476,7 +491,7 @@ df_optimized = gitlabds.memory_optimization(
|
|
|
476
491
|
#### Description
|
|
477
492
|
This function splits your data into train and test datasets, separating the outcome from the rest of the file. It supports stratified sampling, balanced upsampling for imbalanced datasets, and provides model weights for compensating sampling adjustments.
|
|
478
493
|
|
|
479
|
-
`gitlabds.split_data(df, train_pct=0.7, dv=None, dv_threshold=0.0, random_state=5435, stratify=True, sampling_strategy=None, shuffle=True, verbose=True):`
|
|
494
|
+
`gitlabds.split_data(df, train_pct=0.7, dv=None, dv_threshold=0.0, random_state=5435, stratify=True, groupby=None, sampling_strategy=None, shuffle=True, verbose=True):`
|
|
480
495
|
|
|
481
496
|
#### Parameters:
|
|
482
497
|
- **_df_** : your pandas dataframe
|
|
@@ -484,7 +499,8 @@ This function splits your data into train and test datasets, separating the outc
|
|
|
484
499
|
- **_dv_** : The column name of your outcome. If None, the function will return the entire dataframe split without separating features and target.
|
|
485
500
|
- **_dv_threshold_** : The minimum percentage of rows that must contain a positive instance (i.e. > 0) of the outcome. SMOTE/SMOTE-NC will be used to upsample positive instances until this threshold is reached. Can be disabled by setting to 0. Only accepts values 0 to 0.5.
|
|
486
501
|
- **_random_state_** : Random seed to use for splitting dataframe and for up-sampling (if needed).
|
|
487
|
-
- **_stratify_** : Controls stratified sampling. If True and dv is provided, stratifies by the outcome variable. If a list of column names, stratifies by those columns. If False, does not use stratified sampling.
|
|
502
|
+
- **_stratify_** : Controls stratified sampling. If True and dv is provided, stratifies by the outcome variable. If a list of column names, stratifies by those columns. If False, does not use stratified sampling. Note: a list is not supported when `groupby` is provided.
|
|
503
|
+
- **_groupby_** : Column name OR index level name to use for group-aware splitting. When provided, all rows belonging to the same group are kept together in either train or test (never split across both) — useful when the dataset has repeated observations per entity (e.g., the same account at multiple snapshot dates) and naive row-level splits would leak entities across train/test. When `stratify=True`, stratification is computed at the group level using the max of `dv` per group ("ever-positive" vs. "never-positive" for binary targets; best-effort and ordinal-like for multi-class). Groups whose `dv` is entirely NaN are dropped with a warning. When `groupby` refers to a regular column (not an index level), that column is NOT dropped from the returned `x_train`/`x_test` — drop it manually if you don't want it as a feature.
|
|
488
504
|
- **_sampling_strategy_** : Sampling strategy for imbalanced data. If None, will use dv_threshold. See imblearn documentation for more details on acceptable values.
|
|
489
505
|
- **_shuffle_** : Whether to shuffle the data before splitting.
|
|
490
506
|
- **_verbose_** : Whether to print information about the splitting process.
|
|
@@ -526,6 +542,17 @@ x_train, y_train, x_test, y_test, model_weights = gitlabds.split_data(
|
|
|
526
542
|
)
|
|
527
543
|
```
|
|
528
544
|
|
|
545
|
+
```python
|
|
546
|
+
# Group-aware split: keep all snapshots of an account together in train OR test,
|
|
547
|
+
# with stratification computed at the group level (ever-positive vs never-positive)
|
|
548
|
+
x_train, y_train, x_test, y_test, model_weights = gitlabds.split_data(
|
|
549
|
+
df=my_df,
|
|
550
|
+
dv='my_outcome',
|
|
551
|
+
groupby='dim_crm_account_id',
|
|
552
|
+
stratify=True
|
|
553
|
+
)
|
|
554
|
+
```
|
|
555
|
+
|
|
529
556
|
```python
|
|
530
557
|
# Split entire dataframe without separating target
|
|
531
558
|
train_df, _, test_df, _, _ = gitlabds.split_data(
|
|
@@ -608,7 +635,7 @@ A comprehensive framework for evaluating machine learning models, supporting bot
|
|
|
608
635
|
- _**x_oot**_ : Optional out-of-time validation features.
|
|
609
636
|
- _**y_oot**_ : Optional out-of-time validation labels.
|
|
610
637
|
- _**classification**_ : Whether this is a classification model. If False, regression metrics will be used.
|
|
611
|
-
- _**algo**_ : Algorithm type for feature importance calculation. Options: 'xgb', 'rf', 'mars'. For other algorithms, use `None`
|
|
638
|
+
- _**algo**_ : Algorithm type for feature importance calculation. Options: 'xgb', 'lgb', 'rf', 'mars'. For other algorithms, use `None`
|
|
612
639
|
- _**f1_threshold**_ : Threshold for binary classification.
|
|
613
640
|
- _**decile_n**_ : Number of n-tiles for lift calculation. Defaults to 10 for deciles
|
|
614
641
|
- _**top_features_n**_ : Number of top features to display in visualizations.
|
|
@@ -911,7 +938,7 @@ feature_drift = results['feature_drift']
|
|
|
911
938
|
#### Description
|
|
912
939
|
Serve features from Snowflake Feature Store with built-in distributed locking and retry logic. This function orchestrates feature retrieval from multiple feature views with support for point-in-time lookups and flexible parameter customization.
|
|
913
940
|
|
|
914
|
-
`gitlabds.serve_features(session, feature_store, feature_views_dict, spine_df=None, feature_date=None, spine_timestamp_col=None, include_feature_view_timestamp_col=False, lookback_window_value=None, lookback_window_unit=None, lock_timeout_seconds=300):`
|
|
941
|
+
`gitlabds.serve_features(session, feature_store, feature_views_dict, spine_df=None, feature_date=None, spine_timestamp_col=None, include_feature_view_timestamp_col=False, lookback_window_value=None, lookback_window_unit=None, lock_timeout_seconds=300, max_fetch_retries=3, fetch_retry_backoff_seconds=30):`
|
|
915
942
|
|
|
916
943
|
#### Parameters:
|
|
917
944
|
- **_session_** : Active Snowflake Session object
|
|
@@ -927,6 +954,8 @@ Serve features from Snowflake Feature Store with built-in distributed locking an
|
|
|
927
954
|
- **_lookback_window_value_** : Either a global integer value (e.g., 6) or a dict with feature-view-specific values
|
|
928
955
|
- **_lookback_window_unit_** : Either a global string value (e.g., 'months') or a dict with feature-view-specific values
|
|
929
956
|
- **_lock_timeout_seconds_** : Timeout in seconds for acquiring the Snowflake lock. Default is 300.
|
|
957
|
+
- **_max_fetch_retries_** : Maximum number of attempts for the result-fetch step (`retrieve_feature_values` + `to_arrow().to_pandas()`) when a transient network/streaming error occurs (e.g., `ChunkedEncodingError`, "Response ended prematurely"). Set to 1 to disable retries. Default is 3.
|
|
958
|
+
- **_fetch_retry_backoff_seconds_** : Base sleep duration between fetch retries. Sleep grows linearly with attempt number (`attempt * backoff`). With defaults (3 retries, 30s base), sleeps are 30s before attempt 2 and 60s before attempt 3. Default is 30.
|
|
930
959
|
|
|
931
960
|
#### Returns
|
|
932
961
|
- DataFrame with combined features from all feature views
|
|
@@ -809,11 +809,9 @@ def memory_optimization(
|
|
|
809
809
|
if sparsity > sparse_threshold:
|
|
810
810
|
try:
|
|
811
811
|
if isinstance(df_result, pd.Series):
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
else:
|
|
816
|
-
df_result[col] = pd.Series.sparse.from_dense(
|
|
812
|
+
|
|
813
|
+
df_result = pd.arrays.SparseArray(df_result, fill_value=fill_value)
|
|
814
|
+
df_result[col] = pd.arrays.SparseArray(
|
|
817
815
|
df_result[col], fill_value=fill_value
|
|
818
816
|
)
|
|
819
817
|
|