StepwiseFactorsIdentifier¶
-
class
qf_lib.common.utils.factorization.factors_identification.stepwise_factor_identifier.
StepwiseFactorsIdentifier
(epsilon: float = 0.05, is_intercept: bool = True)[source]¶ Bases:
qf_lib.common.utils.factorization.factors_identification.factors_identifier.FactorsIdentifier
Class used for identifying factors in the model with Stepwise Regression (with Forward Feature Selection).
- Parameters
epsilon – minimal improvement of model. If adding next factor doesn’t imporve the score by epsilon, then the algorithm is stopped and new factor is not added.
is_intercept – True if the output model shall include the intercept, False otherwise (e.g. because data is centered already).
Methods
select_best_factors
(regressors_df, analysed_tms)Returns the dataframe which is the subset of the original regressors_df but only contains rows for dates common for it and analysed_tms and only contains columns for coefficients which should be included in the model.
-
select_best_factors
(regressors_df: qf_lib.containers.dataframe.qf_dataframe.QFDataFrame, analysed_tms: qf_lib.containers.series.qf_series.QFSeries) → qf_lib.containers.dataframe.qf_dataframe.QFDataFrame[source]¶ Returns the dataframe which is the subset of the original regressors_df but only contains rows for dates common for it and analysed_tms and only contains columns for coefficients which should be included in the model. Factors are identified using Stepwise algorithm.
- Parameters
regressors_df – dataframe containing data for regressors (e.g. daily log-returns)
analysed_tms – timeseries of analysed data (data which should be modeled with regressors, e.g. daily log-returns)
- Returns
Subset of the original regressors_df. Only contains rows corresponding to dates common for it and analysed_tms. Only contains columns corresponding to coefficients which should be included in the model
- Return type