Giter VIP home page Giter VIP logo

Comments (6)

chriswbartley avatar chriswbartley commented on July 29, 2024

from monoensemble.

vasselai avatar vasselai commented on July 29, 2024

Hi Chris, first of all, many thanks for the details. And apologies: I had deleted my original post here before you replied (I think you replied by email, that's why you did not notice it). I deleted it because I thought my original question was actually increasing confusion unnecessarily and I preferred to wait a bit until I understood what was going before re-posting.

It turns out I figured how to do it properly for the multi-class case. In case it helps, here's the temporary snippet I was working with:

import numpy as np
def cumToClassProb(cumPreds):
    preds = 1-cumPreds.copy()
    for col in range(0, preds.shape[1]-1):
        preds[:, col+1] = cumPreds[:, col] - cumPreds[:, col+1]
    preds = np.column_stack((preds, cumPreds[:, cumPreds.shape[1]-1]))
    return preds

Also, now that you have settled the issue, I will quote below the relevant part of my original post just so future readers can understand what you reacted to:

Perhaps I can help with a new Pull Request for this issue. However, I got confused with your notation above. Am I understanding correctly that those are cumulative ordinal class probabilities? That is, suppose the classification problem has n data points and m ordinal classes (ordered ascendingly from 1 to m), where y is the output variable with n observations indexed by i, such that y_i \in {1...m}. Then, for a given test point i, wouldn't it be the case that the predict_prob command() in 'monoensemble' actually returns a vector [Pr(y_i >= 1), Pr(y_i >= 2), ..., Pr(y_i = m)] instead of the one you described?

If yes, then the solution to this issue would be trivial: one could retrieve the actual ordinal class probabilities by simply subtracting backwards from the cumulation, e.g. class Pr(y_i = m-1) = Pr(y_i >= m-1) - Pr(y_i = m). Am I getting right what predict_prob() is returning?

Looking forward to the new commits with your final solution!
Cheers.

from monoensemble.

chriswbartley avatar chriswbartley commented on July 29, 2024

OK, I've just pushed a version that should make predict_proba() give predicted class probabilities. It looks to work well but admittedly I was a bit rushed, let me know if you find problems!

from monoensemble.

chriswbartley avatar chriswbartley commented on July 29, 2024

Oh, and thanks for the code snippet, that looks right! 🙂

from monoensemble.

vasselai avatar vasselai commented on July 29, 2024

Finished doing a few days of testing. All looks good on this front - I did find one error, which I will open another issue for. But I think you can close this one here.

from monoensemble.

chriswbartley avatar chriswbartley commented on July 29, 2024

Great to hear - thanks for testing Fabricio!

from monoensemble.

Related Issues (4)

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.