Exemplo n.º 1
0
    def view_clm_widget(self,
                        n_shape_parameters=5,
                        parameters_bounds=(-3.0, 3.0),
                        mode='multiple',
                        figure_size=(7, 7)):
        r"""
        Visualizes the CLM object using an interactive widget.

        Parameters
        ----------
        n_shape_parameters : `int` or `list` of `int` or ``None``, optional
            The number of shape principal components to be used for the
            parameters sliders. If `int`, then the number of sliders per
            scale is the minimum between `n_parameters` and the number of
            active components per scale. If `list` of `int`, then a number of
            sliders is defined per scale. If ``None``, all the active
            components per scale will have a slider.
        parameters_bounds : ``(float, float)``, optional
            The minimum and maximum bounds, in std units, for the sliders.
        mode : {``single``, ``multiple``}, optional
            If ``'single'``, only a single slider is constructed along with a
            drop down menu. If ``'multiple'``, a slider is constructed for
            each parameter.
        figure_size : (`int`, `int`), optional
            The size of the rendered figure.

        Raises
        ------
        ValueError
            Only convolution-based expert ensembles can be visualized.
        """
        if not isinstance(self.expert_ensembles[0],
                          ConvolutionBasedExpertEnsemble):
            raise ValueError('Only convolution-based expert ensembles can be '
                             'visualized.')
        try:
            from menpowidgets import visualize_clm
            visualize_clm(self,
                          n_shape_parameters=n_shape_parameters,
                          parameters_bounds=parameters_bounds,
                          figure_size=figure_size,
                          mode=mode)
        except:
            from menpo.visualize.base import MenpowidgetsMissingError
            raise MenpowidgetsMissingError()
Exemplo n.º 2
0
    def view_clm_widget(self, n_shape_parameters=5,
                        parameters_bounds=(-3.0, 3.0), mode='multiple',
                        figure_size=(7, 7)):
        r"""
        Visualizes the CLM object using an interactive widget.

        Parameters
        ----------
        n_shape_parameters : `int` or `list` of `int` or ``None``, optional
            The number of shape principal components to be used for the
            parameters sliders. If `int`, then the number of sliders per
            scale is the minimum between `n_parameters` and the number of
            active components per scale. If `list` of `int`, then a number of
            sliders is defined per scale. If ``None``, all the active
            components per scale will have a slider.
        parameters_bounds : ``(float, float)``, optional
            The minimum and maximum bounds, in std units, for the sliders.
        mode : {``single``, ``multiple``}, optional
            If ``'single'``, only a single slider is constructed along with a
            drop down menu. If ``'multiple'``, a slider is constructed for
            each parameter.
        figure_size : (`int`, `int`), optional
            The size of the rendered figure.

        Raises
        ------
        ValueError
            Only convolution-based expert ensembles can be visualized.
        """
        if not isinstance(self.expert_ensembles[0],
                          ConvolutionBasedExpertEnsemble):
            raise ValueError('Only convolution-based expert ensembles can be '
                             'visualized.')
        try:
            from menpowidgets import visualize_clm
            visualize_clm(self, n_shape_parameters=n_shape_parameters,
                          parameters_bounds=parameters_bounds,
                          figure_size=figure_size, mode=mode)
        except:
            from menpo.visualize.base import MenpowidgetsMissingError
            raise MenpowidgetsMissingError()