计算风险因子

        Return:
        alpha               -- 风险因子，float类型
357476
def get_alpha(self, *args):
        
        for x in args:
            self.EF += get_ef(self._unit, x)
        molecular = self.PTN + self.EF - self.SCN + 1
        denominator = self.NN + self.SPN + self.SCN - self.EF + 1
        if molecular <= 0:
            molecular = 1
        if denominator <=0:
            denominator = 1
        fraction = molecular / denominator
        if args:
            alpha = ln(fraction)
            log('debug',
                '当前参数如下：\n文本行：【{}】\n纯文本数：【{}】，强化因子：【{}】，数字数：【{}】，特殊字符数：【{}】，特殊中文字符：【{}】，字符数：【{}】\n风险因子：【{}】，句数：【{}】'.format(
                    self._unit, self.PTN, self.EF, self.NN, self.SPN, self.SCN, self.NC, alpha, self.SN))
        else:
            alpha = ln(fraction) + self.SN
            log('debug',
                '当前参数如下：\n文本行：【{}】\n纯文本数：【{}】，句数：【{}】，数字数：【{}】，特殊字符数：【{}】，特殊中文字符：【{}】，字符数：【{}】\n风险因子：【{}】'.format(
                    self._unit, self.PTN, self.SN, self.NN, self.SPN, self.SCN, self.NC, alpha))
        return alpha
52608
def get_float(self, key, default=None):
        
        value = self.get(key, default)
        return None if value is None else float(value)
455231
def alpha(requestContext, seriesList, alpha):
    
    for series in seriesList:
        series.options['alpha'] = alpha
    return seriesList
1307483
def delta(self,local=False):
        
        (s,e) = self.get(local)
        return e-s
12399
def alpha(self, a=None):
        """"""
        if a is not None:
            self.GetProperty().SetOpacity(a)
            return self
        else:
            return self.GetProperty().GetOpacity()
1304170
def bn2float(module:nn.Module)->nn.Module:
    ""
    if isinstance(module, torch.nn.modules.batchnorm._BatchNorm): module.float()
    for child in module.children(): bn2float(child)
    return module
261886
def all_near_zero(a: Union[float, complex, Iterable[float], np.ndarray],
                  *,
                  atol: float = 1e-8) -> bool:
    
    return np.all(np.less_equal(np.abs(a), atol))
177309
def apb(s, o):
    
    # s,o = filter_nan(s,o)
    return 100.0*np.sum(np.abs(s-o))/np.sum(o)
695642
def getBottomRight(self):
        
        return (float(self.get_cx()) + float(self.get_r()), float(self.get_cy()) - float(self.get_r()))
152082
public function getAspectRatio(): float
    {
        $attrs = $this->getXmlAttrs();

        if (!isset($attrs->viewBox)) {
            return 0;
        }

        list(, , $width, $height) = explode(' ', $attrs->viewBox);

        return $width / $height;
    }
321143
def get_float_relative(strings: Sequence[str],
                       prefix1: str,
                       delta: int,
                       prefix2: str,
                       ignoreleadingcolon: bool = False) -> Optional[float]:
    
    return get_float_raw(get_string_relative(
        strings, prefix1, delta, prefix2,
        ignoreleadingcolon=ignoreleadingcolon))
469132
def _get_alpha_data(data: np.ndarray, kwargs) -> Union[float, np.ndarray]:
    
    alpha = kwargs.pop("alpha", 1)
    if hasattr(alpha, "__call__"):
        return np.vectorize(alpha)(data)
    return alpha
107671
def multiplyC(self, alpha):
        """"""
        self.C *= alpha
        if self.dC is not self.C:
            self.dC *= alpha
        self.D *= alpha**0.5
602354
def positivefloat(value):
    
    f = float(not_empty(value))
    if f < 0:
        raise ValueError('float %s < 0' % f)
    return f
491555
def _get_z(self, kwargs):
        '''
        
        '''
        if self._type == 1 or self._type == 2:
            if 'z' in kwargs:
                return round(float(kwargs['z']), 6)
            elif self._element_z in kwargs:
                return round(float(kwargs[self._element_z]), 6)
        raise TypeError()
1042784
void alphaFunction(double alpha[], List<Double> x, int dim, int type) {
    if (dim == 2) {
      if (type == 21) {
        alpha[0] = x.get(0);
        alpha[1] = 1 - Math.sqrt(x.get(0));
      }

      if (type == 22) {
        alpha[0] = x.get(0);
        alpha[1] = 1 - x.get(0) * x.get(0);
      }

      if (type == 23) {
        alpha[0] = x.get(0);
        alpha[1] = 1 - Math.sqrt(alpha[0]) - alpha[0]
          * Math.sin(10 * alpha[0] * alpha[0] * Math.PI);
      }

      if (type == 24) {
        alpha[0] = x.get(0);
        alpha[1] = 1 - x.get(0) - 0.05 * Math.sin(4 * Math.PI * x.get(0));
      }
    } else {
      if (type == 31) {
        alpha[0] = Math.cos(x.get(0) * Math.PI / 2) * Math.cos(x.get(1) * Math.PI / 2);
        alpha[1] = Math.cos(x.get(0) * Math.PI / 2) * Math.sin(x.get(1) * Math.PI / 2);
        alpha[2] = Math.sin(x.get(0) * Math.PI / 2);
      }

      if (type == 32) {
        alpha[0] = 1 - Math.cos(x.get(0) * Math.PI / 2)
          * Math.cos(x.get(1) * Math.PI / 2);
        alpha[1] = 1 - Math.cos(x.get(0) * Math.PI / 2)
          * Math.sin(x.get(1) * Math.PI / 2);
        alpha[2] = 1 - Math.sin(x.get(0) * Math.PI / 2);
      }

      if (type == 33) {
        alpha[0] = x.get(0);
        alpha[1] = x.get(1);
        alpha[2] = 3
          - (Math.sin(3 * Math.PI * x.get(0)) + Math.sin(3 * Math.PI * x.get(1))) - 2
          * (x.get(0) + x.get(1));
      }

      if (type == 34) {
        alpha[0] = x.get(0) * x.get(1);
        alpha[1] = x.get(0) * (1 - x.get(1));
        alpha[2] = (1 - x.get(0));
      }
    }
  }
609473
def ab_values(value):
    
    a, b = value.split()
    return positivefloat(a), float_(b)