a b/docs-source/source/model_params.rst
1
.. currentmodule:: slideflow
2
3
.. _model_params:
4
5
slideflow.ModelParams
6
=====================
7
8
The :class:`ModelParams` class organizes model and training parameters/hyperparameters and assists with model building.
9
10
See :ref:`training` for a detailed look at how to train models.
11
12
ModelParams
13
***********
14
.. autoclass:: ModelParams
15
.. autofunction:: slideflow.ModelParams.to_dict
16
.. autofunction:: slideflow.ModelParams.get_normalizer
17
.. autofunction:: slideflow.ModelParams.validate
18
.. autofunction:: slideflow.ModelParams.model_type
19
20
Mini-batch balancing
21
********************
22
23
During training, mini-batch balancing can be customized to assist with increasing representation of sparse outcomes or small slides. Five mini-batch balancing methods are available when configuring :class:`slideflow.ModelParams`, set through the parameters ``training_balance`` and ``validation_balance``. These are ``'tile'``, ``'category'``, ``'patient'``, ``'slide'``, and ``'none'``.
24
25
If **tile-level balancing** ("tile") is used, tiles will be selected randomly from the population of all extracted tiles.
26
27
If **slide-based balancing** ("patient") is used, batches will contain equal representation of images from each slide.
28
29
If **patient-based balancing** ("patient") is used, batches will balance image tiles across patients. The balancing is similar to slide-based balancing, except across patients (as each patient may have more than one slide).
30
31
If **category-based balancing** ("category") is used, batches will contain equal representation from each outcome category.
32
33
If **no balancing** is performed, batches will be assembled by randomly selecting from TFRecords. This is equivalent to slide-based balancing if each slide has its own TFRecord (default behavior).
34
35
See :ref:`balancing` for more discussion on sampling and mini-batch balancing.
36
37
.. note::
38
39
    If you are :ref:`using a Trainer <training_with_trainer>` to train your models, you can further customize the mini-batch balancing strategy by using :meth:`slideflow.Dataset.balance` on your training and/or validation datasets.