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
from collections import OrderedDict | |
from typing import Dict, Any, Mapping | |
from django.core.exceptions import ValidationError as DjangoValidationError | |
from rest_framework import serializers | |
from rest_framework.fields import set_value, get_error_detail, SkipField | |
from rest_framework.exceptions import ValidationError | |
from rest_framework.settings import api_settings | |
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
@Test | |
public void testParallelScoring() throws ModelLoadingException, ExecutionException, InterruptedException { | |
final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1); | |
final ClassificationH2OModel firstModel = getFirstModel(); | |
final Instance oneInstance = getDummyInstance(); | |
final Instance anotherInstance = getDummyInstanceDifferentResult(); | |
//The expected values -> scored in the same thread. | |
final double[] oneExpected = firstModel.getClassDistribution(oneInstance); | |
final double[] otherExpected = firstModel.getClassDistribution(anotherInstance); |