Пример #1
0
def statistics(trainingData, testData, learner, protectedIndex, protectedValue):
   h = learner(trainingData)

   trainingError = labelError(trainingData, h)
   testError = labelError(testData, h)
   sp = statisticalParity(testData, protectedIndex, protectedValue, h)
   UBIF = individualFairness(trainingData, learner, FLIP_PROPORTION)

   return trainingError, testError, sp, UBIF
Пример #2
0
def runBaseline(trainingData, testData, learner, protectedIndex, protectedValue):
   h = learner(trainingData)

   print("Training error: %f" % labelError(trainingData, h))
   print("Test error: %f" % labelError(testData, h))
   print("SP of the hypothesis: %f" % statisticalParity(testData, protectedIndex, protectedValue, h))

   UBIF = individualFairness(trainingData, learner, FLIP_PROPORTION)
   print("UBIF of the hypothesis on training: %f" % UBIF)
Пример #3
0
def statistics(trainingData, testData, learner, protectedIndex,
               protectedValue):
    h = learner(trainingData)

    trainingError = labelError(trainingData, h)
    testError = labelError(testData, h)
    sp = statisticalParity(testData, protectedIndex, protectedValue, h)
    UBIF = individualFairness(trainingData, learner, FLIP_PROPORTION)

    return trainingError, testError, sp, UBIF
Пример #4
0
def runBaseline(trainingData, testData, learner, protectedIndex,
                protectedValue):
    h = learner(trainingData)

    print("Training error: %f" % labelError(trainingData, h))
    print("Test error: %f" % labelError(testData, h))
    print("SP of the hypothesis: %f" %
          statisticalParity(testData, protectedIndex, protectedValue, h))

    UBIF = individualFairness(trainingData, learner, FLIP_PROPORTION)
    print("UBIF of the hypothesis on training: %f" % UBIF)
Пример #5
0
def statistics(train, test, protectedIndex, protectedValue, learner):
    h = learner(train, protectedIndex, protectedValue)
    print("Computing error")
    error = labelError(test, h)
    print("Computing bias")
    bias = signedStatisticalParity(test, protectedIndex, protectedValue, h)
    print("Computing UBIF")
    ubif = individualFairness(train, learner, 0.2, passProtected=True)
    return error, bias, ubif
Пример #6
0
def statistics(train, test, protectedIndex, protectedValue, learner):
   h = learner(train, protectedIndex, protectedValue)
   print("Computing error")
   error = labelError(test, h)
   print("Computing bias")
   bias = signedStatisticalParity(test, protectedIndex, protectedValue, h)
   print("Computing UBIF")
   ubif = individualFairness(train, learner, flipProportion=0.2, passProtected=True)
   return error, bias, ubif
Пример #7
0
def statistics(massager, trainingData, testData, protectedIndex, protectedValue,
               learner, flipProportion=0.2):
   massagedData = massager(trainingData, protectedIndex, protectedValue)
   h = learner(massagedData)

   error = labelError(testData, h)
   bias = signedStatisticalParity(testData, protectedIndex, protectedValue, h)
   ubif = individualFairness(trainingData, learner, flipProportion)

   return error, bias, ubif
Пример #8
0
def statistics(train, test, protectedIndex, protectedValue, numRounds=20):
   weight = 0.5
   flipProportion = 0.2

   error = makeErrorFunction(protectedIndex, protectedValue, weight)
   weakLearner = lambda draw: buildDecisionStump(draw, errorFunction=error)

   h = boosting.boost(train, weakLearner=weakLearner)

   bias = ef.signedStatisticalParity(test, protectedIndex, protectedValue, h)
   error = ef.labelError(test, h)
   ubif = ef.individualFairness(train, boosting.boost, flipProportion)

   return error, bias, ubif
def statistics(train, test, protectedIndex, protectedValue, numRounds=20):
   weight = 0.5
   flipProportion = 0.2

   error = makeErrorFunction(protectedIndex, protectedValue, weight)
   weakLearner = lambda draw: buildDecisionStump(draw, errorFunction=error)

   h = boosting.boost(train, weakLearner = weakLearner)

   bias = ef.signedStatisticalParity(test, protectedIndex, protectedValue, h)
   error = ef.labelError(test, h)
   ubif = ef.individualFairness(train, boosting.boost, flipProportion)

   return error, bias, ubif