Closed StevePrestwich closed 2 years ago
I tried to use it and got "unexpected keyword argument 'class_weight'".
What am I meant to investigate here? Please provide some info?? Even the basics?
What gplearn/python/sklearn/etc versions are you using.... What command did you execute? Anything?
What am I meant to investigate here? Please provide some info?? Even the basics?
What gplearn/python/sklearn/etc versions are you using.... What command did you execute? Anything?
Sorry, I expected an easy answer such as "this feature is deprecated". I'm using gplearn via Colab, and perhaps this indicates the version:
Requirement already satisfied: gplearn in /usr/local/lib/python3.7/dist-packages (0.4.1) Requirement already satisfied: scikit-learn>=0.20.0 in /usr/local/lib/python3.7/dist-packages (from gplearn) (1.0.2) Requirement already satisfied: joblib>=0.13.0 in /usr/local/lib/python3.7/dist-packages (from gplearn) (1.1.0) Requirement already satisfied: scipy>=1.1.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.20.0->gplearn) (1.4.1) Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.20.0->gplearn) (3.0.0) Requirement already satisfied: numpy>=1.14.6 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.20.0->gplearn) (1.19.5)
Here's my code:
import numpy as np import pandas as pd import sklearn import random !pip install gplearn from gplearn.genetic import SymbolicClassifier
sc = SymbolicClassifier(population_size=5000, parsimony_coefficient=0.0001, verbose=1, const_range=None, generations=200, stopping_criteria=0.0001,
function_set=('add','sub','mul','min','max','abs','neg'), class_weight='balanced') sc.fit(X,y)
Whatever value I choose for class_weight, I get:
TypeError Traceback (most recent call last)
OK thanks, don't mean to be overly agressive but without details on how you encountered an error it's hard to help. This isn't a known bug and as a downstream package things can change that cause failures for my users. Will investiate. Thanks for the report
OK thanks, don't mean to be overly agressive but without details on how you encountered an error it's hard to help. This isn't a known bug and as a downstream package things can change that cause failures for my users. Will investiate. Thanks for the report
OK, thanks! Let me know if you need the rest of my code,
Steve
OK looks like you have 0.4.1 of gplearn
... The class_weight
parameter was introduced in the unreleased master branch so you'd need to install the package from source. I hope to have a release done soonish which will make the argument available to the puiblic. In the meantime you can construct a sample weight to do the same thing. Granted it's been way too long between releases so this feature has been sitting in the dev branch for ages.
OK looks like you have 0.4.1 of gplearn ... The class_weight parameter was introduced in the unreleased master branch so you'd need to install the package from source. I hope to have a release done soonish which will make the argument available to the puiblic. In the meantime you can construct a sample weight to do the same thing. Granted it's been way too long between releases so this feature has been sitting in the dev branch for ages.
OK, thanks. No problem, I can wait for sklearn to catch up.
Steve
I released a new version (0.4.2) a couple of days ago. If you update the package via pip you should have the class weight functionality
I released a new version (0.4.2) a couple of days ago. If you update the package via pip you should have the class weight functionality
It works, thanks!
Is there a gplearn paper I can cite?
Steve
Good to hear.
Nope, you can just point to the repo or docs if you like.
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Additional context