Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are you planning to support sklearn's API? #25

Open
jckkvs opened this issue Jan 11, 2023 · 3 comments
Open

Are you planning to support sklearn's API? #25

jckkvs opened this issue Jan 11, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@jckkvs
Copy link

jckkvs commented Jan 11, 2023

I think that it will be very convenient if pipeline can be used as follows

from sklearn.pipeline import Pipeline
from sklearn.ensemble import RandomForestRegressor

pipe = Pipeline(steps=[("selector", ParticleSwarmOptimization()), 
                              ("Regressor", RandomForestRegressor())])
pipe.fit(X,y)
@jaswinder9051998 jaswinder9051998 added the enhancement New feature or request label Jan 12, 2023
@jaswinder9051998 jaswinder9051998 self-assigned this Jan 12, 2023
@jaswinder9051998
Copy link
Owner

Seems like a good initiative to take, will check for be compatibility and start working on it

@jckkvs
Copy link
Author

jckkvs commented Feb 7, 2023

Thank you.  
As you know, to support sklearn.pipeline , we need fit and transform functions.

Also, in order to support sklearn's GridSearchCV and cross_val_predict, I think that the get_params and set_params, get_support functions are also necessary.

As you know,

from sklearn.model_selectiom import cross_val_predict, GridSearchCV
y_pred_cv = cross_val_predict(pipe, X, y)

gcv = GridSearchCV(pipe, param_grid={"population_size" : [20,30,50,]})
gcv.fit(X,y)

# It is just an example,
# whether population_size optimization is necessary is not discussed here.

@jckkvs
Copy link
Author

jckkvs commented Sep 12, 2023

@jaswinder9051998

Apologies for the delay, I have created the code for DragonFlyOptimization. The fundamental algorithm for Dragonfly optimization remains unchanged.

I have modified some argument and variable names to make it compatible with the sklearn API.

If this implementation is acceptable, I will proceed to implement other algorithms from zoofs as well.

https://github.com/jaswinder9051998/zoofs/pull/29/files#diff-f325c536869fad925454821e8290757de9931d07e37c0713fdf1dff283202317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants