From 15b167c3ef40b7d9bf60ff1232b1e15a680e064e Mon Sep 17 00:00:00 2001 From: b0n541 Date: Mon, 9 Sep 2024 21:10:10 +0200 Subject: [PATCH] #157 Fix tests --- jskat-base/data/kermit_games_test.csv | 11 +++++++++++ .../org/jskat/ai/deeplearning/DataFrameDataSetTest.kt | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 jskat-base/data/kermit_games_test.csv diff --git a/jskat-base/data/kermit_games_test.csv b/jskat-base/data/kermit_games_test.csv new file mode 100644 index 00000000..f03d0e7a --- /dev/null +++ b/jskat-base/data/kermit_games_test.csv @@ -0,0 +1,11 @@ +declarer,♣A,♣T,♣K,♣Q,♣J,♣9,♣8,♣7,♠A,♠T,♠K,♠Q,♠J,♠9,♠8,♠7,♥A,♥T,♥K,♥Q,♥J,♥9,♥8,♥7,♦A,♦T,♦K,♦Q,♦J,♦9,♦8,♦7,maxBidForehand,maxBidMiddlehand,maxBidRearhand,gameType,hand,ouvert,annSchneider,annSchwarz,won,declarerScore,schneider,schwarz +MIDDLEHAND,1,1,0,0,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,36,36,SPADES,0,0,0,0,1,105,1,0 +MIDDLEHAND,0,0,1,0,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,20,22,0,SPADES,0,0,0,0,1,81,0,0 +FOREHAND,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,1,1,1,22,0,22,DIAMONDS,0,0,0,0,1,76,0,0 +MIDDLEHAND,1,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,0,0,18,0,CLUBS,0,0,0,0,1,91,1,0 +MIDDLEHAND,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,18,0,GRAND,0,0,0,0,1,120,1,1 +FOREHAND,0,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,0,18,0,18,HEARTS,0,0,0,0,1,63,0,0 +REARHAND,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,20,0,22,CLUBS,0,0,0,0,1,120,1,1 +MIDDLEHAND,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,24,24,CLUBS,0,0,0,0,1,120,1,1 +REARHAND,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,1,0,0,18,HEARTS,0,0,0,0,1,120,1,1 +FOREHAND,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,0,22,22,0,NULL,0,0,0,0,1,0,1,1 diff --git a/jskat-base/src/test/java/org/jskat/ai/deeplearning/DataFrameDataSetTest.kt b/jskat-base/src/test/java/org/jskat/ai/deeplearning/DataFrameDataSetTest.kt index e74b0e3c..1c655ee9 100644 --- a/jskat-base/src/test/java/org/jskat/ai/deeplearning/DataFrameDataSetTest.kt +++ b/jskat-base/src/test/java/org/jskat/ai/deeplearning/DataFrameDataSetTest.kt @@ -8,7 +8,7 @@ class DataFrameDataSetTest { @Test fun creation() { val builder = DataFrameDataSet.Builder() - builder.filePath = "/home/jan/git/jskat/data/kermit_games.csv" + builder.filePath = "data/kermit_games_test.csv" builder.setSampling(10, true) builder.addCategoricalFeature("declarer", true) listOf( @@ -23,7 +23,7 @@ class DataFrameDataSetTest { val dataSet = builder.build() dataSet.prepare() - assertThat(dataSet.size()).isEqualTo(100) + assertThat(dataSet.size()).isEqualTo(10) assertThat(dataSet.featureSize).isEqualTo(33) assertThat(dataSet.labelSize).isEqualTo(1) @@ -40,13 +40,13 @@ class DataFrameDataSetTest { assertThat(splitData.size).isEqualTo(2) val training = splitData[0] - assertThat(training.size()).isEqualTo(80) + assertThat(training.size()).isEqualTo(8) val record = training.get(ndManager, 0) assertThat(record.data[0].size()).isEqualTo(35) assertThat(record.labels[0].size()).isEqualTo(6) val test = splitData[1] - assertThat(test.size()).isEqualTo(20) + assertThat(test.size()).isEqualTo(2) } } \ No newline at end of file