Giter Site home page Giter Site logo

Comments (5)

vsteiger avatar vsteiger commented on July 23, 2024 1

Hi @hbaniecki

explainer1$data[1, , drop=FALSE] runs smoothly and prints the first subject in the sample

For:

explainer1$predict_function(explainer1$model, explainer1$data)
explainer1$predict_function(explainer1$model, explainer1$data[1, ])
explainer1$predict_function(explainer1$model, explainer1$data[1, , drop=FALSE])

We get an error, that we have encountered in Python originally but solved it via formatting:

Error in py_call_impl(callable, dots$args, dots$keywords) :
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

Regarding the example data due to company restrictions we are not allowed to share any of the data itself

from modelstudio.

hbaniecki avatar hbaniecki commented on July 23, 2024

Hi @vsteiger,

  1. Does the full example code work for you?
  2. For your use-case:
    a) in Python: what is the verbose output of an Explainer?
    image
    b) in Python: can you access explainer.y_hat and explainer.residuals?
    c) in R: can you access explainer$y_hat and explainer$residuals?

    modelStudio/R/modelStudio.R

    Lines 655 to 659 in 91da18c

    if ("dalex._explainer.object.Explainer" %in% class(explainer)) {
    if (is.null(explainer$y_hat) || is.null(explainer$residuals))
    stop('For Python support, use precalculate=True in Explainer init')
    class(explainer) <- c('explainer', class(explainer))
    }

from modelstudio.

vsteiger avatar vsteiger commented on July 23, 2024

Hi @hbaniecki

We found the error in the explainer building step in python.
We've corrected this and now the verbose output in Python looks clean.

We continued in R:

explainer1 <- py_load_object("explainer_scikitlearn_precalculateTrue_v02.pickle", pickle = "pickle")

class(explainer1)

"explainer" "explainer" "explainer" "dalex._explainer.object.Explainer" "python.builtin.object"

In R we can access both explainer.y_hat and explainer.residuals and they are not NULL:

is.null(explainer1$residuals)
[1] FALSE
> is.null(explainer1$y_hat)
[1] FALSE

Now, when running modelStudio(explainer1, B = 5) on the explainer file, we got this error message:

new_observation argument is NULL. new_observation_n observations needed to calculate local explanations are taken from the data.

Error in modelStudio.explainer(explainer1, B = 5) :

explainer$predict_function returns an error when executed on new_observation[1,, drop = FALSE]

from modelstudio.

hbaniecki avatar hbaniecki commented on July 23, 2024

@vsteiger great!

what do you get from explainer$data[1, , drop=FALSE] ?

explainer$predict_function(explainer$model, explainer$data)
explainer$predict_function(explainer$model, explainer$data[1, ])
explainer$predict_function(explainer$model, explainer$data[1, , drop=FALSE])

Just for context, I ran the example from documentation https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html and it runs OK for me with the same software versions.

So maybe to solve this I would need to have exemplary data/model made by you where the error occurs.

from modelstudio.

hbaniecki avatar hbaniecki commented on July 23, 2024

Yes, but it could be synthetically generated data from numpy working on a changed model in sklearn, just to reproduce the error.

from modelstudio.

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.