Code Monkey home page Code Monkey logo

Comments (9)

aerdem4 avatar aerdem4 commented on May 24, 2024

@rafmacalaba you can try setting categorical_feature in fit_params dictionary that you provide for LOFO.
https://github.com/aerdem4/lofo-importance/blob/master/lofo/lofo_importance.py#L30

lofo_imp = LOFOImportance(dataset, cv=cv, scoring="roc_auc", fit_params={"categorical_feature": ["cat1", "cat2"]})

from lofo-importance.

rafmacalaba avatar rafmacalaba commented on May 24, 2024

Ah!! make sense. I just figured it out just now, I added the categorical_feature parameter in my dict. Thanks :D btw, it would be good if you add that on your README.md :D Thank you so much Ahmet! Please resolve this.

from lofo-importance.

rafmacalaba avatar rafmacalaba commented on May 24, 2024

Seems like it doesn't work ❌ @aerdem4

~/anaconda3/lib/python3.7/site-packages/sklearn/model_selection/_validation.py in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, return_estimator, error_score)
    526             estimator.fit(X_train, **fit_params)
    527         else:
--> 528             estimator.fit(X_train, y_train, **fit_params)
    529 
    530     except Exception as e:

TypeError: fit() got an unexpected keyword argument 'objective'```

from lofo-importance.

rafmacalaba avatar rafmacalaba commented on May 24, 2024

@aerdem4 is there a way I can download this specific version 6mos ago? https://www.kaggle.com/divrikwicky/lofo-importance

from lofo-importance.

aerdem4 avatar aerdem4 commented on May 24, 2024

objective is not fit_params but model parameters, you need to set it while you create your lightgbm model.

If you still want to use an old version you can pip install lofo-importance==0.2.0

from lofo-importance.

rafmacalaba avatar rafmacalaba commented on May 24, 2024

@aerdem4 I made it work with some workarounds, I think I found the culprit of my error. specifically in infer_defaults.py I am using the dtype category instead of the object that the one you're using in the script. Might be good to add this in the file.

Thank you!

from lofo-importance.

aerdem4 avatar aerdem4 commented on May 24, 2024

Can you paste your code that reproduces the error?

from lofo-importance.

rafmacalaba avatar rafmacalaba commented on May 24, 2024

@aerdem4 it's just the classic Could not convert to float - string which any models would be angry to have, basically my categorical features are in category dtype not object which was in your infer_defaults.py script. I made a PR for this and just check if it's good to go :D Thanks!

from lofo-importance.

aerdem4 avatar aerdem4 commented on May 24, 2024

Solved by #25

from lofo-importance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.