From 740103e5eb920a4061dd8e977a2ede6d23c6910a Mon Sep 17 00:00:00 2001 From: Yuchin Juan Date: Sun, 28 May 2017 15:23:19 -0700 Subject: [PATCH] restruct --- COPYRIGHT | 2 +- Makefile | 18 +- README | 284 +++++------- bigdata.te.txt | 200 -------- bigdata.tr.txt | 200 -------- ffm-predict.cpp | 35 +- ffm-train.cpp | 205 ++------ ffm.cpp | 1182 +++++++++++++++++------------------------------ ffm.h | 89 ++-- timer.cpp | 31 ++ timer.h | 14 + 11 files changed, 676 insertions(+), 1584 deletions(-) delete mode 100644 bigdata.te.txt delete mode 100644 bigdata.tr.txt create mode 100644 timer.cpp create mode 100644 timer.h diff --git a/COPYRIGHT b/COPYRIGHT index fbb6592..35bb170 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,5 +1,5 @@ -Copyright (c) 2015 The LIBFFM Project. +Copyright (c) 2017 The LIBFFM Project. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Makefile b/Makefile index 61584a7..0e9b5b4 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,26 @@ CXX = g++ CXXFLAGS = -Wall -O3 -std=c++0x -march=native +# comment the following flags if you do not want to SSE instructions +DFLAG += -DUSESSE + # comment the following flags if you do not want to use OpenMP DFLAG += -DUSEOMP CXXFLAGS += -fopenmp all: ffm-train ffm-predict -ffm-train: ffm-train.cpp ffm.o - $(CXX) $(CXXFLAGS) -o $@ $^ +ffm-train: ffm-train.cpp ffm.o timer.o + $(CXX) $(CXXFLAGS) $(DFLAG) -o $@ $^ + +ffm-predict: ffm-predict.cpp ffm.o timer.o + $(CXX) $(CXXFLAGS) $(DFLAG) -o $@ $^ -ffm-predict: ffm-predict.cpp ffm.o - $(CXX) $(CXXFLAGS) -o $@ $^ +ffm.o: ffm.cpp ffm.h timer.o + $(CXX) $(CXXFLAGS) $(DFLAG) -c -o $@ $< -ffm.o: ffm.cpp ffm.h +timer.o: timer.cpp timer.h $(CXX) $(CXXFLAGS) $(DFLAG) -c -o $@ $< clean: - rm -f ffm-train ffm-predict ffm.o + rm -f ffm-train ffm-predict ffm.o timer.o diff --git a/README b/README index 914c95d..b6a3a6d 100644 --- a/README +++ b/README @@ -1,21 +1,40 @@ -LIBFFM is a library for field-aware factorization machine. For the formulation it solves, please check: - - http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf - - - Table of Contents ================= +- What is LIBFFM - Overfitting and Early Stopping - Installation - Data Format - Command Line Usage - Examples -- Library Usage -- OpenMP +- OpenMP and SSE - Building Windows Binaries +- FAQ + + +What is LIBFFM +============== + +LIBFFM is a library for field-aware factorization machine (FFM). + +Field-aware factorization machine is a effective model for CTR prediction. It has been used to win the top-3 positions +of following competitions: + + * Criteo: https://www.kaggle.com/c/criteo-display-ad-challenge + + * Avazu: https://www.kaggle.com/c/avazu-ctr-prediction + + * Outbrain: https://www.kaggle.com/c/outbrain-click-prediction + * RecSys 2015: http://dl.acm.org/citation.cfm?id=2813511&dl=ACM&coll=DL&CFID=941880276&CFTOKEN=60022934 + +You can find more information about FFM in the following paper / slides: + + * http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf + + * http://www.csie.ntu.edu.tw/~cjlin/papers/ffm.pdf + + * https://arxiv.org/abs/1701.04099 Overfitting and Early Stopping @@ -78,16 +97,11 @@ stop at the iteration that reaches the best validation loss: Installation ============ -Requirement: LIBFFM is written in C++. It requires C++11 and OpenMP supports. If OpenMP is not available on your -platform, please refer to section `OpenMP.' +Requirement: It requires a C++11 compatible compiler. We also use OpenMP to provide multi-threading. If OpenMP is not +available on your platform, please refer to section `OpenMP and SSE.' - Unix-like systems: - To compile on Unix-like systems, type `make' in the command line. - -- OS X: - The built-in compiler should be able to compile LIBFFM. However, OpenMP may - not be supported. In this case you have to compile without OpenMP. See - section `OpenMP' for detail. + Typeype `make' in the command line. - Windows: See `Building Windows Binaries' to compile. @@ -99,14 +113,42 @@ Data Format The data format of LIBFFM is: -