Skip to content

stemflow.model.dummy_model


dummy_model1

Bases: BaseEstimator

A dummy model that predict the constant value all the time

Source code in stemflow/model/dummy_model.py
class dummy_model1(BaseEstimator):
    """A dummy model that predict the constant value all the time"""

    def __init__(self, the_value: Union[float, int]):
        """Make dummy model1 class

        Args:
            the_value: The dummy value

        """
        self.the_value = float(the_value)
        pass

    def fit(self, X_train, y_train):
        """Fake fit"""
        pass

    def predict(self, X_test):
        """Fake predict"""
        return np.array([self.the_value] * X_test.shape[0])

    def predict_proba(self, X_test):
        """Fake predict_proba"""
        if self.the_value == 0:
            return np.array([[1, 0]] * X_test.shape[0])
        elif self.the_value == 1:
            return np.array([[0, 1]] * X_test.shape[0])

__init__(the_value)

Make dummy model1 class

Parameters:

  • the_value (Union[float, int]) –

    The dummy value

Source code in stemflow/model/dummy_model.py
def __init__(self, the_value: Union[float, int]):
    """Make dummy model1 class

    Args:
        the_value: The dummy value

    """
    self.the_value = float(the_value)
    pass

fit(X_train, y_train)

Fake fit

Source code in stemflow/model/dummy_model.py
def fit(self, X_train, y_train):
    """Fake fit"""
    pass

predict(X_test)

Fake predict

Source code in stemflow/model/dummy_model.py
def predict(self, X_test):
    """Fake predict"""
    return np.array([self.the_value] * X_test.shape[0])

predict_proba(X_test)

Fake predict_proba

Source code in stemflow/model/dummy_model.py
def predict_proba(self, X_test):
    """Fake predict_proba"""
    if self.the_value == 0:
        return np.array([[1, 0]] * X_test.shape[0])
    elif self.the_value == 1:
        return np.array([[0, 1]] * X_test.shape[0])