NicolasHug / Surprise

A Python scikit for building and analyzing recommender systems
http://surpriselib.com
BSD 3-Clause "New" or "Revised" License
6.33k stars 1.01k forks source link

Surprise GridSearchCV with Pipeline and custom Transformers #387

Open agatr opened 3 years ago

agatr commented 3 years ago

Description

Is it possible to use Pipeline with Surprise GridSearchCV? I've tried to create a pipeline with custom Transformers (for transforming data frame into Surprise Dataset), but the steps within Pipeline don't seem to be connected. My code:

` def run_gs(model, data, grid_params): pipeline = Pipeline([(('Reader Transformer', ReaderTransformer()), ('Model', model)]) grid_search = GridSearchCV(pipeline, grid_params, cv=3) grid_search.fit(data) return self.grid_search

`

Alternatively, is it possible to use Surprise model with 'normal' sklearn GridSearchCV? I've tried that as well, but with no luck either.

Versions

macOS-10.16-x86_64-i386-64bit Python 3.8.5 (default, Sep 4 2020, 02:22:02) [Clang 10.0.0 ] surprise 1.1.1

NicolasHug commented 2 years ago

Hi @agatr , sorry, sklearn and surprise aren't really compatible with one-another. I assume the Pipeline you're referring to is from sklearn, but there's no support for surprise with it.