diff --git a/src/main/java/ca/joeltherrien/randomforest/DataLoader.java b/src/main/java/ca/joeltherrien/randomforest/DataLoader.java index 09d5e96..0d999cb 100644 --- a/src/main/java/ca/joeltherrien/randomforest/DataLoader.java +++ b/src/main/java/ca/joeltherrien/randomforest/DataLoader.java @@ -66,7 +66,7 @@ public class DataLoader { final List> treeList = new ArrayList<>(treeFileList.size()); for(final File treeFile : treeFileList){ - final ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(treeFile)); + final ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(new FileInputStream(treeFile))); final Tree tree = (Tree) inputStream.readObject(); diff --git a/src/main/java/ca/joeltherrien/randomforest/tree/ForestTrainer.java b/src/main/java/ca/joeltherrien/randomforest/tree/ForestTrainer.java index fcdd111..7896519 100644 --- a/src/main/java/ca/joeltherrien/randomforest/tree/ForestTrainer.java +++ b/src/main/java/ca/joeltherrien/randomforest/tree/ForestTrainer.java @@ -18,6 +18,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.zip.GZIPOutputStream; @Builder @AllArgsConstructor(access=AccessLevel.PRIVATE) @@ -163,7 +164,7 @@ public class ForestTrainer { public void saveTree(final Tree tree, String name) throws IOException { final String filename = saveTreeLocation + "/" + name; - final ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(filename)); + final ObjectOutputStream outputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(filename))); outputStream.writeObject(tree);