LambdaRankNN
Python library for training pairwise Learning-To-Rank Neural Network models (RankNet NN, LambdaRank NN).
Supported model structure
It supports pairwise Learning-To-Rank (LTR) algorithms such as Ranknet and LambdaRank, where the underlying model (hidden layers) is a neural network (NN) model.
Installation
pip install LambdaRankNN
Example
Example on a LambdaRank NN model.
import numpy as np
from LambdaRankNN import LambdaRankNN
# generate query data
X = np.array([[0.2, 0.3, 0.4],
[0.1, 0.7, 0.4],
[0.3, 0.4, 0.1],
[0.8, 0.4, 0.3],
[0.9, 0.35, 0.25]])
y = np.array([0, 1, 0, 0, 2])
qid = np.array([1, 1, 1, 2, 2])
# train model
ranker = LambdaRankNN(input_size=X.shape[1], hidden_layer_sizes=(16,8,), activation=('relu', 'relu',), solver='adam')
ranker.fit(X, y, qid, epochs=5)
y_pred = ranker.predict(X)
ranker.evaluate(X, y, qid, eval_at=2)
Converting model to pmml
The trained model can be conveniently converted to pmml, with Python library rankerNN2pmml.
from rankerNN2pmml import rankerNN2pmml
params = {
'feature_names': ['Feature1', 'Feature2', 'Feature3'],
'target_name': 'score'
}
rankerNN2pmml(estimator=ranker.model, file='Model_example.xml', **params)
Release files for LambdaRankNN 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| LambdaRankNN-0.1.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| LambdaRankNN-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / LambdaRankNN-0.1.1.tar.gz
| Download URL | LambdaRankNN-0.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaf0cbde36a40d4e13da88e72fea44d04a8b249f7a745a76f20a75ed498c43d3
|
|
BLAKE2b-256 checksum How to use checksums |
2ffb9ecf679e0bea909399d18097dce42a81d358a7a17cf4693b3894144b7c59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|
Release files / LambdaRankNN-0.1.1-py3-none-any.whl
| Download URL | LambdaRankNN-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85ac7c32a7650a6ecb2546214b6ab16efa77f4b3c7fda66eb70683ef4b5754af
|
|
BLAKE2b-256 checksum How to use checksums |
2d96b10f198c7d652c50c4e1458a8517e49885aa79e1d288e96e1d0a9c74092b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|