-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samuel Abramov
committed
Oct 20, 2023
1 parent
af01c5a
commit 8c969fd
Showing
9 changed files
with
108 additions
and
19 deletions.
There are no files selected for viewing
9 changes: 7 additions & 2 deletions
9
lib/src/main/java/de/edux/data/handler/DropIncompleteRecordsHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
lib/src/test/java/de/edux/data/handler/DropIncompleteRecordsHandlerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package de.edux.data.handler; | ||
|
||
import de.edux.data.provider.SeabornDataProcessor; | ||
import de.edux.data.provider.SeabornProvider; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
import java.net.URL; | ||
import java.util.Optional; | ||
|
||
class DropIncompleteRecordsHandlerTest { | ||
private static final boolean SHUFFLE = true; | ||
private static final boolean SKIP_HEADLINE = true; | ||
private static final EIncompleteRecordsHandlerStrategy INCOMPLETE_RECORD_HANDLER_STRATEGY = EIncompleteRecordsHandlerStrategy.DROP_RECORDS; | ||
private static final double TRAIN_TEST_SPLIT_RATIO = 0.7; | ||
private static final String CSV_FILE_PATH = "testdatasets/seaborn-penguins/penguins.csv"; | ||
private SeabornProvider seabornProvider; | ||
|
||
@Test | ||
void shouldReturnColumnData() { | ||
URL url = DropIncompleteRecordsHandlerTest.class.getClassLoader().getResource(CSV_FILE_PATH); | ||
if (url == null) { | ||
throw new IllegalStateException("Cannot find file: " + CSV_FILE_PATH); | ||
} | ||
File csvFile = new File(url.getPath()); | ||
var seabornDataProcessor = new SeabornDataProcessor(); | ||
var dataset = seabornDataProcessor.loadDataSetFromCSV(csvFile, ',', true, true, INCOMPLETE_RECORD_HANDLER_STRATEGY); | ||
seabornDataProcessor.normalize(dataset); | ||
Optional<Integer> indexOfSpecies = seabornDataProcessor.getIndexOfColumn("species"); | ||
String[] speciesData = seabornDataProcessor.getColumnDataOf("species"); | ||
|
||
assert indexOfSpecies.isPresent(); | ||
assert speciesData.length > 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters