Package com.logicaldoc.ai
Class AIModel<F,S>
java.lang.Object
com.logicaldoc.core.PersistentObject
com.logicaldoc.ai.AIModel<F,S>
- Type Parameters:
F
- The type of featuresS
- The type of values in the results prediction
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NaturalLanguageModel
,NeuralNetwork
@Entity
public abstract class AIModel<F,S>
extends com.logicaldoc.core.PersistentObject
Represents an AI task, we have different implementations persisted in the
same table using a discriminator.
- Since:
- 9.2
- Author:
- Marco Meschieri - LogicalDOC
- See Also:
-
Field Summary
FieldsFields inherited from class com.logicaldoc.core.PersistentObject
DELETED_CODE_DEFAULT, DELETED_CODE_STRONG, id
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the ordered list of feature namesgetLabel()
getName()
int
hashCode()
static AIModel
Factory method for instantiating a new modelfinal QueryResult
<S> query
(List<F> features, AIModelHistory transaction) Queries the model with the given featuresvoid
setDescription
(String description) void
void
void
setTraining
(Training training) toString()
types()
Methods inherited from class com.logicaldoc.core.PersistentObject
getCreation, getDeleted, getId, getLastModified, getRecordVersion, getTenantId, setCreation, setDeleted, setId, setLastModified, setRecordVersion, setTenantId
-
Field Details
-
AIQUERY
- See Also:
-
AIQUERY_HYPHEN
- See Also:
-
-
Method Details
-
getTraining
-
setTraining
-
getName
-
setName
-
getLabel
-
setLabel
-
getDescription
-
setDescription
-
getFeaturesList
Gets the ordered list of feature names- Returns:
- list of feature names
-
query
public final QueryResult<S> query(List<F> features, AIModelHistory transaction) throws AIException, com.logicaldoc.core.exception.FeatureDisabledException, IOException, com.logicaldoc.core.PersistenceException Queries the model with the given features- Parameters:
features
- array of feature values to evaluatetransaction
- the current session- Returns:
- The predicted result
- Throws:
AIException
- Error in the AI engineIOException
- I/O errorcom.logicaldoc.core.exception.FeatureDisabledException
- The functionality is not availablecom.logicaldoc.core.PersistenceException
- Error in the data layer
-
toString
- Overrides:
toString
in classcom.logicaldoc.core.PersistentObject
-
newModel
public static AIModel newModel(String type) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException Factory method for instantiating a new model- Parameters:
type
- Type of sampler, matches the discriminator value- Returns:
- The new model
- Throws:
ClassNotFoundException
- The class loader was unable to load the sampler classInstantiationException
- Error instantiating the sampler implementationIllegalAccessException
- The implementation class exists but cannot be accessedIllegalArgumentException
- No implementation found for the given typeInvocationTargetException
- The constructor raised an errorNoSuchMethodException
- No empty constructorSecurityException
- The implementation class exists but cannot be accessed
-
types
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.logicaldoc.core.PersistentObject
-
equals
- Overrides:
equals
in classcom.logicaldoc.core.PersistentObject
-