eab3c82cabf192154e6f4e9d16615885c7eefc14,art/metrics/privacy/membership_leakage.py,,PDTP,#Any#Any#Any#Any#Any#Any#,36

Before Change


                    "PDTP metric only supports classifiers that output logits or probabilities."
                )
        // divide into 100 bins and return center of bin
        pred_bin = (np.floor(pred * 100) / 100).round(decimals=2) + 0.005
        pred_bin[pred_bin > 1] = 0.995

        if not indexes:
            indexes = range(x.shape[0])

After Change


                    "PDTP metric only supports classifiers that output logits or probabilities."
                )
        // divide into 100 bins and return center of bin
        bins = np.array(np.arange(0.0, 1.01, 0.01).round(decimals=2))
        pred_bin_indexes = np.digitize(pred, bins)
        pred_bin = bins[pred_bin_indexes] - 0.005

        if not indexes:
            indexes = range(x.shape[0])
        for row in indexes:
            // create new model without sample in training data
            alt_x = np.delete(x, row, 0)
            alt_y = np.delete(y, row, 0)
            try:
                extra_estimator.reset()
            except NotImplementedError:
                raise ValueError(
                    "PDTP metric can only be applied to classifiers that implement the reset method."
                )
            extra_estimator.fit(alt_x, alt_y)
            // get probabilities from new model
            alt_pred = extra_estimator.predict(x)
            if not is_probability(alt_pred):
                alt_pred = scipy.special.softmax(alt_pred, axis=1)
            // divide into 100 bins and return center of bin
            alt_pred_bin_indexes = np.digitize(alt_pred, bins)
            alt_pred_bin = bins[alt_pred_bin_indexes] - 0.005
            ratio_1 = pred_bin / alt_pred_bin
            ratio_2 = alt_pred_bin / pred_bin
            // get max value
            max_value = max(ratio_1.max(), ratio_2.max())
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: eab3c82cabf192154e6f4e9d16615885c7eefc14
Time: 2021-01-28
Author: abigailt@il.ibm.com
File Name: art/metrics/privacy/membership_leakage.py
Class Name:
Method Name: PDTP


Project Name: SheffieldML/GPy
Commit Name: 336f8e11c48bb4e749b9f389907c450e44f02786
Time: 2013-10-28
Author: alan.daniel.saul@gmail.com
File Name: GPy/examples/regression.py
Class Name:
Method Name: toy_poisson_rbf_1d


Project Name: SheffieldML/GPy
Commit Name: 336f8e11c48bb4e749b9f389907c450e44f02786
Time: 2013-10-28
Author: alan.daniel.saul@gmail.com
File Name: GPy/examples/regression.py
Class Name:
Method Name: toy_poisson_rbf_1d_laplace