[Python] How to find probability distribution and parameters for real data?

Discussão em 'Python' iniciado por Stack, Abril 4, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dataset from sklearn and I plotted the distribution of the load_diabetes.target data (i.e. the values of the regression that the load_diabetes.data are used to predict).

    Using Python 3, how can I get the distribution-type and parameters of the distribution this most closely resembles?

    All I know the target values are all positive and skewed (positve skew/right skew). . . Is there a way in Python to provide a few distributions and then get the best fit for the target data/vector? OR, to actually suggest a fit based on the data that's given? That would be realllllly useful for people who have theoretical statistical knowledge but little experience with applying it to "real data".

    Bonus Would it make sense to use this type of approach to figure out what your posterior distribution would be with "real data"? If no, why not?

    from sklearn.datasets import load_diabetes
    import matplotlib.pyplot as plt
    import seaborn as sns; sns.set()
    import pandas as pd

    #Get Data
    data = load_diabetes()
    X, y_ = data.data, data.target

    #Organize Data
    SR_y = pd.Series(y_, name="y_ (Target Vector Distribution)")

    #Plot Data
    fig, ax = plt.subplots()
    sns.distplot(SR_y, bins=25, color="g", ax=ax)
    plt.show()


    [​IMG]

    Continue reading...

Compartilhe esta Página