def train_and_predict(X, W, Y, X_test):
    # Preprocess the features.
    X, X_test = preprocess(X, X_test)

    classifier = single_model()

    # Use the weight to hint the model to not treat each data instance as
    # equal, but put more attention to some of the data instance with more
    # weight.
    classifier.fit(X, Y, sample_weight = W)

    Y_pred = classifier.predict_proba(X)[:,1]
    Y_test_pred = classifier.predict_proba(X_test)[:,1]

    # We only predict an instance as signal if we are really confident,
    # because AMS score penalizses false positives far more than false
    # negatives.
    signal_threshold = 83
    cut = np.percentile(Y_test_pred, signal_threshold)
    thresholded_Y_pred = Y_pred > cut
    thresholded_Y_test_pred = Y_test_pred > cut
    
    return [Y_test_pred, thresholded_Y_test_pred]

#########################################################################
# Submission generation
#########################################################################
dataset/ETHPy150Open log0/higgs_boson/cleaned_model.py/train_and_predict/original