Giter Club home page Giter Club logo

Comments (5)

marcotcr avatar marcotcr commented on August 26, 2024

Are you sure pipe_stacking.predict_proba(test_data) works perfectly fine? In this line:
self.prob_result = [self.classifiers[0].predict_proba(X)[0][0], self.classifiers[1].predict_proba(X)[0][0], self.classifiers[2].predict_proba(X)[0][0], np.asarray(list( self.classifiers[3].predict_proba(X)))[0][0], np.asarray(list( self.classifiers[4].predict_proba(X)))[0][0]]
you seem to be taking the first row and first column ([0][0]) of the prediction probability for each classifier, regardless of the size of the input. That is, I think you'll always output one row in predict_proba, even if the input is 10 rows.
LimeTabular assumes the X in predict_proba can be a 2d array, not only a 1d array.

from lime.

gsvijayraajaa avatar gsvijayraajaa commented on August 26, 2024

This is a use case specific implementation, wherein the pipeline is used only for prediction against a single input vector. Henceforth the size of the input is one here. X in predict_proba comes after PCA, which is a 2d array. I have used the same training input matrix for initialization & used the same input data point against lime explainer built on Random forest earlier, it did work fine. It doesnt seem to work for the custom stacking implementation.

The error log has marked this an error;

--> 531     check_consistent_length(X, y)
ValueError: Found input variables with inconsistent numbers of samples: [44, 1] 

from lime.

marcotcr avatar marcotcr commented on August 26, 2024

can you share a notebook with the error?

from lime.

gsvijayraajaa avatar gsvijayraajaa commented on August 26, 2024

Sure. I have shared the same to your inbox.

from lime.

gsvijayraajaa avatar gsvijayraajaa commented on August 26, 2024

Thanks for the right direction. Your previous correction was perfectly right, the stacking predict_proba function was returning only the first output. I had changed it to work on an array of any given size. Since the sample in my implementation was initialized with a size 44, the ideal output from the predict_proba from my stacking implementation should be (44x2).

from lime.

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.