scaler.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:l1l2py 作者: slipguru 项目源码 文件源码
def tau_range(self, trange):
        """Return a scaled tau range.

        Tau scaling factor is the maximum tau value to avoid and empty solution
        (where all variables are discarded).
        The value is estimated on the maximum correlation between data and
        labels.

        Parameters
        ----------
        trange : :class:`numpy.ndarray`
            Tau range containing relative values (expected maximum is lesser
            than 1.0 and minimum greater than 0.0).

        Returns
        -------
        tau_range : :class:`numpy.ndarray`
            Scaled tau range.
        """
        if np.max(trange) >= 1.0 or np.min(trange) < 0.0:
            raise ValueError('Relative tau should be in [0,1)')
        if isinstance(trange, Sequence):
            trange = np.sort(trange)
        return trange * self.tau_scaling_factor
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号