MLGB means Machine Learning of the Great Boss, and is called 「妙计包」.
MLGB is a library that includes many models of CTR Prediction & Recommender System by TensorFlow & PyTorch.
Advantages
- Easy! Use
mlgb.get_model(model_name, **kwargs)to get a complex model. - Fast! Better performance through better code.
- Enjoyable! 50+ ranking & matching models to use, 2 languages(TensorFlow & PyTorch) to deploy.
Supported Models
Installation
# PYPI
pip install --upgrade mlgb
# Conda
conda install conda-forge::mlgb
Getting Started
import mlgb
# parameters of get_model:
help(mlgb.get_model)
"""
get_model(feature_names, model_name='LR', task='binary', aim='ranking', lang='TensorFlow', device=None, seed=None, **kwargs)
:param feature_names: tuple(tuple(dict)), must. Embedding need vocabulary size and custom embed_dim of features.
:param model_name: str, default 'LR'. Union[`mlgb.ranking_models`, `mlgb.matching_models`, `mlgb.mtl_models`]
:param task: str, default 'binary'. Union['binary', 'regression', 'multiclass:{int}']
:param aim: str, default 'ranking'. Union['ranking', 'matching', 'mtl']
:param lang: str, default 'TensorFlow'. Union['TensorFlow', 'PyTorch', 'tf', 'torch']
:param device: Optional[str, int], default None. Only for PyTorch.
:param seed: Optional[int], default None.
:param **kwargs: more model parameters by `mlgb.get_model_help(model_name)`.
"""
# parameters of model:
mlgb.get_model_help(model_name='LR', lang='tf')
"""
class LR(tf.keras.src.models.model.Model)
| LR(feature_names, task='binary', seed=None, inputs_if_multivalued=False, inputs_if_sequential=False, inputs_if_embed_dense=False, embed_dim=32, embed_2d_dim=None, embed_l2=0.0, embed_initializer=None, pool_mv_mode='Pooling:average', pool_mv_axis=2, pool_mv_l2=0.0, pool_mv_initializer=None, pool_seq_mode='Pooling:average', pool_seq_axis=1, pool_seq_l2=0.0, pool_seq_initializer=None, linear_if_bias=True, linear_l1=0.0, linear_l2=0.0, linear_initializer=None)
|
| Methods defined here:
|
| __init__(self, feature_names, task='binary', seed=None, inputs_if_multivalued=False, inputs_if_sequential=False, inputs_if_embed_dense=False, embed_dim=32, embed_2d_dim=None, embed_l2=0.0, embed_initializer=None, pool_mv_mode='Pooling:average', pool_mv_axis=2, pool_mv_l2=0.0, pool_mv_initializer=None, pool_seq_mode='Pooling:average', pool_seq_axis=1, pool_seq_l2=0.0, pool_seq_initializer=None, linear_if_bias=True, linear_l1=0.0, linear_l2=0.0, linear_initializer=None)
| Model Name: LR(LinearOrLogisticRegression)
| Paper Team: Microsoft
| Paper Year: 2007
| Paper Name: <Predicting Clicks: Estimating the Click-Through Rate for New Ads>
| Paper Link: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/predictingclicks.pdf
|
| Task Inputs Parameters:
| :param feature_names: tuple(tuple(dict)), must. Embedding need vocabulary size and custom embed_dim of features.
| :param task: str, default 'binary'. Union['binary', 'regression']
| :param seed: Optional[int], default None.
| :param inputs_if_multivalued: bool, default False.
| :param inputs_if_sequential: bool, default False.
| :param inputs_if_embed_dense: bool, default False.
| :param embed_dim: int, default 32.
| :param embed_2d_dim: Optional[int], default None. When None, each field has own embed_dim by feature_names.
| :param embed_l2: float, default 0.0.
| :param embed_initializer: Optional[str], default None. When None, activation judge first, xavier_normal end.
| :param pool_mv_mode: str, default 'Pooling:average'. Pooling mode of multivalued inputs. Union[
| 'Attention', 'Weighted', 'Pooling:max', 'Pooling:average', 'Pooling:sum']
| :param pool_mv_axis: int, default 2. Pooling axis of multivalued inputs.
| :param pool_mv_l2: float, default 0.0. When pool_mv_mode is in ('Weighted', 'Attention'), it works.
| :param pool_mv_initializer: Optional[str], default None. When None, activation judge first,
| xavier_normal end. When pool_mv_mode is in ('Weighted', 'Attention'), it works.
| :param pool_seq_mode: str, default 'Pooling:average'. Pooling mode of sequential inputs. Union[
| 'Attention', 'Weighted', 'Pooling:max', 'Pooling:average', 'Pooling:sum']
| :param pool_seq_axis: int, default 1. Pooling axis of sequential inputs.
| :param pool_seq_l2: float, default 0.0. When pool_seq_mode is in ('Weighted', 'Attention'), it works.
| :param pool_seq_initializer: Optional[str], default None. When None, activation judge first,
| xavier_normal end. When pool_seq_mode is in ('Weighted', 'Attention'), it works.
|
| Task Model Parameters:
| :param linear_if_bias: bool, default True.
| :param linear_l1: float, default 0.0.
| :param linear_l2: float, default 0.0.
| :param linear_initializer: Optional[str], default None. When None, activation judge first, xavier_normal end.
"""
Code Examples
| Code Examples |
|---|
| TensorFlow |
| PyTorch |
Citation
If you use this for research, please cite it using the following BibTeX entry. Thanks.
@misc{uliontse2020mlgb,
author = {UlionTse},
title = {MLGB is a library that includes many models of CTR Prediction & Recommender System by TensorFlow & PyTorch},
year = {2020},
publisher = {GitHub},
journal = {GitHub Repository},
howpublished = {\url{https://github.com/UlionTse/mlgb}},
}
Metadata
Release files for mlgb 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mlgb-0.0.7.tar.gz | 138.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlgb-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 301.1 kB
Release files / mlgb-0.0.7.tar.gz
| Download URL | mlgb-0.0.7.tar.gz |
|---|---|
| Size | 138.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
100eaf695b492ca99ab1984baada98434d1b46a2461c247da3a6b5755e5e1e35
|
|
BLAKE2b-256 checksum How to use checksums |
8d611fa6c054f353b8fb764772d8ab68218b9ebc2bc62fadd953698e817ac7ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / mlgb-0.0.7-py3-none-any.whl
| Download URL | mlgb-0.0.7-py3-none-any.whl |
|---|---|
| Size | 163.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63d14105a8f825b74e9cccd5dc1daea9c9ed0fcb9856f181ae2dadd48dbc4f76
|
|
BLAKE2b-256 checksum How to use checksums |
0a0e5a2acbf66dbc31e5f865406f4f5025a33d0cd948026e7e8869498556cd03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for mlgb 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.