Change how trees are saved so that they are compressed.

This commit is contained in:
Joel Therrien 2018-07-18 15:29:55 -07:00
parent dc9d20aa1a
commit d4853f5232
2 changed files with 3 additions and 2 deletions

View file

@ -66,7 +66,7 @@ public class DataLoader {
final List<Tree<O>> treeList = new ArrayList<>(treeFileList.size()); final List<Tree<O>> treeList = new ArrayList<>(treeFileList.size());
for(final File treeFile : treeFileList){ 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<O> tree = (Tree) inputStream.readObject(); final Tree<O> tree = (Tree) inputStream.readObject();

View file

@ -18,6 +18,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.zip.GZIPOutputStream;
@Builder @Builder
@AllArgsConstructor(access=AccessLevel.PRIVATE) @AllArgsConstructor(access=AccessLevel.PRIVATE)
@ -163,7 +164,7 @@ public class ForestTrainer<Y, TO, FO> {
public void saveTree(final Tree<TO> tree, String name) throws IOException { public void saveTree(final Tree<TO> tree, String name) throws IOException {
final String filename = saveTreeLocation + "/" + name; 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); outputStream.writeObject(tree);