Package org.grouplens.lenskit.util.io

Examples of org.grouplens.lenskit.util.io.CompressionMode


        Stopwatch timer = Stopwatch.createStarted();
        LenskitRecommenderEngine engine = builder.build();
        timer.stop();
        logger.info("built model in {}", timer);
        File output = getOutputFile();
        CompressionMode comp = CompressionMode.autodetect(output);
        logger.info("writing model to {}", output);
        Closer closer = Closer.create();
        try {
            OutputStream stream = closer.register(new FileOutputStream(output));
            stream = closer.register(comp.wrapOutput(stream));
            engine.write(stream);
        } catch (Throwable th) {
            throw closer.rethrow(th);
        } finally {
            closer.close();
View Full Code Here


     */
    public LenskitRecommenderEngine load(File file) throws IOException, RecommenderConfigurationException {
        logger.info("Loading recommender engine from {}", file);
        FileInputStream input = new FileInputStream(file);
        try {
            CompressionMode effComp = compressionMode.getEffectiveCompressionMode(file.getName());
            logger.info("using {} compression", effComp);
            return loadInternal(effComp.wrapInput(input));
        } finally {
            input.close();
        }
    }
View Full Code Here

                loader.addConfiguration(config);
            }
            loader.addConfiguration(input.getConfiguration());
            Stopwatch timer = Stopwatch.createStarted();
            LenskitRecommenderEngine engine;
            CompressionMode comp = CompressionMode.autodetect(modelFile);
            InputStream input = new FileInputStream(modelFile);
            try {
                input = comp.wrapInput(input);
                engine = loader.load(input);
            } finally {
                input.close();
            }
            timer.stop();
View Full Code Here

TOP

Related Classes of org.grouplens.lenskit.util.io.CompressionMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.