Code Monkey home page Code Monkey logo

Comments (4)

imatiach-msft avatar imatiach-msft commented on September 26, 2024

@yangwendy if you are doing the local install using pip install -e, you will first need to build the UI code.
You can build the UI code by running at the root directory of the repository:

yarn install
yarn buildall

Note you will need to have node, npm and yarn installed. For more detailed information please see the guide:
https://github.com/microsoft/responsible-ai-toolbox/blob/main/CONTRIBUTING.md#development-process
Particularly, this might be useful:
https://github.com/microsoft/responsible-ai-toolbox/blob/main/CONTRIBUTING.md#run-e2e-tests-locally-with-notebook-data
Hope this helps clarify how to build locally.

For the original issue, you can wrap the model to have a predict/predict_proba function in the scikit-learn format. I wonder if using our ml-wrappers repository may resolve this for you:

https://github.com/microsoft/ml-wrappers/

from ml_wrappers import wrap_model
wrapped_model = wrap_model(model, input, model_task='regression')

This function automatically wraps models and tries to put them in a common scikit-learn format all other RAI related packages can work with, but it may not always work.

Can you give more information about which specific catboost python class you are using, and how you trained it? If you have a sample notebook, we can also try to debug if the wrap_model function does not work for you.

from responsible-ai-toolbox.

yangwendy avatar yangwendy commented on September 26, 2024

catboost_iris.zip

Thank you so much for your help. I am waiting for the IT team to install yarn. Meanwhile, I tried the ml_wrapper. It cannot transfer array[[1],[2],[3]] to array[1,2,3]. I attached a simple notebook for your reference.

from responsible-ai-toolbox.

imatiach-msft avatar imatiach-msft commented on September 26, 2024

@yangwendy thank you for the example notebook. I've sent a PR here to add support for catboost framework (classifier and regressor) to ml-wrappers:
microsoft/ml-wrappers#55

Taken from PR description:
Mainly, the current predict and predict_proba functions from catboost classifier fail to support scikit-learn specification due to two issues:
1.) Catboost predict_proba returns different results when either a single array is passed to the prediction function or multiple arrays are passed. In the single instance case, catboost returns a single dimensional array of probabilities, whereas scikit-learn models always return a two-dimensional array of probabilities.
2.) Catboost predict function returns two dimensional array of one column, in the format [[1], [3], [2], [1]] etc, whereas scikit learn models return a one dimensional array on predict in the format [1, 3, 2, 1], etc.

For the first issue, we detect if the output dimensions are different in the single vs multi instance case - and if they differ by one, we add an extra dimension for the single instance prediction scenario.

For the second issue, a simple ravel() to one dimension resolves this inconsistency from catboost.

from responsible-ai-toolbox.

imatiach-msft avatar imatiach-msft commented on September 26, 2024

@yangwendy I've released ml-wrappers 0.2.1 which should now support catboost. Please run:

pip install --upgrade ml-wrappers

Then, you can use wrap_model function to wrap the catboost model:
https://github.com/microsoft/ml-wrappers/

from ml_wrappers import wrap_model
wrapped_model = wrap_model(model, input, model_task='regression')

The wrapped catboost model can then be passed to the ExplanationDashboard for viewing.

from responsible-ai-toolbox.

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.