[78ef36]: / docs / _sources / model_params.rst.txt

Download this file

39 lines (24 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.. currentmodule:: slideflow
.. _model_params:
slideflow.ModelParams
=====================
The :class:`ModelParams` class organizes model and training parameters/hyperparameters and assists with model building.
See :ref:`training` for a detailed look at how to train models.
ModelParams
***********
.. autoclass:: ModelParams
.. autofunction:: slideflow.ModelParams.to_dict
.. autofunction:: slideflow.ModelParams.get_normalizer
.. autofunction:: slideflow.ModelParams.validate
.. autofunction:: slideflow.ModelParams.model_type
Mini-batch balancing
********************
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'``.
If **tile-level balancing** ("tile") is used, tiles will be selected randomly from the population of all extracted tiles.
If **slide-based balancing** ("patient") is used, batches will contain equal representation of images from each slide.
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).
If **category-based balancing** ("category") is used, batches will contain equal representation from each outcome category.
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).
See :ref:`balancing` for more discussion on sampling and mini-batch balancing.
.. note::
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.