Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Factorization Machine classifier #50

Merged
merged 4 commits into from
Jun 14, 2017
Merged

ENH Factorization Machine classifier #50

merged 4 commits into from
Jun 14, 2017

Conversation

beckermr
Copy link
Contributor

This PR adds a factorization machine classifier.

I am going to leave the regressor for another PR.

@mdagost
Copy link

mdagost commented Jun 12, 2017

Oh nice. I've been looking for a good TF FM implementation :)

@beckermr
Copy link
Contributor Author

Hi @mdagost! We only have a classifier. A PR for the regressor is welcome!

v2 = self._v * self._v
v2x2 = tf.stack([matmul(x2, v2[i, :, :])
for i in range(self.rank)], axis=1)
int_term = 0.5 * tf.reduce_sum(tf.square(vx) - v2x2, axis=1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The axis=1 is a little confusing since its in the middle of this 3-dim array. Maybe change it to axis=-1 instead?

@samcarlos
Copy link
Contributor

Just making sure: there's no way to write eqn 1) here http://www.algo.uni-konstanz.de/members/rendle/pdf/Rendle2010FM.pdf in matrix format, is there?

@beckermr
Copy link
Contributor Author

Yeah equation 1 is the slow version. The TF I have is the best I know of.

@samcarlos
Copy link
Contributor

LGTM

@beckermr beckermr merged commit e9009c9 into master Jun 14, 2017
@beckermr beckermr deleted the fm branch June 14, 2017 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants