def fit(self, X, y):
        assert len(X) == len(y), "len(X) doesn't match len(y)"

        if isinstance(y, PurePandas.PurePythonDataFrame):
            assert y.shape[1] == 1, "for dataframe y, need y.shape[1] == 1"
            y = y.iloc[:,0]

        # we need to be careful here:
        # sorted is going to copy the
        # maybe we can avoid the copy, but at the very least
        # we should build implement  __pyfora_generator__  on Series
        classes = y.unique()

        assert len(classes) == 2, "need len(classes) == 2"

        classZeroLabel = classes[0]
        classOneLabel = classes[1]

        # TODO: we don't need to hold onto an entire column of ones,
        # but it simplifies the code for now.
        # this logic should move into the subclasses of Solver.Solver
        if self.hasIntercept:
            X = self._addScaleColumn(X)

        if self.method == 'newton-cg':
            returnValue = TrustRegionConjugateGradientSolver(
                X, y,
                classZeroLabel=classZeroLabel,
                C=self.regularizer,
                eps=self.tol,
                maxIters=self.maxIter,
                splitLimit=self.splitLimit
                ).solve()
        elif self.method == 'majorization':
            returnValue = FullRankMajorizationSolver(
                X, y,
                classZeroLabel=classZeroLabel,
                regularizer=1.0 / len(X) / self.regularizer,
                tol=self.tol,
                maxIters=self.maxIter,
                splitLimit=self.splitLimit
                ).solve()
        else:
            raise Exception("bad method argument passed in: " + self.method)

        intercept = None
        if self.hasIntercept:
            intercept = returnValue.weights[-1]
            weights = returnValue.weights[:-1]
        else:
            weights = returnValue.weights

        return BinaryLogisticRegressionModel(
            weights,
            classZeroLabel,
            classOneLabel,
            intercept,
            self.interceptScale,
            returnValue.iterations)
In non-multiselect switch the selection to a new date.
dataset/ETHPy150Open ufora/ufora/packages/python/pyfora/algorithms/logistic/BinaryLogisticRegressionFitter.py/BinaryLogisticRegressionFitter.fit--crossover with--dataset/ETHPy150Open enthought/traitsui/traitsui/wx/date_editor.py/MultiCalendarCtrl.single_select_day