From f62034e31dfa3c89870fc39e696e4a8c2849368a Mon Sep 17 00:00:00 2001 From: farzi56787 <72184583+farzi56787@users.noreply.github.com> Date: Thu, 1 Oct 2020 11:55:13 +0530 Subject: [PATCH] Update pylibfm.py --- pyfm/pylibfm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyfm/pylibfm.py b/pyfm/pylibfm.py index b0b71a4..f04c634 100644 --- a/pyfm/pylibfm.py +++ b/pyfm/pylibfm.py @@ -2,7 +2,7 @@ from sklearn.model_selection import train_test_split import random from pyfm_fast import FM_fast, CSRDataset - +from collections import defaultdict LEARNING_RATE_TYPES = {"optimal": 0, "invscaling": 1, "constant": 2} TASKS = {"regression": 0, "classification" : 1} @@ -129,6 +129,8 @@ def _bool_to_int(self, bool_arg): return 1 else: return 0 + def fact(n): + return n*n def _prepare_y(self,y): """Maps labels to [-1, 1] space"""