src/main/java/com/feedzai/fos/impl/weka/WekaScorer.java
@Override
    @NotNull
    public List<double[]> score(List<UUID> modelIds, Object[] scorable) throws FOSException {
        checkNotNull(modelIds, "Models to score cannot be null");
        checkNotNull(scorable, "Instance cannot be null");

        List<double[]> scores = new ArrayList<>(modelIds.size());

        try {
            reloadModelsLock.readLock().lock();

            if (modelIds.size() == 1) {
                // if only one model, then don't parallelize scoring
                WekaThreadSafeScorer wekaThreadSafeScorer = getScorer(modelIds.get(0));
                scores.add(wekaThreadSafeScorer.score(scorable));
            } else {
                Map<UUID, Future<double[]>> futureScores = new HashMap<>(modelIds.size());

                // scatter
                for (UUID modelId : modelIds) {
                    WekaThreadSafeScorer wekaThreadSafeScorer = getScorer(modelId);
                    futureScores.put(modelId, executorService.submit(new AsyncScoringTask(wekaThreadSafeScorer, scorable)));
                }
                // gather
                for (UUID modelId : modelIds) {
                    scores.add(getFuture(futureScores.get(modelId), modelId));
                }
            }
        } finally {
            reloadModelsLock.readLock().unlock();
        }

        return scores;
    }
@Override
    @NotNull
    public List<double[]> score(List<UUID> modelIds, Object[] scorable) throws FOSException {
        checkNotNull(modelIds, "Models to score cannot be null");
        checkNotNull(scorable, "Instance cannot be null");

        List<double[]> scores = new ArrayList<>(modelIds.size());

        try {
            reloadModelsLock.readLock().lock();

            if (modelIds.size() == 1) {
                // if only one model, then don't parallelize scoring
                WekaThreadSafeScorer wekaThreadSafeScorer = getScorer(modelIds.get(0));
                scores.add(wekaThreadSafeScorer.score(scorable));
            } else {
                Map<UUID, Future<double[]>> futureScores = new HashMap<>(modelIds.size());

                // scatter
                for (UUID modelId : modelIds) {
                    WekaThreadSafeScorer wekaThreadSafeScorer = getScorer(modelId);
                    futureScores.put(modelId, executorService.submit(new AsyncScoringTask(wekaThreadSafeScorer, scorable)));
                }
                // gather
                for (UUID modelId : modelIds) {
                    scores.add(getFuture(futureScores.get(modelId), modelId));
                }
            }
        } finally {
            reloadModelsLock.readLock().unlock();
        }

        return scores;
    }
@ Override @ NotNull public List < double [ ] > score ( List < UUID > modelIds , Object [ ] scorable ) throws FOSException { checkNotNull ( modelIds , "Models to score cannot be null" ) ; checkNotNull ( scorable , "Instance cannot be null" ) ; List < double [ ] > scores = new ArrayList <> ( modelIds . size ( ) ) ; try { reloadModelsLock . readLock ( ) . lock ( ) ; if ( modelIds . size ( ) == 1 ) { // if only one model, then don't parallelize scoring WekaThreadSafeScorer wekaThreadSafeScorer = getScorer ( modelIds . get ( 0 ) ) ; scores . add ( wekaThreadSafeScorer . score ( scorable ) ) ; } else { Map < UUID , Future < double [ ] > > futureScores = new HashMap <> ( modelIds . size ( ) ) ; // scatter for ( UUID modelId : modelIds ) { WekaThreadSafeScorer wekaThreadSafeScorer = getScorer ( modelId ) ; futureScores . put ( modelId , executorService . submit ( new AsyncScoringTask ( wekaThreadSafeScorer , scorable ) ) ) ; } // gather for ( UUID modelId : modelIds ) { scores . add ( getFuture ( futureScores . get ( modelId ) , modelId ) ) ; } } } finally { reloadModelsLock . readLock ( ) . unlock ( ) ; } return scores ; }
Score the <code>scorable</code> for each model ID identified by <code>modelIds</code>.

<p> If multiple models are given as parameters, they will be scored in parallel.

@param modelIds the list of models to score
@param scorable the item to score
@return a List of scores with the same order and the received modelIds
@throws FOSException when classification was not possible
Score the <code > scorable< / code > for each model ID identified by <code > modelIds< / code > .