| freqai.extrema_smoothing.window | 5 | int >= 3 | Window size for extrema smoothing. |
| freqai.extrema_smoothing.beta | 8.0 | float > 0 | Kaiser kernel shape parameter. |
| _Extrema weighting_ | | | |
-| freqai.extrema_weighting.strategy | `none` | enum {`none`,`pivot_threshold`} | Weighting strategy applied before smoothing. |
+| freqai.extrema_weighting.strategy | `none` | enum {`none`,`threshold`} | Weighting strategy applied before smoothing. |
| freqai.extrema_weighting.normalization | `minmax` | enum {`minmax`,`l1`,`none`} | Normalization method for weights. |
| freqai.extrema_weighting.gamma | 1.0 | float (0,10] | Contrast exponent applied after normalization (>1 emphasizes extremes, 0<gamma<1 softens). |
| _Feature parameters_ | | | |
| freqai.feature_parameters.label_knn_p_order | `None` | float | p-order for KNN Minkowski metric distance. (optional) |
| freqai.feature_parameters.label_knn_n_neighbors | 5 | int >= 1 | Number of neighbors for KNN. |
| _Predictions extrema_ | | | |
-| freqai.predictions_extrema.selection_method | `extrema_rank` | enum {`peak_values`,`extrema_rank`,`partition`} | Extrema selection method. `peak_values` uses detected peaks, `extrema_rank` uses ranked extrema values, `partition` uses sign-based extrema partitioning. |
+| freqai.predictions_extrema.selection_method | `rank` | enum {`values`,`rank`,`partition`} | Extrema selection method. `values` uses reversal values, `rank` uses ranked extrema values, `partition` uses sign-based partitioning. |
| freqai.predictions_extrema.thresholds_smoothing | `mean` | enum {`mean`,`median`,`isodata`,`li`,`minimum`,`otsu`,`triangle`,`yen`,`soft_extremum`} | Thresholding method for prediction thresholds smoothing. |
| freqai.predictions_extrema.thresholds_alpha | 12.0 | float > 0 | Alpha for `soft_extremum`. |
| freqai.predictions_extrema.threshold_outlier | 0.999 | float (0,1) | Quantile threshold for predictions outlier filtering. |
zigzag,
)
-ExtremaSelectionMethod = Literal["peak_values", "extrema_rank", "partition"]
+ExtremaSelectionMethod = Literal["values", "rank", "partition"]
OptunaNamespace = Literal["hp", "train", "label"]
CustomThresholdMethod = Literal["median", "soft_extremum"]
SkimageThresholdMethod = Literal[
_SQRT_2: Final[float] = np.sqrt(2.0)
_EXTREMA_SELECTION_METHODS: Final[tuple[ExtremaSelectionMethod, ...]] = (
- "peak_values",
- "extrema_rank",
+ "values",
+ "rank",
"partition",
)
_CUSTOM_THRESHOLD_METHODS: Final[tuple[CustomThresholdMethod, ...]] = (
if pred_extrema.empty:
return pd.Series(dtype=float), pd.Series(dtype=float)
- if extrema_selection == QuickAdapterRegressorV3._EXTREMA_SELECTION_METHODS[0]:
+ if (
+ extrema_selection == QuickAdapterRegressorV3._EXTREMA_SELECTION_METHODS[0]
+ ): # "values"
minima_indices = sp.signal.find_peaks(-pred_extrema)[0]
maxima_indices = sp.signal.find_peaks(pred_extrema)[0]
if maxima_indices.size > 0
else pd.Series(dtype=float)
)
- elif extrema_selection == QuickAdapterRegressorV3._EXTREMA_SELECTION_METHODS[1]:
+ elif (
+ extrema_selection == QuickAdapterRegressorV3._EXTREMA_SELECTION_METHODS[1]
+ ): # "rank"
minima_indices = sp.signal.find_peaks(-pred_extrema)[0]
maxima_indices = sp.signal.find_peaks(pred_extrema)[0]
pred_maxima = pred_extrema.nlargest(n_maxima)
else:
pred_maxima = pd.Series(dtype=float)
- elif extrema_selection == QuickAdapterRegressorV3._EXTREMA_SELECTION_METHODS[2]:
+ elif (
+ extrema_selection == QuickAdapterRegressorV3._EXTREMA_SELECTION_METHODS[2]
+ ): # "partition"
eps = np.finfo(float).eps
pred_maxima = pred_extrema[pred_extrema > eps]
T = TypeVar("T", pd.Series, float)
-WeightStrategy = Literal["none", "pivot_threshold"]
-WEIGHT_STRATEGIES: Final[tuple[WeightStrategy, ...]] = ("none", "pivot_threshold")
+WeightStrategy = Literal["none", "threshold"]
+WEIGHT_STRATEGIES: Final[tuple[WeightStrategy, ...]] = ("none", "threshold")
NormalizationType = Literal["minmax", "l1", "none"]
NORMALIZATION_TYPES: Final[tuple[NormalizationType, ...]] = ("minmax", "l1", "none")
): # "none"
return extrema, default_weights
- if strategy == WEIGHT_STRATEGIES[1]: # "pivot_threshold"
+ if strategy == WEIGHT_STRATEGIES[1]: # "threshold"
extrema_weights = calculate_extrema_weights(
series=extrema,
indices=indices,