File:Illustration CRPS.png

From testwiki
Jump to navigation Jump to search
    Original file (547 × 432 pixels, file size: 18 KB, MIME type: image/png)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    This image could be re-created using vector graphics as an SVG file. This has several advantages; see Commons:Media for cleanup for more information. If an SVG form of this image is available, please upload it and afterwards replace this template with {{vector version available|new image name}}.
    It is recommended to name the SVG file “Illustration CRPS.svg”—then the template Vector version available (or Vva) does not need the new image name parameter.

    Summary

    Description
    English: Illustration of the continuous ranked probability score (CRPS). Given a sample y and a predicted cumulative distribution F, the CRPS is given by computing the difference between the curves at each point x of the support, squaring it and integrating it over the whole support.
    Deutsch: Illustration des kontinuierlichen Rang-Wahrscheinlichkeits-Scores (CRPS). Gegeben ist eine Stichprobe y und eine vorhergesagte kumulative Verteilung F. Der CRPS wird berechnet, indem man die Differenz zwischen den Kurven an jedem Punkt x des Trägers berechnet, diese Differenz quadriert und über den gesamten Träger integriert.
    Date
    Source Own work
    Author Biggerj1
    import matplotlib.pyplot as plt
    import numpy as np
    
    # Define the step function
    def step_function(x):
        return 0 if x < 0 else 1
    
    # Define the sigmoid function
    def sigmoid_function(x):
        return 1 / (1 + np.exp(-x))
    
    # Generate x values
    x_high_res = np.linspace(-10, 10, 1000)  # High resolution for the functions
    x_low_res = np.linspace(-10, 10, 71)  # Low resolution for the bars
    
    # Calculate y values for both functions
    y_step = [step_function(i) for i in x_high_res]
    y_sigmoid = [sigmoid_function(i) for i in x_high_res]
    
    # Plot both functions
    plt.plot(x_high_res, y_step, label=r'$\mathbb{1}_{x>y}$')
    plt.plot(x_high_res, y_sigmoid, label='F')
    
    # Create a series of vertical bars to represent the area between the two functions
    for i in range(len(x_low_res) - 1):
        bar_height = abs(sigmoid_function(x_low_res[i]) - step_function(x_low_res[i]))
        bar_width = x_low_res[i+1]-x_low_res[i] if i != len(x_low_res) - 2 else x_low_res[-1]-x_low_res[-2]
        plt.bar(x_low_res[i], bar_height, bottom=min(step_function(x_low_res[i]), sigmoid_function(x_low_res[i])), width=bar_width, color='grey', align='edge', alpha=0.5)
    
    # Add an annotation for the grey area
    plt.annotate('CRPS', xy=(0.75, 0.75), xytext=(-3, 0.7),
                 arrowprops=dict(facecolor='black', shrink=0.05))
    
    # Add labels and title
    plt.xlabel('x')
    #plt.title('Step Function vs Sigmoid Function')
    plt.legend()
    
    # Display the plot
    plt.show()
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Illustration of the continous ranked probability score (CRPS).

    Items portrayed in this file

    depicts

    4 September 2023

    image/png

    18,870 byte

    432 pixel

    547 pixel

    ec8dc62bbacf110357b16f12f7bb1bf71b8d6b88

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current21:00, 4 September 2023Thumbnail for version as of 21:00, 4 September 2023547 × 432 (18 KB)wikimediacommons>Biggerj1Uploaded own work with UploadWizard

    There are no pages that use this file.