swh:1:snp:3aec91c51d538d62f3f51f6a0af59fe452f330ab
Raw File
Tip revision: 6e780aec172e7389965f7e64499053b5d3fc30f3 authored by Zhu Wang on 09 February 2022, 20:20:02 UTC
version 0.4-2.21
Tip revision: 6e780ae
loss2.f
C loss value in subroutine ccglmreg, cf: loss.f
C dfun=1,4,5
C input: f is linear predictors, not probability if dfun=5
C output: los is the average loss

      subroutine loss2(n, y, f, weights, cfun, dfun, s, delta, los)
       implicit none
       integer cfun, dfun, i, n
       double precision y(n),f(n),u(n),z(n),gval(n),s,los,weights(n),
     +   delta
       external compute_g, compute_z, compute_u 

      if(dfun .NE. 1 .AND. dfun .NE. 4 .AND. dfun .NE. 5)then
          call rexit("dfun not implmented in loss2")
      endif
      call compute_u(dfun, n, y, f, u)
C     s is not used in compute_z for dfun:1,4-7
      call compute_z(dfun, n, u, z, s)
      call compute_g(cfun, n, z, s, delta, gval)
      los = 0.d0
      do 20 i=1, n
      los = los + weights(i)*gval(i)
20    continue
C      los=los/n

      return
      end

back to top