Comments (5)
A new insight:
In ffm_sgc.c, when p_p or p_n "overflows" (running out of the reasonable range), Ai[p_p] is 0, which is why it'll always be smaller then Ai[p_n] which is why it'll be increased again in the if statement, while the reason that another iteration over the while loop has to be done is in fact p_n (because p_n < Ap[sample_row_n + 1] evaluates to True ).
ffm_sgc.c:
int p_n = Ap[sample_row_n];
int p_p = Ap[sample_row_p];
while (p_n < Ap[sample_row_n + 1] || p_p < Ap[sample_row_p + 1]) {
double grad = 0;
int i_to_update = Ai[p_p] <= Ai[p_n] ? Ai[p_p] : Ai[p_n];
double theta_w = coef->w->data[i_to_update];
// incrementing the smaller index or both if equal
if (Ai[p_p] == i_to_update) {
grad = Ax[p_p];
p_p++;
}
if (Ai[p_n] == i_to_update) {
grad -= Ax[p_n];
p_n++;
}
The above PR fixes this issue. Feel free to make it more beautiful :-)
from fastfm.
Regarding the difference between the python and C code, 3) in your first comment.
The C code expect the data in row major order while the python code expects column major (csc_matrix). I have to check in detail if I'm not overlooking something. I mean, a bug like this should really trigger some of the tests...
from fastfm.
@ibayer the choice of column / row major matrices is correct but was hard to understand (PR).
from fastfm.
The mentioned problem is fixed by @ibayer 's PR #14. Thanks for your help!
from fastfm.
@felixmaximilian I have closed your PR for fastFM-core . I have just know updated #63 fastFM-core in fastFM so that the BPR should now work from the Python interface too. Just open a new issue if you run into any other problems. And thanks again for tracing the problem back to it's roots.
from fastfm.
Related Issues (20)
- pip install . is not working on Winodws HOT 1
- Illegal instruction (core dumped) in ALS HOT 5
- Can fastfm use mini batch? HOT 1
- Check pairs range failed when fitting BPR
- OverflowError: n_iter too high in bpr.FMRecommender HOT 1
- Need partial_fit HOT 1
- Can fastfm use multicore to speed up training? HOT 1
- Fit complaining about both dense/sparse HOT 2
- Recompile for python 3.7 HOT 7
- Input of fit() and return value of predict_proba() method
- Failure to install on Python3.8 HOT 8
- Fix simple typo: reommend -> recommend
- Import Error
- Compiling using OpenBLAS from anaconda
- Source file type in PyPi
- No coordinate descent solver available HOT 1
- Compilation error on macOS 11.2 ARM HOT 3
- Any plan to support py3.7+? HOT 1
- will it work for third order categorical features interaction ?
- will it work on windows OS?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastfm.