mercredi 7 janvier 2015

(Python-nolearn) Is it possible to reproduce the results by using DBN class in nolearn

Generally, in sklearn, there is a random_state parameter, so I can reproduce the result to set the random_state to a fix number. But for nolearn DBN class, I am not able to find the random_state parameter. I am just wondering that is it possible to reproduce the results? If so, how to do it?


Here it is the link (http://ift.tt/1pAVF5b) to the document for that class.


Also, below is the source code for the parameters of that class:



class DBN(BaseEstimator):
"""A scikit-learn estimator based on George Dahl's DBN
implementation `gdbn`.
"""
def __init__(
self,
layer_sizes=None,
scales=0.05,
fan_outs=None,
output_act_funct=None,
real_valued_vis=True,
use_re_lu=True,
uniforms=False,

learn_rates=0.1,
learn_rate_decays=1.0,
learn_rate_minimums=0.0,
momentum=0.9,
l2_costs=0.0001,
dropouts=0,
nesterov=True,
nest_compare=True,
rms_lims=None,

learn_rates_pretrain=None,
momentum_pretrain=None,
l2_costs_pretrain=None,
nest_compare_pretrain=None,

epochs=10,
epochs_pretrain=0,
loss_funct=None,
minibatch_size=64,
minibatches_per_epoch=None,

pretrain_callback=None,
fine_tune_callback=None,
verbose=0,
):
"""
Many parameters such as `learn_rates`, `dropouts` etc. will
also accept a single value, in which case that value will be
used for all layers. To control the value per layer, pass a
list of values instead; see examples below.

Parameters ending with `_pretrain` may be provided to override
the given parameter for pretraining. Consider an example
where you want the pre-training to use a lower learning rate
than the fine tuning (the backprop), then you'd maybe pass
something like::

DBN([783, 300, 10], learn_rates=0.1, learn_rates_pretrain=0.005)

If you don't pass the `learn_rates_pretrain` parameter, the
value of `learn_rates` will be used for both pre-training and
fine tuning. (Which seems to not work very well.)

:param layer_sizes: A list of integers of the form
``[n_vis_units, n_hid_units1,
n_hid_units2, ..., n_out_units]``.

An example: ``[784, 300, 10]``

The number of units in the input layer and
the output layer will be set automatically
if you set them to -1. Thus, the above
example is equivalent to ``[-1, 300, -1]``
if you pass an ``X`` with 784 features,
and a ``y`` with 10 classes.

:param scales: Scale of the randomly initialized weights. A
list of floating point values. When you find
good values for the scale of the weights you
can speed up training a lot, and also improve
performance. Defaults to `0.05`.

:param fan_outs: Number of nonzero incoming connections to a
hidden unit. Defaults to `None`, which means
that all connections have non-zero weights.

:param output_act_funct: Output activation function. Instance
of type
:class:`~gdbn.activationFunctions.Sigmoid`,
:class:`~.gdbn.activationFunctions.Linear`,
:class:`~.gdbn.activationFunctions.Softmax`
from the
:mod:`gdbn.activationFunctions`
module. Defaults to
:class:`~.gdbn.activationFunctions.Softmax`.

:param real_valued_vis: Set `True` (the default) if visible
units are real-valued.

:param use_re_lu: Set `True` to use rectified linear units.
Defaults to `False`.

:param uniforms: Not documented at this time.

:param learn_rates: A list of learning rates, one entry per
weight layer.

An example: ``[0.1, 0.1]``

:param learn_rate_decays: The number with which the
`learn_rate` is multiplied after
each epoch of fine-tuning.

:param learn_rate_minimums: The minimum `learn_rates`; after
the learn rate reaches the minimum
learn rate, the
`learn_rate_decays` no longer has
any effect.

:param momentum: Momentum

:param l2_costs: L2 costs per weight layer.

:param dropouts: Dropouts per weight layer.

:param nesterov: Not documented at this time.

:param nest_compare: Not documented at this time.

:param rms_lims: Not documented at this time.

:param learn_rates_pretrain: A list of learning rates similar
to `learn_rates_pretrain`, but
used for pretraining. Defaults
to value of `learn_rates` parameter.

:param momentum_pretrain: Momentum for pre-training. Defaults
to value of `momentum` parameter.

:param l2_costs_pretrain: L2 costs per weight layer, for
pre-training. Defaults to the value
of `l2_costs` parameter.

:param nest_compare_pretrain: Not documented at this time.

:param epochs: Number of epochs to train (with backprop).

:param epochs_pretrain: Number of epochs to pre-train (with CDN).

:param loss_funct: A function that calculates the loss. Used
for displaying learning progress and for
:meth:`score`.

:param minibatch_size: Size of a minibatch.

:param minibatches_per_epoch: Number of minibatches per epoch.
The default is to use as many as
fit into our training set.

:param pretrain_callback: An optional function that takes as
arguments the :class:`DBN` instance,
the epoch and the layer index as its
argument, and is called for each
epoch of pretraining.

:param fine_tune_callback: An optional function that takes as
arguments the :class:`DBN` instance
and the epoch, and is called for
each epoch of fine tuning.

:param verbose: Debugging output.
"""




Aucun commentaire:

Enregistrer un commentaire