예제 #1
0
    def fast_objective(
        max_depth,
        max_leaf,
        l1,
        l2,
        min_samples_leaf,
        learning_rate,
    ):
        max_leaf = int(max_leaf)
        max_depth = int(max_depth)
        min_samples_leaf = int(min_samples_leaf)

        assert type(max_leaf) == int
        assert type(max_depth) == int
        assert type(min_samples_leaf) == int

        model = FastRGFClassifier(
            max_leaf=max_leaf,
            max_depth=max_depth,
            l1=l1,
            l2=l2,
            min_samples_leaf=min_samples_leaf,
            learning_rate=learning_rate,
        )
        model.fit(train_m, label_m)
        pred_proba = model.predict_proba(train_val)
        score = roc_auc_score(label_val, pred_proba[:, 1])
        return score
예제 #2
0
def run_model(X_train, y_train, X_val, y_val, params):
    l1 = params["l1"]
    l2 = params["l2"]
    learning_rate = params["learning_rate"]
    max_leaf = int(params["max_leaf"])
    max_depth = int(params["max_depth"])
    min_samples_leaf = int(params["min_samples_leaf"])

    model = FastRGFClassifier(
        max_leaf=max_leaf,
        max_depth=max_depth,
        l1=l1,
        l2=l2,
        min_samples_leaf=min_samples_leaf,
        learning_rate=learning_rate,
    )
    model.fit(X_train, y_train)
    pred_proba = model.predict_proba(X_val)[:, 1]
    score = roc_auc_score(y_val, pred_proba)

    return pred_proba, score