Search in sources :

Example 6 with ExtractFn

use of com.spotify.zoltar.FeatureExtractFns.ExtractFn in project zoltar by spotify.

the class PredictorTest method empty.

@Test
public void empty() throws InterruptedException, ExecutionException, TimeoutException {
    final Duration wait = Duration.ofSeconds(1);
    final ExtractFn<Object, Object> extractFn = inputs -> Collections.emptyList();
    final AsyncPredictFn<DummyModel, Object, Object, Object> predictFn = (model, vectors) -> CompletableFuture.completedFuture(Collections.emptyList());
    final ModelLoader<DummyModel> loader = ModelLoader.lift(DummyModel::new);
    DefaultPredictorBuilder.create(loader, extractFn, predictFn).predictor().predict().toCompletableFuture().get(wait.toMillis(), TimeUnit.MILLISECONDS);
}
Also used : SingleExtractFn(com.spotify.zoltar.FeatureExtractFns.SingleExtractFn) PredictFn(com.spotify.zoltar.PredictFns.PredictFn) Assert.assertTrue(org.junit.Assert.assertTrue) TimeoutException(java.util.concurrent.TimeoutException) CompletableFuture(java.util.concurrent.CompletableFuture) Test(org.junit.Test) AsyncPredictFn(com.spotify.zoltar.PredictFns.AsyncPredictFn) Collectors(java.util.stream.Collectors) Assert.assertThat(org.junit.Assert.assertThat) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Duration(java.time.Duration) Is.is(org.hamcrest.core.Is.is) ExtractFn(com.spotify.zoltar.FeatureExtractFns.ExtractFn) Assert.fail(org.junit.Assert.fail) Collections(java.util.Collections) Duration(java.time.Duration) Test(org.junit.Test)

Aggregations

ExtractFn (com.spotify.zoltar.FeatureExtractFns.ExtractFn)6 List (java.util.List)6 CompletableFuture (java.util.concurrent.CompletableFuture)6 Collectors (java.util.stream.Collectors)6 Test (org.junit.Test)6 Duration (java.time.Duration)5 PredictFn (com.spotify.zoltar.PredictFns.PredictFn)4 Collections (java.util.Collections)4 Assert.assertTrue (org.junit.Assert.assertTrue)4 SingleExtractFn (com.spotify.zoltar.FeatureExtractFns.SingleExtractFn)3 AsyncPredictFn (com.spotify.zoltar.PredictFns.AsyncPredictFn)3 Prediction (com.spotify.zoltar.Prediction)3 PredictorsTest (com.spotify.zoltar.PredictorsTest)3 FeatranExtractFns (com.spotify.zoltar.featran.FeatranExtractFns)3 URI (java.net.URI)3 StandardCharsets (java.nio.charset.StandardCharsets)3 Files (java.nio.file.Files)3 Paths (java.nio.file.Paths)3 ExecutionException (java.util.concurrent.ExecutionException)3 TimeUnit (java.util.concurrent.TimeUnit)3