Skip to content

Commit

Permalink
#4418 - Improve CAS loading during training
Browse files Browse the repository at this point in the history
- Pull prediction code out of the recommender service and into the prediction task
  • Loading branch information
reckart committed Dec 31, 2023
1 parent 6b26b0e commit f41b6a4
Show file tree
Hide file tree
Showing 9 changed files with 931 additions and 816 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import de.tudarmstadt.ukp.inception.recommendation.api.model.SuggestionGroup;
import de.tudarmstadt.ukp.inception.recommendation.api.recommender.RecommendationEngineFactory;
import de.tudarmstadt.ukp.inception.recommendation.api.recommender.RecommenderContext;
import de.tudarmstadt.ukp.inception.scheduling.TaskMonitor;
import de.tudarmstadt.ukp.inception.schema.api.adapter.AnnotationException;
import de.tudarmstadt.ukp.inception.support.logging.LogMessageGroup;

Expand Down Expand Up @@ -250,45 +249,6 @@ void skipSuggestion(String aSessionOwner, SourceDocument aDocument, String aData
AnnotationSuggestion aSuggestion, LearningRecordChangeLocation aLocation)
throws AnnotationException;

/**
* Compute predictions.
*
* @param aSessionOwner
* the user to compute the predictions for.
* @param aProject
* the project to compute the predictions for.
* @param aDocuments
* the documents to compute the predictions for.
* @param aDataOwner
* the owner of the annotations.
* @return the new predictions.
*/
Predictions computePredictions(User aSessionOwner, Project aProject,
List<SourceDocument> aDocuments, String aDataOwner, TaskMonitor aMonitor);

/**
* Compute predictions.
*
* @param aSessionOwner
* the user to compute the predictions for.
* @param aProject
* the project to compute the predictions for.
* @param aCurrentDocument
* the document to compute the predictions for.
* @param aDataOwner
* the owner of the annotations.
* @param aInherit
* any documents for which to inherit the predictions from a previous run
* @param aPredictionBegin
* begin of the prediction range (negative to predict from 0)
* @param aPredictionEnd
* end of the prediction range (negative to predict until the end of the document)
* @return the new predictions.
*/
Predictions computePredictions(User aSessionOwner, Project aProject,
SourceDocument aCurrentDocument, String aDataOwner, List<SourceDocument> aInherit,
int aPredictionBegin, int aPredictionEnd, TaskMonitor aMonitor);

/**
* Determine the visibility of suggestions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;
import java.util.Optional;

import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.inception.recommendation.api.recommender.RecommenderContext.Key;
import de.tudarmstadt.ukp.inception.support.logging.LogMessage;

Expand All @@ -31,7 +30,6 @@ public class PredictionContext
private RecommenderContext modelContext;
private List<LogMessage> messages;
private boolean closed = false;
private Optional<User> user;

public PredictionContext(RecommenderContext aCtx)
{
Expand Down Expand Up @@ -76,14 +74,4 @@ synchronized public boolean isClosed()
{
return closed;
}

public Optional<User> getUser()
{
return user;
}

public void setUser(User aUser)
{
user = Optional.ofNullable(aUser);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ public RecommendationService recommendationService(PreferencesService aPreferenc
SessionRegistry aSessionRegistry, UserDao aUserRepository,
RecommenderFactoryRegistry aRecommenderFactoryRegistry,
SchedulingService aSchedulingService, AnnotationSchemaService aAnnoService,
DocumentService aDocumentService, ProjectService aProjectService,
ApplicationEventPublisher aApplicationEventPublisher,
ProjectService aProjectService, ApplicationEventPublisher aApplicationEventPublisher,
SuggestionSupportRegistry aLayerRecommendtionSupportRegistry)
{
return new RecommendationServiceImpl(aPreferencesService, aSessionRegistry, aUserRepository,
aRecommenderFactoryRegistry, aSchedulingService, aAnnoService, aDocumentService,
aProjectService, entityManager, aApplicationEventPublisher,
aLayerRecommendtionSupportRegistry);
aRecommenderFactoryRegistry, aSchedulingService, aAnnoService, aProjectService,
entityManager, aApplicationEventPublisher, aLayerRecommendtionSupportRegistry);
}

@Bean
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit f41b6a4

Please sign in to comment.