def fit(self, data, *args, **kwds):
Narg = len(args)<EOL>if Narg > self.numargs:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>start = [None]*<NUM_LIT:2><EOL>if (Narg < self.numargs) or not ('<STR_LIT>' in kwds and<EOL>'<STR_LIT>' in kwds):<EOL><INDENT>start = self._fitstart(data)<EOL>args += start[Narg:-<NUM_LIT:2>]<EOL><DEDENT>loc = kwds.get('<STR_LIT>', start[-<NUM_LIT:2>])<EOL>scale = kwds.get('<STR_LIT>', start[-<NUM_LIT:1>])<EOL>args += (loc, scale)<EOL>x0, func, restore, args = self._reduce_func(args, kwds)<EOL>optimizer = kwds.get('<STR_LIT>', optimize.fmin)<EOL>if not callable(optimizer) and isinstance(optimizer, string_types):<EOL><INDENT>if not optimizer.startswith('<STR_LIT>'):<EOL><INDENT>optimizer = "<STR_LIT>"+optimizer<EOL><DEDENT>if optimizer == '<STR_LIT>':<EOL><INDENT>optimizer = '<STR_LIT>'<EOL><DEDENT>try:<EOL><INDENT>optimizer = getattr(optimize, optimizer)<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise ValueError("<STR_LIT>" % optimizer)<EOL><DEDENT><DEDENT>vals = optimizer(func, x0, args=(ravel(data),), disp=<NUM_LIT:0>)<EOL>if restore is not None:<EOL><INDENT>vals = restore(args, vals)<EOL><DEDENT>vals = tuple(vals)<EOL>return vals<EOL>
Return MLEs for shape, location, and scale parameters from data.

MLE stands for Maximum Likelihood Estimate.  Starting estimates for
the fit are given by input arguments; for any arguments not provided
with starting estimates, ``self._fitstart(data)`` is called to generate
such.

One can hold some parameters fixed to specific values by passing in
keyword arguments ``f0``, ``f1``, ..., ``fn`` (for shape parameters)
and ``floc`` and ``fscale`` (for location and scale parameters,
respectively).

Parameters
----------
data : array_like
    Data to use in calculating the MLEs.
args : floats, optional
    Starting value(s) for any shape-characterizing arguments (those not
    provided will be determined by a call to ``_fitstart(data)``).
    No default value.
kwds : floats, optional
    Starting values for the location and scale parameters; no default.
    Special keyword arguments are recognized as holding certain
    parameters fixed:

    f0...fn : hold respective shape parameters fixed.

    floc : hold location parameter fixed to specified value.

    fscale : hold scale parameter fixed to specified value.

    optimizer : The optimizer to use.  The optimizer must take func,
                and starting position as the first two arguments,
                plus args (for extra arguments to pass to the
                function to be optimized) and disp=0 to suppress
                output as keyword arguments.

Returns
-------
shape, loc, scale : tuple of floats
    MLEs for any shape statistics, followed by those for location and
    scale.

Notes
-----
This fit is computed by maximizing a log-likelihood function, with
penalty applied for samples outside of range of the distribution. The
returned answer is not guaranteed to be the globally optimal MLE, it
may only be locally optimal, or the optimization may fail altogether.