df5f60fd910a56cddaed757ec0340da3aa1839e3,lifelines/fitters/__init__.py,ParametricRegressionFitter,_fit,#ParametricRegressionFitter#,1518

Before Change



        if regressors is not None:
            // the .intersection preserves order, important!
            self.regressors = {name: list(df.columns.intersection(cols)) for name, cols in regressors.items()}
        else:
            self.regressors = {name: df.columns.tolist() for name in self._fitted_parameter_names}
        assert all(
            len(cols) > 0 for cols in self.regressors.values()
        ), "All parameters must have at least one column associated with it. Did you mean to include a constant column?"

        df = self._filter_dataframe_to_covariates(df).astype(float)
        self._check_values_pre_fitting(df, utils.coalesce(Ts[1], Ts[0]), E, weights, entries)

        _index = pd.MultiIndex.from_tuples(
            sum(([(name, col) for col in columns] for name, columns in self.regressors.items()), [])
        )

        self._norm_mean = df.mean(0)
        if (
            self._KNOWN_MODEL
            and hasattr(self, "_ancillary_parameter_name")
            and hasattr(self, "_primary_parameter_name")
        ):
            // Known AFT model
            self._norm_mean_ = df[self.regressors[self._primary_parameter_name]].mean(0)
            self._norm_mean_ancillary = df[self.regressors[self._ancillary_parameter_name]].mean(0)

        _norm_std = df.std(0)
        self._constant_cols = pd.Series(
            [(_norm_std.loc[variable_name] < 1e-8) for (_, variable_name) in _index], index=_index
        )
        self._norm_std = pd.Series([_norm_std.loc[variable_name] for (_, variable_name) in _index], index=_index)
        self._norm_std[self._constant_cols] = 1.0
        _norm_std[_norm_std < 1e-8] = 1.0

After Change



        if regressors is not None:
            // the .intersection preserves order, important!
            self.regressors = {name: list(df.columns.intersection(cols)) for name, cols in sorted(regressors.items())}
        else:
            self.regressors = {name: df.columns.tolist() for name in sorted(self._fitted_parameter_names)}
        assert all(
            len(cols) > 0 for cols in self.regressors.values()
        ), "All parameters must have at least one column associated with it. Did you mean to include a constant column?"

        df = self._filter_dataframe_to_covariates(df).astype(float)
        self._check_values_pre_fitting(df, utils.coalesce(Ts[1], Ts[0]), E, weights, entries)

        _index = pd.MultiIndex.from_tuples(
            sum(([(name, col) for col in columns] for name, columns in self.regressors.items()), [])
        )

        self._norm_mean = df.mean(0)
        if (
            self._KNOWN_MODEL
            and hasattr(self, "_ancillary_parameter_name")
            and hasattr(self, "_primary_parameter_name")
        ):
            // Known AFT model
            self._norm_mean_ = df[self.regressors[self._primary_parameter_name]].mean(0)
            self._norm_mean_ancillary = df[self.regressors[self._ancillary_parameter_name]].mean(0)

        _norm_std = df.std(0)
        self._constant_cols = pd.Series(
            [(_norm_std.loc[variable_name] < 1e-8) for (_, variable_name) in _index], index=_index
        )
        self._norm_std = pd.Series([_norm_std.loc[variable_name] for (_, variable_name) in _index], index=_index)
        self._norm_std[self._constant_cols] = 1.0
        _norm_std[_norm_std < 1e-8] = 1.0
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: CamDavidsonPilon/lifelines
Commit Name: df5f60fd910a56cddaed757ec0340da3aa1839e3
Time: 2020-01-28
Author: cam.davidson.pilon@gmail.com
File Name: lifelines/fitters/__init__.py
Class Name: ParametricRegressionFitter
Method Name: _fit


Project Name: brian-team/brian2
Commit Name: 4e1e068507089d40c1eb83eb9e39ea4bbd30131e
Time: 2017-10-25
Author: marcel.stimberg@inserm.fr
File Name: brian2/codegen/generators/cython_generator.py
Class Name: CythonCodeGenerator
Method Name: determine_keywords


Project Name: SheffieldML/GPy
Commit Name: 7eff1d984f2019ba56a799234c961b2354ed85b0
Time: 2015-03-02
Author: michael.p.croucher@googlemail.com
File Name: GPy/core/parameterization/index_operations.py
Class Name: ParameterIndexOperations
Method Name: shift_left