ranking

Reference API related to the ranking framework

source

keras_linear_model

 keras_linear_model (number_documents_per_query, number_features)

linear model with a lasso constrain on the kernel weights.

Type Details
number_documents_per_query Number of documents per query to reshape the listwise prediction.
number_features Number of features used per document.
Returns Sequential The uncompiled Keras model.

Usage:

klm = keras_linear_model(
    number_documents_per_query=10, 
    number_features=5
)

source

keras_lasso_linear_model

 keras_lasso_linear_model (number_documents_per_query, number_features,
                           l1_penalty, normalization_layer:Optional=None)

linear model with a lasso constrain on the kernel weights.

Type Default Details
number_documents_per_query Number of documents per query to reshape the listwise prediction.
number_features Number of features used per document.
l1_penalty Controls the L1-norm penalty.
normalization_layer typing.Optional None Initialized normalization layers. Used when performing feature selection.
Returns Sequential The uncompiled Keras model.

Usage:

kllm = keras_lasso_linear_model(
    number_documents_per_query=10, 
    number_features=5, 
    l1_penalty=0.01
)

source

keras_ndcg_compiled_model

 keras_ndcg_compiled_model (model, learning_rate, top_n)

Compile listwise Keras model with NDCG stateless metric and ApproxNDCGLoss

Details
model Uncompiled Keras model
learning_rate Learning rate used in the Adagrad optim algo.
top_n Top n used when computing the NDCG metric

Usage:

compiled_klm = keras_ndcg_compiled_model(
    model=klm, 
    learning_rate=0.1, 
    top_n=10
)

source

LinearHyperModel

 LinearHyperModel (number_documents_per_query, number_features, top_n=10,
                   learning_rate_range=None)

Define a KerasTuner search space for linear models

linear_hyper_model = LinearHyperModel(
    number_documents_per_query=10, 
    number_features=10, 
    top_n=10, 
    learning_rate_range=[1e-2, 1e2]
)

source

LassoHyperModel

 LassoHyperModel (number_documents_per_query, number_features,
                  trained_normalization_layer, top_n=10,
                  l1_penalty_range=None, learning_rate_range=None)

Define a KerasTuner search space for lasso models


source

ListwiseRankingFramework

 ListwiseRankingFramework (number_documents_per_query, batch_size=32,
                           shuffle_buffer_size=1000, tuner_max_trials=3,
                           tuner_executions_per_trial=1, tuner_epochs=1,
                           tuner_early_stop_patience=None, final_epochs=1,
                           top_n=10, l1_penalty_range=None,
                           learning_rate_range=None,
                           folder_dir='/home/runner/work/learntorank-
                           DEPRECATED/learntorank-DEPRECATED')

Listwise ranking framework