a b/docs-source/source/model.rst
1
.. currentmodule:: slideflow.model
2
3
slideflow.model
4
===============
5
6
This module provides the :class:`ModelParams` class to organize model and training
7
parameters/hyperparameters and assist with model building, as well as the :class:`Trainer` class that
8
executes model training and evaluation. :class:`RegressionTrainer` and :class:`SurvivalTrainer`
9
are extensions of this class, supporting regression and Cox Proportional Hazards outcomes, respectively. The function
10
:func:`build_trainer` can choose and return the correct model instance based on the provided
11
hyperparameters.
12
13
.. note::
14
    In order to support both Tensorflow and PyTorch backends, the :mod:`slideflow.model` module will import either
15
    :mod:`slideflow.model.tensorflow` or :mod:`slideflow.model.torch` according to the currently active backend,
16
    indicated by the environmental variable ``SF_BACKEND``.
17
18
See :ref:`training` for a detailed look at how to train models.
19
20
Trainer
21
*******
22
.. autoclass:: Trainer
23
.. autofunction:: slideflow.model.Trainer.load
24
.. autofunction:: slideflow.model.Trainer.evaluate
25
.. autofunction:: slideflow.model.Trainer.predict
26
.. autofunction:: slideflow.model.Trainer.train
27
28
RegressionTrainer
29
*****************
30
.. autoclass:: RegressionTrainer
31
32
SurvivalTrainer
33
***************
34
.. autoclass:: SurvivalTrainer
35
36
Features
37
********
38
.. autoclass:: Features
39
.. autofunction:: slideflow.model.Features.from_model
40
.. autofunction:: slideflow.model.Features.__call__
41
42
Other functions
43
***************
44
.. autofunction:: build_trainer
45
.. autofunction:: build_feature_extractor
46
.. autofunction:: list_extractors
47
.. autofunction:: load
48
.. autofunction:: is_tensorflow_model
49
.. autofunction:: is_tensorflow_tensor
50
.. autofunction:: is_torch_model
51
.. autofunction:: is_torch_tensor
52
.. autofunction:: read_hp_sweep
53
.. autofunction:: rebuild_extractor