Coder Social home page Coder Social logo

Comments (9)

nschloe avatar nschloe commented on June 7, 2024 1

That's not implemented yet, no. Would you be interested in that feature?

from quadpy.

HJA24 avatar HJA24 commented on June 7, 2024

100%!

from quadpy.

nschloe avatar nschloe commented on June 7, 2024

Give me some details. What's the dimensionality? What does the function look like? etc.

from quadpy.

HJA24 avatar HJA24 commented on June 7, 2024

I am rewriting the R-code in the Appendex of this paper

import scipy.stats as ss

def G(f, x, n, theta, a, b, c1, c2, k):

    def l_3_1(p, theta):
        if p > (1 / theta):
            kelly = (p * theta - 1) / (theta - 1)
        else:
            kelly = 0

        if p < (f * (theta - 1) + 1) / theta:
            loss_func = (c1 + c2) * (abs(f - kelly) ** k)
        else:
            loss_func = 0

        return loss_func * ss.beta.pdf(p, a + x, n - x + b)

    def l_3_2(p, theta):
        if p > (1 / theta):
            kelly = (p * theta - 1) / (theta - 1)
        else:
            kelly = 0

        if p >= (f * (theta - 1) + 1) / theta:
            loss_func = c2 * (abs(f - kelly) ** k)
        else:
            loss_func = 0

        return loss_func * ss.beta.pdf(p, a + x, n - x + b)

    # integrate the loss functions
    part_1 = quadpy.relevantFunction(l_3_1,
                                     lowerLimit=0,
                                     upperLimit=(f * (theta - 1) + 1) / theta,
                                     tol=1e-10)
    part_2 = quadpy.relevantFunction(l_3_2,
                                     lowerLimit=(f * (theta - 1) + 1) / theta,
                                     upperLimit=1,
                                     tol=1e-10)
 
    # return the sum of the two integrals
    return part_1 + part_2

What do you think?

from quadpy.

nschloe avatar nschloe commented on June 7, 2024

Those integrals are just one-dimensional, right?

from quadpy.

HJA24 avatar HJA24 commented on June 7, 2024

You're right. Excuse my ignorance, but which quadpy function would you use for this then?

from quadpy.

nschloe avatar nschloe commented on June 7, 2024

quadpy.quad

https://github.com/sigma-py/quadpy#using-quadpy

More things are a little weird about the implementation, but perhaps you'll be able figure it out by yourself.

from quadpy.

HJA24 avatar HJA24 commented on June 7, 2024

I understand your point and altered my script.
Can you show me how to use quadpy.quad to integrate over multiple limits? I created a separate Stackoverflow-question as this topic can be closed.

from quadpy.

nschloe avatar nschloe commented on June 7, 2024

If you need any more help with this, note that Sigma licenses come with proritized bug fixing. Just let us know your license e-mail address and we'll tackle the issue.

from quadpy.

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.