Skip to content

bohyunshin/fm

Repository files navigation

fm

Implementation of ctr / cvr models using pytorch or numpy (from scratch).

Setting up environment

We use poetry to manage dependencies of repository.

Use poetry with version 2.1.1.

$ poetry --version
Poetry (version 2.1.1)

Python version should be 3.11.x.

$ python --version
Python 3.11.11

If python version is lower than 3.11, try installing required version using pyenv.

Create virtual environment.

$ poetry env activate

If your global python version is not 3.11, run following command.

$ poetry env use python3.11

You can check virtual environment path info and its executable python path using following command.

$ poetry env info

After setting up python version, just run following command which will install all the required packages from poetry.lock.

$ poetry install

Setting up git hook

Set up automatic linting using the following commands:

# This command will ensure linting runs automatically every time you commit code.
pre-commit install

How to run

Dataset

Currently, only criteo dataset is supported.

  • For non-kaggle data, download it in this link before running experiment and specify file path for CriteoSearchData
  • For kaggle data, download it in this link and specify file path for train.txt.

Quick Start

You can train implemented models using criteo dataset as

$ poetry run python3 src/train_torch.py \
	--data_path data/criteo/CriteoSearchData \
	--data_name criteo \
	--model fm \
	--is_test

Experiment Results

Model Dataset Test loss Test Macro F1
Logistic Regression criteo TBD TBD
Factorization Machine criteo TBD TBD

How to run pytest

Run following command.

$ poetry run pytest

About

CTR / CVR ML Models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages