User Tools

Site Tools


estimated_standard_deviation:rscript02

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
estimated_standard_deviation:rscript02 [2026/03/17 22:47] hkimscilestimated_standard_deviation:rscript02 [2026/03/17 22:58] (current) hkimscil
Line 1: Line 1:
 <code> <code>
-# the above no gradient+rm(list=ls())
  
 +rnorm2 <- function(n,mean,sd){ 
 +  mean+sd*scale(rnorm(n)) 
 +}
 +
 +# set.seed(191)
 +nx <- 1000
 +mx <- 50
 +sdx <- mx * 0.1
 +sdx  # 5
 +x <- rnorm2(nx, mx, sdx)
 +# x <- rnorm2(1000, 50, 5) 와 동일
 +
 +mean(x)
 +sd(x)
 +length(x)
 +hist(x)
 +
 +# the above no gradient
 gradient <- function(x, v){ gradient <- function(x, v){
     residuals = x - v     residuals = x - v
Line 25: Line 43:
 msrs <- c() msrs <- c()
 vs <- c() vs <- c()
 +grads <- c()
  
 msr <- function(x, v) { msr <- function(x, v) {
Line 38: Line 57:
          
     grad <- gradient(zx, v)     grad <- gradient(zx, v)
 +    grads <- grad
     step.v <- grad * learning.rate #      step.v <- grad * learning.rate # 
     v <- v - step.v # 그 다음 v값     v <- v - step.v # 그 다음 v값
Line 45: Line 65:
 tail(msrs) tail(msrs)
 tail(vs) tail(vs)
 +tail(grads)
  
 plot(vs, msrs, type='b') plot(vs, msrs, type='b')
 +plot(vs, grads, type='b')
  
 # scaled # scaled
estimated_standard_deviation/rscript02.1773787643.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki