Skip to content

Commit

Permalink
WIP debug
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-at-orange committed Mar 18, 2024
1 parent edb435b commit 22f6e9a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/Learning/KWDataPreparation/KWProbabilityTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,73 @@ void KWProbabilityTable::Test()
cout << "Source probability table (log)\n" << probabilityTable << endl;
delete testDataGrid;
}

boolean KWProbabilityTable::Test2()
{
KWDataGridStats* testDataGrid;
KWProbabilityTable probabilityTable;

// Non supervise
cout << "Unsupervised (1)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(0, 1, false, 0, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;
//
cout << "Unsupervised (2)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(1, 1, false, 0, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;
//
cout << "Unsupervised simple(3)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(2, 1, true, 0, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;

// Supervise
cout << "Supervised (1, 1)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(1, 1, false, 1, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;
//
cout << "Supervised simple (2, 1)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(2, 1, true, 2, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;
//
cout << "Supervised(1, 2)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(1, 2, false, 1, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;
//
cout << "Supervised(2, 2)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(2, 2, false, 2, 2, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Probability table\n" << probabilityTable << endl;
delete testDataGrid;
cout << "Supervised (1, 1)\n--------------------\n";
testDataGrid = KWDataGridStats::CreateTestDataGrid(0, 2, true, 1, 3, 3);
cout << *testDataGrid << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, false);
cout << "Target probability table\n" << probabilityTable << endl;
probabilityTable.ImportDataGridStats(testDataGrid, true, true);
cout << "Target probability table (log)\n" << probabilityTable << endl;
probabilityTable.ImportDataGridStats(testDataGrid, false, false);
cout << "Source probability table\n" << probabilityTable << endl;
probabilityTable.ImportDataGridStats(testDataGrid, false, true);
cout << "Source probability table (log)\n" << probabilityTable << endl;
delete testDataGrid;
return true;
}
1 change: 1 addition & 0 deletions src/Learning/KWDataPreparation/KWProbabilityTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class KWProbabilityTable : public Object

// Test
static void Test();
static void Test2();

/////////////////////////////////////////////////////////
//// Implementation
Expand Down
5 changes: 5 additions & 0 deletions test/Learning/Learning_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ KHIOPS_TEST(KWData, KWClassDomain, KWClassDomain::Test);

// Librairie KWDataPreparation
KHIOPS_TEST(KWDataPreparation, KWQuantileIntervalBuilder, KWQuantileIntervalBuilder::Test);
TEST(KWDataPreparation, KWProbabilityTable2)
{
EXPECT_TRUE(KWProbabilityTable::Test2);
}

KHIOPS_TEST(KWDataPreparation, KWProbabilityTable, KWProbabilityTable::Test);

} // namespace

0 comments on commit 22f6e9a

Please sign in to comment.