def test_general_cancer_lr(breast_cancer_dataset):
    """
    Check whether the produced adversaries are correct,
    given Logistic Regression classifier and breast cancer wisconsin dataset.
    """
    (x_train, y_train, x_valid, y_valid), _, clip_values = breast_cancer_dataset

    # Setup classifier
    lr_clf = LogisticRegression(penalty=None)
    lr_clf.fit(x_train, y_train)
    clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)

    lpf_slr = LowProFool(classifier=clf_slr, n_steps=30, eta=0.02, lambd=1.5)
    lpf_slr.fit_importances(x_train, y_train)

    sample = x_valid

    # Draw targets different from original labels and then save as one-hot encoded.
    target = np.eye(2)[np.array(y_valid.apply(lambda x: np.random.choice([i for i in [0, 1] if i != x])))]

    adversaries = lpf_slr.generate(x=sample, y=target)
    expected = np.argmax(target, axis=1)
    predicted = np.argmax(lr_clf.predict_proba(adversaries), axis=1)
    correct = expected == predicted

    success_rate = np.sum(correct) / correct.shape[0]
    expected = 0.6

    logger.info(
        "[Breast cancer, Scikit-learn Logistic Regression] success rate of adversarial attack (expected >{:.2f}): "
        "{:.2f}%".format(expected * 100, success_rate * 100)
    )
    assert success_rate > expected

    Check whether the produced adversaries are correct,
    given Logistic Regression classifier and breast cancer wisconsin dataset.
    
tests/attacks/evasion/test_lowprofool.py