diff --git a/docs/getting_started/concepts.rst b/docs/getting_started/concepts.rst index eb24b64..5da3c53 100644 --- a/docs/getting_started/concepts.rst +++ b/docs/getting_started/concepts.rst @@ -113,7 +113,6 @@ corresponding functions or classes, which can also be found in the `mlprimitives Examples ******** -* LightFM * Keras Sequential LSTMTextClassifier * NetworkX Graph Feature Extraction diff --git a/mlprimitives/adapters/lightfm.py b/mlprimitives/adapters/lightfm.py deleted file mode 100644 index fcb580a..0000000 --- a/mlprimitives/adapters/lightfm.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -import lightfm -from scipy import sparse - - -class LightFM(lightfm.LightFM): - - def __init__(self, epochs=1, num_threads=1, *args, **kwargs): - self.epochs = epochs - self.num_threads = num_threads - super(LightFM, self).__init__(*args, **kwargs) - - def get_columns(self, X): - if hasattr(X, 'iloc'): - return X.iloc[:, 0].values, X.iloc[:, 1].values - else: - return X[:, 0], X[:, 1] - - def fit(self, X, y): - user_ids, item_ids = self.get_columns(X) - X = sparse.csr_matrix((y, (user_ids, item_ids))) - super(LightFM, self).fit(X, epochs=self.epochs, num_threads=self.num_threads) - - def predict(self, X): - user_ids, item_ids = self.get_columns(X) - predict = super(LightFM, self).predict - return predict(user_ids, item_ids, num_threads=self.num_threads) diff --git a/mlprimitives/primitives/lightfm.LightFM.json b/mlprimitives/primitives/lightfm.LightFM.json deleted file mode 100644 index 1f00afb..0000000 --- a/mlprimitives/primitives/lightfm.LightFM.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "lightfm.LightFM", - "contributors": [ - "Carles Sala " - ], - "documentation": "http://lyst.github.io/lightfm/docs/index.html", - "description": "LightFM is a Python implementation of a number of popular recommendation algorithms for both implicit and explicit feedback.", - "classifiers": { - "type": "estimator", - "subtype": "recommender" - }, - "modalities": [], - "primitive": "mlprimitives.adapters.lightfm.LightFM", - "fit": { - "method": "fit", - "args": [ - { - "name": "X", - "type": "ndarray" - }, - { - "name": "y", - "type": "array" - } - ] - }, - "produce": { - "method": "predict", - "args": [ - { - "name": "X", - "type": "ndarray" - } - ], - "output": [ - { - "name": "y", - "type": "array" - } - ] - }, - "hyperparameters": { - "fixed": { - "epochs": { - "type": "int", - "default": 1 - }, - "num_threads": { - "type": "int", - "default": 1 - } - }, - "FIXME": "This needs to be reviewed and extended", - "tunable": { - "loss": { - "type": "str", - "default": "warp", - "values": [ - "warp", - "logistic", - "bpr", - "warp-kos" - ] - }, - "learning_schedule": { - "type": "str", - "default": "adagrad", - "values": [ - "adagrad", - "adadelta" - ] - }, - "no_components": { - "type": "int", - "default": 5, - "range": [ - 5, - 15 - ] - }, - "k": { - "type": "int", - "default": 2, - "range": [ - 2, - 10 - ] - } - } - } -} diff --git a/setup.py b/setup.py index da93301..7531381 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,6 @@ 'featuretools>=0.6.1,<0.23', 'iso639>=0.1.4,<0.2', 'langdetect>=1.0.7,<2', - 'lightfm>=1.15,<2', 'mlblocks>=0.6,<0.7', 'networkx>=2.0,<3', 'nltk>=3.3,<4',