Skip to content

Cannot save HardSamplingClassifier #544

Answered by raphaelsty
nehalAggarwal asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @nehalAggarwal,

Pickle does not allow serializing lambda function. The HardSampling class is one of the few classes in River to have a lambda function in it's source code. I suggest you to use the Dill library to serialize this model. Dill is more or less the same as Pickle, maybe a bit slower but allows to serialize lambda functions.

You can install Dill using:

pip install dill
from river import datasets
from river import evaluate
from river import imblearn
from river import linear_model
from river import metrics
from river import optim
from river import preprocessing

model = (
 preprocessing.StandardScaler() |
 imblearn.HardSamplingClassifier(
     classifier=linear_model.LogisticRe…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MaxHalford
Comment options

@MaxHalford
Comment options

Answer selected by MaxHalford
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants