Class AblationExperimentExample
java.lang.Object
es.uam.eps.ir.relison.examples.links.recommendation.AblationExperimentExample
public class AblationExperimentExample
extends java.lang.Object
A learning to rank experiment that performs ablation on the different variables.
It applies it to the LambdaMART algorithm.
-
Constructor Summary
Constructors Constructor Description AblationExperimentExample()
-
Method Summary
Modifier and Type Method Description private static java.lang.String
errorMessage()
Obtains the error message for the LETORExperiment main function.static void
main(java.lang.String[] args)
Executes the learning to rank experiment.private static void
readAndSample(java.lang.String file, java.lang.String expDirectory, java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> partitions, int numPartitions, java.lang.String filename)
Given a LETOR file, and some feature selections, it generates a LETOR file for each selection.private static void
readAndSampleReducedDiscrete(java.lang.String file, java.lang.String expDirectory, java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> partitions, int numPartitions, int numFeats, java.lang.String filename)
Generates the samples for a collection of datasets.private static int
readPartitionsFile(java.lang.String partitionsFile, java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> map)
Reads a file specifying the partitions.
-
Constructor Details
-
AblationExperimentExample
public AblationExperimentExample()
-
-
Method Details
-
errorMessage
private static java.lang.String errorMessage()Obtains the error message for the LETORExperiment main function.- Returns:
- the error message.
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionExecutes the learning to rank experiment.- Parameters:
args
- execution arguments- Training instances: A LETOR file containing the training instances.
- Validation instances: A LETOR file containing the validation instances.
- Test instances: A LETOR file containing the test instances.
- Partitions: A configuration file. On each row, it includes a comma separated list of values. Each value corresponds to the index of a feature in the LETOR files.
- Experiment directory: The route to the directory in which to the output the experiment will be stored.
- Terrier/JForests: The route to the Terrier/JForests binary file.
- JForest properties: The route to the properties file for LambdaMART in the JForests/Terrier library
- Training graph: The route for the training network.
- Test graph: The route to the test graph.
- Directed: true if the network is directed, false otherwise.
- Weighted: true if the network is weighted, false otherwise.
- Rec. ouput: directory in which to store the outcome of the recommendations.
- Cut-off: cut-off of the recommendations.
- Sample: true if we need to generate the instances for each feature selection, false otherwise.
- Copy: true if we need to generate the reduced instances for each feature selection, false otherwise.
- Throws:
java.io.IOException
- if something fails while reading/ writing.
-
readPartitionsFile
private static int readPartitionsFile(java.lang.String partitionsFile, java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> map) throws java.io.IOExceptionReads a file specifying the partitions.- Parameters:
partitionsFile
- the partitions file.map
- the map to configure. It has the feature index as key, and the numbers of configurations containing the feature as values.- Returns:
- the number of partitions.
- Throws:
java.io.IOException
- if something fails while reading the file.
-
readAndSample
private static void readAndSample(java.lang.String file, java.lang.String expDirectory, java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> partitions, int numPartitions, java.lang.String filename) throws java.io.IOExceptionGiven a LETOR file, and some feature selections, it generates a LETOR file for each selection.- Parameters:
file
- the route to the LETOR file.expDirectory
- a directory in which we want to store the files.partitions
- the different feature selections.numPartitions
- the number of different feature selections.filename
- the name of the new files.- Throws:
java.io.IOException
- if something fails while reading / writing.
-
readAndSampleReducedDiscrete
private static void readAndSampleReducedDiscrete(java.lang.String file, java.lang.String expDirectory, java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> partitions, int numPartitions, int numFeats, java.lang.String filename) throws java.io.IOExceptionGenerates the samples for a collection of datasets.- Parameters:
file
- the file.expDirectory
- the directory in which to store the file.partitions
- the different partitions.numPartitions
- the number of partitions.numFeats
- the number of featuresfilename
- the name of the file.- Throws:
java.io.IOException
- if something fails while reading / writing.
-