From f5ac85b44419edf00f5fdf9721e164791d9fa8f3 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 8 Mar 2024 19:15:02 +0100 Subject: [PATCH 1/3] Remove 2 redundant tiles --- .../tiles/fairness/pipeline/Package.scala | 6 +- .../soda/tiles/fairness/pipeline/Package.soda | 2 - .../pipeline/UnbiasednessPipeline.soda | 4 +- .../soda/tiles/fairness/tile/Package.scala | 57 ------------------- .../soda/tiles/fairness/tile/ResultPTile.soda | 20 ------- .../soda/tiles/fairness/tile/WithPTile.soda | 20 ------- docs/scoring_example.md | 7 +-- 7 files changed, 7 insertions(+), 109 deletions(-) delete mode 100644 core/src/main/scala/soda/tiles/fairness/tile/ResultPTile.soda delete mode 100644 core/src/main/scala/soda/tiles/fairness/tile/WithPTile.soda diff --git a/core/src/main/scala/soda/tiles/fairness/pipeline/Package.scala b/core/src/main/scala/soda/tiles/fairness/pipeline/Package.scala index 18c9e4e..34d35f2 100644 --- a/core/src/main/scala/soda/tiles/fairness/pipeline/Package.scala +++ b/core/src/main/scala/soda/tiles/fairness/pipeline/Package.scala @@ -28,14 +28,12 @@ import soda.tiles.fairness.tile.FalsePosTile import soda.tiles.fairness.tile.NeededPTile import soda.tiles.fairness.tile.PredictionPTile import soda.tiles.fairness.tile.ReceivedSigmaPTile -import soda.tiles.fairness.tile.ResultPTile import soda.tiles.fairness.tile.SigmaTile import soda.tiles.fairness.tile.UnzipPairFstTile import soda.tiles.fairness.tile.UnzipPairSndTile import soda.tiles.fairness.tile.UnzipTripleFstTile import soda.tiles.fairness.tile.UnzipTripleSndTile import soda.tiles.fairness.tile.UnzipTripleTrdTile -import soda.tiles.fairness.tile.WithPTile import soda.tiles.fairness.tile.ZipTile @@ -190,9 +188,9 @@ trait UnbiasednessPipeline lazy val prediction_p_tile = PredictionPTile .mk (p0_evaluation) - lazy val result_p_tile = ResultPTile .mk (p1_result) + lazy val result_p_tile = AttributePTile .mk (p1_result) - lazy val with_p_tile = WithPTile .mk (p2_with_p) + lazy val with_p_tile = AttributePTile .mk (p2_with_p) lazy val false_pos_tile = FalsePosTile .mk diff --git a/core/src/main/scala/soda/tiles/fairness/pipeline/Package.soda b/core/src/main/scala/soda/tiles/fairness/pipeline/Package.soda index dec3a92..bc16bef 100644 --- a/core/src/main/scala/soda/tiles/fairness/pipeline/Package.soda +++ b/core/src/main/scala/soda/tiles/fairness/pipeline/Package.soda @@ -29,13 +29,11 @@ import soda.tiles.fairness.tile.NeededPTile soda.tiles.fairness.tile.PredictionPTile soda.tiles.fairness.tile.ReceivedSigmaPTile - soda.tiles.fairness.tile.ResultPTile soda.tiles.fairness.tile.SigmaTile soda.tiles.fairness.tile.UnzipPairFstTile soda.tiles.fairness.tile.UnzipPairSndTile soda.tiles.fairness.tile.UnzipTripleFstTile soda.tiles.fairness.tile.UnzipTripleSndTile soda.tiles.fairness.tile.UnzipTripleTrdTile - soda.tiles.fairness.tile.WithPTile soda.tiles.fairness.tile.ZipTile diff --git a/core/src/main/scala/soda/tiles/fairness/pipeline/UnbiasednessPipeline.soda b/core/src/main/scala/soda/tiles/fairness/pipeline/UnbiasednessPipeline.soda index e3b5b4b..a8ddcad 100644 --- a/core/src/main/scala/soda/tiles/fairness/pipeline/UnbiasednessPipeline.soda +++ b/core/src/main/scala/soda/tiles/fairness/pipeline/UnbiasednessPipeline.soda @@ -37,9 +37,9 @@ class UnbiasednessPipeline prediction_p_tile = PredictionPTile .mk (p0_evaluation) - result_p_tile = ResultPTile .mk (p1_result) + result_p_tile = AttributePTile .mk (p1_result) - with_p_tile = WithPTile .mk (p2_with_p) + with_p_tile = AttributePTile .mk (p2_with_p) false_pos_tile = FalsePosTile .mk diff --git a/core/src/main/scala/soda/tiles/fairness/tile/Package.scala b/core/src/main/scala/soda/tiles/fairness/tile/Package.scala index f505588..2e38cf5 100644 --- a/core/src/main/scala/soda/tiles/fairness/tile/Package.scala +++ b/core/src/main/scala/soda/tiles/fairness/tile/Package.scala @@ -677,35 +677,6 @@ object ReceivedSigmaPTile { } -/* -directive lean -import Soda.tiles.fairness.tool.TileMessage -import Soda.tiles.fairness.tile.AttributePTile -*/ - -/** - * This tile is a particular case of an 'AttributePTile', where the attribute is the 'result'. - * This tile is used to contrast obtained results to predicted results. - */ - -trait ResultPTile -{ - - def p : Actor => Measure - - def apply (message : TileMessage [Seq [Actor] ] ) : TileMessage [Seq [Measure] ] = - AttributePTile .mk (p) .apply (message) - -} - -case class ResultPTile_ (p : Actor => Measure) extends ResultPTile - -object ResultPTile { - def mk (p : Actor => Measure) : ResultPTile = - ResultPTile_ (p) -} - - /* directive lean import Soda.tiles.fairness.tool.TileMessage @@ -912,34 +883,6 @@ object UnzipTripleTrdTile { } -/* -directive lean -import Soda.tiles.fairness.tool.TileMessage -import Soda.tiles.fairness.tile.AttributePTile -*/ - -/** - * This tile is a particular case of a 'AttributePTile', that projects given property. - */ - -trait WithPTile -{ - - def p : Actor => Measure - - def apply (message : TileMessage [Seq [Actor] ] ) : TileMessage [Seq [Measure] ] = - AttributePTile .mk (p) .apply (message) - -} - -case class WithPTile_ (p : Actor => Measure) extends WithPTile - -object WithPTile { - def mk (p : Actor => Measure) : WithPTile = - WithPTile_ (p) -} - - /* directive lean import Soda.tiles.fairness.tool.TileMessage diff --git a/core/src/main/scala/soda/tiles/fairness/tile/ResultPTile.soda b/core/src/main/scala/soda/tiles/fairness/tile/ResultPTile.soda deleted file mode 100644 index cea8cbd..0000000 --- a/core/src/main/scala/soda/tiles/fairness/tile/ResultPTile.soda +++ /dev/null @@ -1,20 +0,0 @@ - -directive lean -import Soda.tiles.fairness.tool.TileMessage -import Soda.tiles.fairness.tile.AttributePTile - - -/** - * This tile is a particular case of an 'AttributePTile', where the attribute is the 'result'. - * This tile is used to contrast obtained results to predicted results. - */ - -class ResultPTile - - abstract - p : Actor -> Measure - - apply (message : TileMessage [Seq [Actor] ] ) : TileMessage [Seq [Measure] ] = - AttributePTile .mk (p) .apply (message) - -end diff --git a/core/src/main/scala/soda/tiles/fairness/tile/WithPTile.soda b/core/src/main/scala/soda/tiles/fairness/tile/WithPTile.soda deleted file mode 100644 index eab4546..0000000 --- a/core/src/main/scala/soda/tiles/fairness/tile/WithPTile.soda +++ /dev/null @@ -1,20 +0,0 @@ - -directive lean -import Soda.tiles.fairness.tool.TileMessage -import Soda.tiles.fairness.tile.AttributePTile - - -/** - * This tile is a particular case of a 'AttributePTile', that projects given property. - */ - -class WithPTile - - abstract - p : Actor -> Measure - - apply (message : TileMessage [Seq [Actor] ] ) : TileMessage [Seq [Measure] ] = - AttributePTile .mk (p) .apply (message) - -end - diff --git a/docs/scoring_example.md b/docs/scoring_example.md index e6e2fef..2956cfe 100644 --- a/docs/scoring_example.md +++ b/docs/scoring_example.md @@ -11,9 +11,9 @@ These are some of the implemented fairness tiles for scoring scenarios: |:---------------------------------------------------|:---------------------------------------------| | all-actor *(a0), (a1), (a2)* | [AllActorTripleTile][AllActorTripleTile] | | *(a)* prediction *(m)* | [PredictionPTile][PredictionPTile] | -| *(a)* result *(m)* | [ResultPTile][ResultPTile] | +| *(a)* result *(m)* | [AttributePTile][AttributePTile] | | *(m0), (m1)* false-pos *(m)* | [FalsePosTile][FalsePosTile] | -| *(a)* with *(m)* | [WithPTile][WithPTile] | +| *(a)* with *(m)* | [AttributePTile][AttributePTile] | | *(m0), (m1)* correlation *m* | [CorrelationTile][CorrelationTile] | | *m* decision *b* | [DecisionTile][DecisionTile] | | unbiasedness *b* | [UnbiasednessPipeline][UnbiasednessPipeline] | @@ -40,9 +40,8 @@ graph LR [AllActorTripleTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/AllActorTripleTile.soda [PredictionPTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/PredictionPTile.soda -[ResultPTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/ResultPTile.soda +[AttributePTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/AttributePTile.soda [FalsePosTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/FalsePosTile.soda -[WithPTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/WithPTile.soda [CorrelationTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/CorrelationTile.soda [DecisionTile]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/tile/DecisionTile.soda [UnbiasednessPipeline]: https://github.com/julianmendez/tiles/blob/master/core/src/main/scala/soda/tiles/fairness/pipeline/UnbiasednessPipeline.soda From 66952d627de9e53347574260f864d0ce2581dc2a Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 8 Mar 2024 21:10:41 +0100 Subject: [PATCH 2/3] Fix imports --- .../soda/tiles/fairness/example/childcaresubsidy/Package.scala | 2 -- .../soda/tiles/fairness/example/childcaresubsidy/Package.soda | 2 -- 2 files changed, 4 deletions(-) diff --git a/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala b/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala index 1d7d38d..55125a7 100644 --- a/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala +++ b/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala @@ -27,14 +27,12 @@ import soda.tiles.fairness.tile.MapPTile import soda.tiles.fairness.tile.NeededPTile import soda.tiles.fairness.tile.PredictionPTile import soda.tiles.fairness.tile.ReceivedSigmaPTile -import soda.tiles.fairness.tile.ResultPTile import soda.tiles.fairness.tile.SigmaTile import soda.tiles.fairness.tile.UnzipPairFstTile import soda.tiles.fairness.tile.UnzipPairSndTile import soda.tiles.fairness.tile.UnzipTripleFstTile import soda.tiles.fairness.tile.UnzipTripleSndTile import soda.tiles.fairness.tile.UnzipTripleTrdTile -import soda.tiles.fairness.tile.WithPTile import soda.tiles.fairness.tile.ZipTile import soda.tiles.fairness.pipeline.EqualityPipeline import soda.tiles.fairness.pipeline.EquityPipeline diff --git a/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda b/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda index 0126c67..3cf34fa 100644 --- a/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda +++ b/examples/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda @@ -28,14 +28,12 @@ import soda.tiles.fairness.tile.NeededPTile soda.tiles.fairness.tile.PredictionPTile soda.tiles.fairness.tile.ReceivedSigmaPTile - soda.tiles.fairness.tile.ResultPTile soda.tiles.fairness.tile.SigmaTile soda.tiles.fairness.tile.UnzipPairFstTile soda.tiles.fairness.tile.UnzipPairSndTile soda.tiles.fairness.tile.UnzipTripleFstTile soda.tiles.fairness.tile.UnzipTripleSndTile soda.tiles.fairness.tile.UnzipTripleTrdTile - soda.tiles.fairness.tile.WithPTile soda.tiles.fairness.tile.ZipTile soda.tiles.fairness.pipeline.EqualityPipeline soda.tiles.fairness.pipeline.EquityPipeline From d37066ce21dfedd4ebfc09f67ee99c6bc8ad39ca Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 8 Mar 2024 21:52:30 +0100 Subject: [PATCH 3/3] Fix imports in tests --- .../soda/tiles/fairness/example/childcaresubsidy/Package.scala | 2 -- .../soda/tiles/fairness/example/childcaresubsidy/Package.soda | 2 -- 2 files changed, 4 deletions(-) diff --git a/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala b/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala index 9419f10..89783bc 100644 --- a/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala +++ b/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.scala @@ -30,14 +30,12 @@ import soda.tiles.fairness.tile.MapPTile import soda.tiles.fairness.tile.NeededPTile import soda.tiles.fairness.tile.PredictionPTile import soda.tiles.fairness.tile.ReceivedSigmaPTile -import soda.tiles.fairness.tile.ResultPTile import soda.tiles.fairness.tile.SigmaTile import soda.tiles.fairness.tile.UnzipPairFstTile import soda.tiles.fairness.tile.UnzipPairSndTile import soda.tiles.fairness.tile.UnzipTripleFstTile import soda.tiles.fairness.tile.UnzipTripleSndTile import soda.tiles.fairness.tile.UnzipTripleTrdTile -import soda.tiles.fairness.tile.WithPTile import soda.tiles.fairness.tile.ZipTile import soda.tiles.fairness.pipeline.EqualityPipeline import soda.tiles.fairness.pipeline.EquityPipeline diff --git a/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda b/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda index ff2054b..2ae9f54 100644 --- a/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda +++ b/examples/src/test/scala/soda/tiles/fairness/example/childcaresubsidy/Package.soda @@ -31,14 +31,12 @@ import soda.tiles.fairness.tile.NeededPTile soda.tiles.fairness.tile.PredictionPTile soda.tiles.fairness.tile.ReceivedSigmaPTile - soda.tiles.fairness.tile.ResultPTile soda.tiles.fairness.tile.SigmaTile soda.tiles.fairness.tile.UnzipPairFstTile soda.tiles.fairness.tile.UnzipPairSndTile soda.tiles.fairness.tile.UnzipTripleFstTile soda.tiles.fairness.tile.UnzipTripleSndTile soda.tiles.fairness.tile.UnzipTripleTrdTile - soda.tiles.fairness.tile.WithPTile soda.tiles.fairness.tile.ZipTile soda.tiles.fairness.pipeline.EqualityPipeline soda.tiles.fairness.pipeline.EquityPipeline