estimated_standard_deviation:rout02
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| estimated_standard_deviation:rout02 [2026/03/10 05:28] – created hkimscil | estimated_standard_deviation:rout02 [2026/03/17 22:51] (current) – hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| <WRAP group> | <WRAP group> | ||
| - | < | + | <WRAP column |
| + | < | ||
| + | > rm(list=ls()) | ||
| + | > | ||
| + | > rnorm2 <- function(n, | ||
| + | + | ||
| + | + } | ||
| + | > | ||
| + | > # set.seed(191) | ||
| + | > nx <- 1000 | ||
| + | > mx <- 50 | ||
| + | > sdx <- mx * 0.1 | ||
| + | > sdx # 5 | ||
| + | [1] 5 | ||
| + | > x <- rnorm2(nx, mx, sdx) | ||
| + | > # x <- rnorm2(1000, | ||
| + | > | ||
| + | > mean(x) | ||
| + | [1] 50 | ||
| + | > sd(x) | ||
| + | [1] 5 | ||
| + | > length(x) | ||
| + | [1] 1000 | ||
| + | > hist(x) | ||
| + | > | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP column 35%> | ||
| + | </ | ||
| + | <WRAP group> | ||
| + | <WRAP column 55%> | ||
| < | < | ||
| > # the above no gradient | > # the above no gradient | ||
| Line 42: | Line 72: | ||
| </ | </ | ||
| - | < | + | <WRAP column |
| comment | comment | ||
| 이 R script의 목적은 v값이 최소값이 되는 지점을 자동적으로 찾아보려는 것이다. 이것을 위해서 우선 v값으로 사용할 첫 점수를 랜덤하게 구한 후 (아래 그래프에서 빨간색 지점), 자동적으로 그 다음 v 점수를 찾고 (녹색지점), | 이 R script의 목적은 v값이 최소값이 되는 지점을 자동적으로 찾아보려는 것이다. 이것을 위해서 우선 v값으로 사용할 첫 점수를 랜덤하게 구한 후 (아래 그래프에서 빨간색 지점), 자동적으로 그 다음 v 점수를 찾고 (녹색지점), | ||
| Line 55: | Line 85: | ||
| <WRAP group> | <WRAP group> | ||
| - | < | + | <WRAP column |
| < | < | ||
| > zx <- (x-mean(x))/ | > zx <- (x-mean(x))/ | ||
| Line 77: | Line 107: | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | <WRAP column |
| comment | comment | ||
| * 랜덤하게 v값을 찾음 '' | * 랜덤하게 v값을 찾음 '' | ||
| Line 91: | Line 121: | ||
| <WRAP group> | <WRAP group> | ||
| - | < | + | <WRAP column |
| < | < | ||
| > # Train the model with scaled features | > # Train the model with scaled features | ||
| Line 98: | Line 128: | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | <WRAP column |
| comment | comment | ||
| * 이 0.1은 gradient function으로 구한 해당 v값에 대한 y 미분값을 (기울기 값을) 구한 후, 여기에 곱하기 위해서 지정한다. | * 이 0.1은 gradient function으로 구한 해당 v값에 대한 y 미분값을 (기울기 값을) 구한 후, 여기에 곱하기 위해서 지정한다. | ||
| Line 107: | Line 137: | ||
| <WRAP group> | <WRAP group> | ||
| - | < | + | <WRAP column |
| < | < | ||
| > msrs <- c() | > msrs <- c() | ||
| Line 114: | Line 144: | ||
| > nlen <- 75 | > nlen <- 75 | ||
| > for (epoch in 1:nlen) { | > for (epoch in 1:nlen) { | ||
| - | + | + | + # residual <- residuals(zx, |
| + msr.x <- msr(zx, v) | + msr.x <- msr(zx, v) | ||
| + msrs <- append(msrs, | + msrs <- append(msrs, | ||
| Line 134: | Line 164: | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | <WRAP column |
| comment | comment | ||
| * nlen는 그냥 자의적으로 지정한다. 여기서는 75로 했다. | * nlen는 그냥 자의적으로 지정한다. 여기서는 75로 했다. | ||
| Line 156: | Line 186: | ||
| <WRAP group> | <WRAP group> | ||
| - | < | + | <WRAP column |
| < | < | ||
| > # scaled | > # scaled | ||
| Line 195: | Line 225: | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | <WRAP column |
| comment | comment | ||
| {{: | {{: | ||
estimated_standard_deviation/rout02.1773120538.txt.gz · Last modified: by hkimscil
