简体   繁体   中英

Function docstrings not on the web/pdf api reference scipy.stats?

Am I misunderstanding how to use SciPy documentation?

I'm finding that I get much less-detailed information about stats.gamma.fit from the SciPy API Reference webpage/pdf, at least for scipy.stats , than I do from doing stats.gamma.fit? on a python console. Particularly I was unable to find out how the return value is structured from the web/pdf API Reference, even though it describes itself as

The exact API of all functions and classes, as given by the docstrings. The API documents expected types and allowed features for all functions, and all parameters available for the algorithms.

I also think there's a contradiction between the specification described by the web/pdf API Reference and the console docstring. Specifically, the web/pdf Reference says that the fit method produces a default value for the parameters floc and fscale . But the docstring from the console says,

kwds : floats, optional Starting values for the location and scale parameters; no default.

Am I reading these right?

As said in comments, the method fit is documented within the rv_continuous class , specifically here . This documentation is not repeated for each instance of the class such as gamma .

Starting values for the location and scale parameters; no default.

This is technically correct but in a somewhat misleading way. It means the fit method signature fit(self, data, *args, **kwds) does not include default values for any arguments; there is no loc=0 , etc here.

Since some starting values are necessary for the minimizer to work, they will be generated by calling an internal method _fitstart if not provided by the user:

if (Narg < self.numargs) or not ('loc' in kwds and 'scale' in kwds):
    start = self._fitstart(data)

One can think of the values provided by _fitstart as default, but they are not default parameter values in the Python sense.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM