public class PLNetDyadRanker extends java.lang.Object implements IPLDyadRanker, IOnlineLearner<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>, ICertaintyProvider<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>
| Constructor and Description |
|---|
PLNetDyadRanker()
Constructs a new
PLNetDyadRanker using the default
IPLNetDyadRankerConfiguration. |
PLNetDyadRanker(IPLNetDyadRankerConfiguration config)
Constructs a new
PLNetDyadRanker using the given
IPLNetDyadRankerConfiguration. |
| Modifier and Type | Method and Description |
|---|---|
void |
createNetworkFromDl4jConfigFile(java.io.File configFile)
Creates a simple feed-forward
MultiLayerNetwork using the json
representation of a MultiLayerConfiguration in the file . |
double |
getCertainty(IDyadRankingInstance queryInstance)
Returns the certainty for a given
IInstance. |
IPredictiveModelConfiguration |
getConfiguration()
Returns the
IPredictiveModelConfiguration of this model. |
int |
getEpoch() |
double |
getLogProbabilityOfTopKRanking(IDyadRankingInstance drInstance,
int k)
Returns the log of the probablity of the top k of a given
IDyadRankingInstance under the Plackett Luce model parametrized by
the latent skill values predicted by the PLNet. |
double |
getLogProbabilityOfTopRanking(IDyadRankingInstance drInstance)
Returns the the log of the probablity of the top ranking for a given
IDyadRankingInstance under the Plackett Luce model parametrized by
the latent skill values predicted by the PLNet. |
double |
getLogProbabilityRanking(IDyadRankingInstance drInstance)
Computes the logarithmic probability for a particular ranking according to
the log Placket-Luce model.
|
IDyadRankingInstance |
getPairWithLeastCertainty(IDyadRankingInstance drInstance)
Returns the pair of
Dyads for which the model is least certain. |
org.deeplearning4j.nn.multilayer.MultiLayerNetwork |
getPlNet() |
double |
getProbabilityOfTopKRanking(IDyadRankingInstance drInstance,
int k) |
double |
getProbabilityOfTopRanking(IDyadRankingInstance drInstance)
Returns the probablity of the top ranking for a given
IDyadRankingInstance under the Plackett Luce model parametrized by
the latent skill values predicted by the PLNet. |
double |
getProbabilityRanking(IDyadRankingInstance drInstance)
Returns the probablity of a given
IDyadRankingInstance under the
Plackett Luce model parametrized by the latent skill values predicted by the
PLNet. |
double |
getSkillForDyad(Dyad dyad)
Returns the latent skill value predicted by the PLNet for a given
Dyad. |
void |
loadModelFromFile(java.lang.String filePath)
Restore a trained model from a given file path.
|
java.util.List<IDyadRankingInstance> |
predict(DyadRankingDataset dataset)
Performs multiple predictions based on the
IInstances contained in
the given AILabeledAttributeArrayDatasets and returns the result. |
IDyadRankingInstance |
predict(IDyadRankingInstance instance)
Performs a prediction based on the given
IInstance and returns the
result. |
void |
saveModelToFile(java.lang.String filePath)
Save a trained model at a given file path.
|
void |
setConfiguration(IPredictiveModelConfiguration configuration)
Sets the
IPredictiveModelConfiguration of this model to the given
one. |
void |
train(DyadRankingDataset dataset)
Trains this
IBatchLearner using the given AILabeledAttributeArrayDataset. |
void |
train(DyadRankingDataset dataset,
int maxEpochs,
double earlyStoppingTrainRatio) |
void |
train(java.util.List<org.nd4j.linalg.api.ndarray.INDArray> dataset) |
void |
train(java.util.List<org.nd4j.linalg.api.ndarray.INDArray> dataset,
int maxEpochs,
double earlyStoppingTrainRatio) |
void |
update(IDyadRankingInstance instance)
Updates this
PLNetDyadRanker based on the given IInstance,
which needs to be an IDyadRankingInstance. |
void |
update(java.util.Set<IDyadRankingInstance> instances)
|
public PLNetDyadRanker()
PLNetDyadRanker using the default
IPLNetDyadRankerConfiguration.public PLNetDyadRanker(IPLNetDyadRankerConfiguration config)
PLNetDyadRanker using the given
IPLNetDyadRankerConfiguration.config - Configuration for the PLNetDyadRanker.public void train(DyadRankingDataset dataset) throws TrainingException
IBatchLearnerIBatchLearner using the given AILabeledAttributeArrayDataset.train in interface IBatchLearner<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>dataset - The AILabeledAttributeArrayDataset which should be used for the training.TrainingException - If something fails during the training process.public void train(java.util.List<org.nd4j.linalg.api.ndarray.INDArray> dataset)
public void train(DyadRankingDataset dataset, int maxEpochs, double earlyStoppingTrainRatio)
public void train(java.util.List<org.nd4j.linalg.api.ndarray.INDArray> dataset,
int maxEpochs,
double earlyStoppingTrainRatio)
public void update(IDyadRankingInstance instance) throws TrainingException
PLNetDyadRanker based on the given IInstance,
which needs to be an IDyadRankingInstance. The update procedure is
based on algorithm 2 in [1].update in interface IOnlineLearner<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>instances - The IInstance the update should be based on. Needs to be a
IDyadRankingInstance.TrainingException - If something fails during the update process.public void update(java.util.Set<IDyadRankingInstance> instances) throws TrainingException
IOnlineLearnerupdate in interface IOnlineLearner<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>instances - The Set of IInstances the update should be based
on.TrainingException - If something fails during the update process.public IDyadRankingInstance predict(IDyadRankingInstance instance) throws PredictionException
IPredictiveModelIInstance and returns the
result.predict in interface IPredictiveModel<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>instance - The IInstance for which a prediction should be made.PredictionException - If something fails during the prediction process.public java.util.List<IDyadRankingInstance> predict(DyadRankingDataset dataset) throws PredictionException
IPredictiveModelIInstances contained in
the given AILabeledAttributeArrayDatasets and returns the result.predict in interface IPredictiveModel<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>dataset - The AILabeledAttributeArrayDataset for which predictions should be made.PredictionException - If something fails during the prediction process.public void setConfiguration(IPredictiveModelConfiguration configuration) throws ConfigurationException
IPredictiveModelIPredictiveModelConfiguration of this model to the given
one.setConfiguration in interface IPredictiveModel<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>ConfigurationException - If something fails during the configuration process.public IPredictiveModelConfiguration getConfiguration()
IPredictiveModelIPredictiveModelConfiguration of this model.getConfiguration in interface IPredictiveModel<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>IPredictiveModelConfiguration of this model.public void createNetworkFromDl4jConfigFile(java.io.File configFile)
MultiLayerNetwork using the json
representation of a MultiLayerConfiguration in the file .configFile - File containing the json representation of the
MultiLayerConfigurationpublic void saveModelToFile(java.lang.String filePath)
throws java.io.IOException
filePath - The file path to save to.java.io.IOExceptionpublic void loadModelFromFile(java.lang.String filePath)
throws java.io.IOException
filePath - The file to load from.java.io.IOExceptionpublic org.deeplearning4j.nn.multilayer.MultiLayerNetwork getPlNet()
public int getEpoch()
public double getCertainty(IDyadRankingInstance queryInstance)
ICertaintyProviderIInstance.getCertainty in interface ICertaintyProvider<IDyadRankingInstance,IDyadRankingInstance,DyadRankingDataset>queryInstance - IInstance for which certainty shall be obtained.IInstancepublic IDyadRankingInstance getPairWithLeastCertainty(IDyadRankingInstance drInstance)
Dyads for which the model is least certain.drInstance - Ranking for which certainty should be assessed.Dyads for which the model is least certain.public double getProbabilityOfTopRanking(IDyadRankingInstance drInstance)
IDyadRankingInstance under the Plackett Luce model parametrized by
the latent skill values predicted by the PLNet. This may be useful as the
probability of a particular ranking diminishes drastically with increasing
length of the ranking.drInstance - IDyadRankingInstance for which the probability is
computed.IDyadRankingInstance given the Plackett Luce model
parametrized by the skill values predicted by the PLNet.public double getProbabilityOfTopKRanking(IDyadRankingInstance drInstance, int k)
public double getLogProbabilityOfTopRanking(IDyadRankingInstance drInstance)
IDyadRankingInstance under the Plackett Luce model parametrized by
the latent skill values predicted by the PLNet. This may be useful as the
probability of a particular ranking diminishes drastically with increasing
length of the ranking.drInstance - IDyadRankingInstance for which the probability is
computed.IDyadRankingInstance given the Plackett Luce model
parametrized by the skill values predicted by the PLNet.public double getLogProbabilityOfTopKRanking(IDyadRankingInstance drInstance, int k)
IDyadRankingInstance under the Plackett Luce model parametrized by
the latent skill values predicted by the PLNet. This may be useful as the
probability of a particular ranking diminishes drastically with increasing
length of the ranking.drInstance - IDyadRankingInstance for which the probability is
computed.k - Number of top dyads to be considered.IDyadRankingInstance given the Plackett Luce model
parametrized by the skill values predicted by the PLNet.public double getProbabilityRanking(IDyadRankingInstance drInstance)
IDyadRankingInstance under the
Plackett Luce model parametrized by the latent skill values predicted by the
PLNet.drInstance - IDyadRankingInstance for which the probability is
computed.IDyadRankingInstance given the
Plackett Luce model parametrized by the skill values predicted by the
PLNet.public double getLogProbabilityRanking(IDyadRankingInstance drInstance)
drInstance -