{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The documentation of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "UnivariateDistribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:UnivariateDistribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is not rendered. See below for an example of how to instantiate the class (i.e. pass all shape parameters of "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "dist"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to the initializer as keyword arguments). Documentation of all methods is identical to that of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "scipy.stats.Normal",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "scipy",
                "version": "*",
                "kind": "api",
                "path": "scipy.stats._new_distributions:Normal"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "help"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " on the returned class or its methods for more information."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Array API Standard Support"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "make_distribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:make_distribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ⛔                   \nPyTorch               ⛔                     ⛔                   \nJAX                   ⛔                     ⛔                   \nDask                  ⛔                     n/a                 \n====================  ====================  ====================",
          "execution_status": null
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for more information."
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "CustomDistribution",
              "annotation": "`UnivariateDistribution`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A subclass of "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "UnivariateDistribution",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.stats._distribution_infrastructure:UnivariateDistribution"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " corresponding with "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "dist"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". The initializer requires all shape parameters to be passed as keyword arguments (using the same names as the instance of "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "rv_continuous",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "/"
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "rv_discrete",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.stats._distn_infrastructure:rv_discrete"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ")."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Generate a "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "UnivariateDistribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:UnivariateDistribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " class from a compatible object"
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "dist",
              "annotation": "`rv_continuous`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Instance of "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "rv_continuous",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "rv_discrete",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.stats._distn_infrastructure:rv_discrete"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", or an instance of any class with the following attributes:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "__make_distribution_version__"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "__make_distribution_version__"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "parameters"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "parameters"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "support"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "support"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The class "
                    },
                    {
                      "__type": "Strong",
                      "__tag": 4048,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "must"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " also define a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "pdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method and "
                    },
                    {
                      "__type": "Strong",
                      "__tag": 4048,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "may"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " define methods "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "logentropy"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "entropy"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "median"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "mode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "logpdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "logcdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "cdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "logccdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ccdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ilogcdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "icdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ilogccdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "iccdf"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "moment"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "sample"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If defined, these methods must accept the parameters of the distribution as keyword arguments and also accept any positional-only arguments accepted by the corresponding method of "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "ContinuousDistribution",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.stats._distribution_infrastructure:ContinuousDistribution"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". When multiple parameterizations are defined, these methods must accept all parameters from all parameterizations. The "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "moment"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method must accept the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "order"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "kind"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " arguments by position or keyword, but may return "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if a formula is not available for the arguments; in this case, the infrastructure will fall back to a default implementation. The "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "sample"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method must accept "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "shape"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " by position or keyword, but contrary to the public method of the same name, the argument it receives will be the "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "full"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " shape of the output array - that is, the shape passed to the public method prepended to the broadcasted shape of random variable parameters."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The argument may be an instance of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "rv_continuous",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or an instance of another class that satisfies the interface described below."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The returned value is a "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "ContinuousDistribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:ContinuousDistribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " subclass if the input is an instance of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "rv_continuous",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or a "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "DiscreteDistribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:DiscreteDistribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " subclass if the input is an instance of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "rv_discrete",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distn_infrastructure:rv_discrete"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Like any subclass of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "UnivariateDistribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:UnivariateDistribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", it must be instantiated (i.e. by passing all shape parameters as keyword arguments) before use. Once instantiated, the resulting object will have the same interface as any other instance of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "UnivariateDistribution",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._distribution_infrastructure:UnivariateDistribution"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; e.g., "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "scipy.stats.Normal",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "scipy",
                "version": "*",
                "kind": "api",
                "path": "scipy.stats._new_distributions:Normal"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "scipy.stats.Binomial",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "scipy",
                "version": "*",
                "kind": "api",
                "path": "scipy.stats._new_distributions:Binomial"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "make_distribution",
                  "reference": {
                    "__type": "LocalRef",
                    "__tag": 4022,
                    "kind": "module",
                    "path": "scipy.stats._distribution_infrastructure:make_distribution"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " does not work perfectly with all instances of "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "rv_continuous",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". Known failures include "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "levy_stable",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "vonmises",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "hypergeom",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", 'nchypergeom_fisher', 'nchypergeom_wallenius', and "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "poisson_binom",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". Some methods of some distributions will not support array shape parameters."
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/stats/_distribution_infrastructure.py",
  "item_line": 3920,
  "item_type": "function",
  "aliases": [
    "scipy.stats.make_distribution"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import stats\nfrom scipy import special\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCreate a `ContinuousDistribution` from `scipy.stats.loguniform`.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "LogUniform = stats.make_distribution(stats.loguniform)\nX = LogUniform(a=1.0, b=3.0)\nnp.isclose((X + 0.25).median(), stats.loguniform.ppf(0.5, 1, 3, loc=0.25))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "X.plot()\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "sample = X.sample(10000, rng=np.random.default_rng())\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.hist(sample, density=True, bins=30)\nplt.legend(('pdf', 'histogram'))\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-57e74d9f38892e5a.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCreate a custom distribution.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "class MyLogUniform:\n    @property\n    def __make_distribution_version__(self):\n        return \"1.16.0\"\n\n    @property\n    def parameters(self):\n        return {'a': {'endpoints': (0, np.inf),\n                      'inclusive': (False, False)},\n                'b': {'endpoints': ('a', np.inf),\n                      'inclusive': (False, False)}}\n\n    @property\n    def support(self):\n        return {'endpoints': ('a', 'b'), 'inclusive': (True, True)}\n\n    def pdf(self, x, a, b):\n        return 1 / (x * (np.log(b)- np.log(a)))\nMyLogUniform = stats.make_distribution(MyLogUniform())\nY = MyLogUniform(a=1.0, b=3.0)\nnp.isclose(Y.cdf(2.), X.cdf(2.))\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCreate a custom distribution with variable support.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "class MyUniformCube:\n    @property\n    def __make_distribution_version__(self):\n        return \"1.16.0\"\n\n    @property\n    def parameters(self):\n        return {\"a\": (-np.inf, np.inf),\n                \"b\": {'endpoints':('a', np.inf), 'inclusive':(True, False)}}\n\n    @property\n    def support(self):\n        def left(*, a, b):\n            return a**3\n\n        def right(*, a, b):\n            return b**3\n        return (left, right)\n\n    def pdf(self, x, *, a, b):\n        return 1 / (3*(b - a)*np.cbrt(x)**2)\n\n    def cdf(self, x, *, a, b):\n        return (np.cbrt(x) - a) / (b - a)\nMyUniformCube = stats.make_distribution(MyUniformCube())\nX = MyUniformCube(a=-2, b=2)\nY = stats.Uniform(a=-2, b=2)**3\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "X.support()\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.isclose(X.cdf(2.1), Y.cdf(2.1))\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCreate a custom distribution with multiple parameterizations. Here we create a\ncustom version of the beta distribution that has an alternative parameterization\nin terms of the mean ``mu`` and a dispersion parameter ``nu``.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "class MyBeta:\n    @property\n    def __make_distribution_version__(self):\n        return \"1.16.0\"\n\n    @property\n    def parameters(self):\n        return ({\"a\": (0, np.inf), \"b\": (0, np.inf)},\n                {\"mu\": (0, 1), \"nu\": (0, np.inf)})\n\n    def process_parameters(self, a=None, b=None, mu=None, nu=None):\n        if a is not None and b is not None:\n            nu = a + b\n            mu = a / nu\n        else:\n            a = mu * nu\n            b = nu - a\n        return dict(a=a, b=b, mu=mu, nu=nu)\n\n    @property\n    def support(self):\n        return {'endpoints': (0, 1)}\n\n    def pdf(self, x, a, b, mu, nu):\n        return special._ufuncs._beta_pdf(x, a, b)\n\n    def cdf(self, x, a, b, mu, nu):\n        return special.betainc(a, b, x)\nMyBeta = stats.make_distribution(MyBeta())\nX = MyBeta(a=2.0, b=2.0)\nY = MyBeta(mu=0.5, nu=4.0)\nnp.isclose(X.pdf(0.3), Y.pdf(0.3))\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "dist",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "make_distribution"
  },
  "references": null,
  "qa": "scipy.stats._distribution_infrastructure:make_distribution",
  "arbitrary": [],
  "local_refs": [
    "CustomDistribution",
    "dist"
  ]
}