gradient_descent
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gradient_descent [2026/03/14 09:23] – [Gradient Descent] hkimscil | gradient_descent [2026/03/14 11:21] (current) – [output] hkimscil | ||
|---|---|---|---|
| Line 92: | Line 92: | ||
| summary(mo) | summary(mo) | ||
| - | plot(seq(1, length(ssrs)), ssrs) | + | k <- min(ssrs) |
| - | plot(seq(1, length(ssrs)), srs) | + | j <- as[min.pos.ssrs] |
| + | plot(seq(1, length(as)), ssrs, type=" | ||
| + | text(4500,2000000, | ||
| tail(ssrs) | tail(ssrs) | ||
| max(ssrs) | max(ssrs) | ||
| Line 226: | Line 229: | ||
| > | > | ||
| - | > plot(seq(1, length(ssrs)), ssrs) | + | > k <- min(ssrs) |
| - | > plot(seq(1, length(ssrs)), srs) | + | > j <- as[min.pos.ssrs] |
| + | > plot(seq(1, length(as)), ssrs, type=" | ||
| + | > text(4500,2000000, | ||
| + | > | ||
| > tail(ssrs) | > tail(ssrs) | ||
| [1] 2267151 2267355 2267559 2267763 2267967 2268171 | [1] 2267151 2267355 2267559 2267763 2267967 2268171 | ||
| Line 243: | Line 249: | ||
| </ | </ | ||
| </ | </ | ||
| - | {{pasted: | + | {{pasted: |
| - | {{pasted: | + | |
| - | {{pasted: | + | |
| 위 방법은 dumb . . . . . | 위 방법은 dumb . . . . . | ||
| Line 309: | Line 313: | ||
| > # we use sum of square of error which oftentimes become big | > # we use sum of square of error which oftentimes become big | ||
| > msrloss <- function(predictions, | > msrloss <- function(predictions, | ||
| - | + | + | + |
| - | + | + | + |
| + } | + } | ||
| > | > | ||
| Line 318: | Line 322: | ||
| > | > | ||
| > for (i in seq(from = -50, to = 50, by = 0.01)) { | > for (i in seq(from = -50, to = 50, by = 0.01)) { | ||
| - | + | + | + |
| - | + | + | + |
| - | + | + | + |
| - | + | + | + |
| - | + | + | + |
| - | + | + | + |
| + } | + } | ||
| > length(msrs) | > length(msrs) | ||
| Line 333: | Line 337: | ||
| > | > | ||
| > min(msrs) | > min(msrs) | ||
| - | [1] 7766.679 | + | [1] 8735.055 |
| > min.pos.msrs <- which(msrs == min(msrs)) | > min.pos.msrs <- which(msrs == min(msrs)) | ||
| > min.pos.msrs | > min.pos.msrs | ||
| - | [1] 5828 | + | [1] 4896 |
| > print(as[min.pos.msrs]) | > print(as[min.pos.msrs]) | ||
| - | [1] 8.27 | + | [1] -1.05 |
| > summary(mo) | > summary(mo) | ||
| Line 346: | Line 350: | ||
| Residuals: | Residuals: | ||
| | | ||
| - | -259.314 -59.215 6.683 | + | -245.291 -67.967 -3.722 |
| Coefficients: | Coefficients: | ||
| Estimate Std. Error t value Pr(> | Estimate Std. Error t value Pr(> | ||
| - | (Intercept) | + | (Intercept) |
| - | x 11.888 2.433 4.887 2.11e-06 *** | + | x 12.900 2.870 4.495 1.19e-05 *** |
| --- | --- | ||
| Signif. codes: | Signif. codes: | ||
| - | Residual standard error: | + | Residual standard error: |
| - | Multiple R-squared: | + | Multiple R-squared: |
| - | F-statistic: | + | F-statistic: |
| > plot(seq(1, length(msrs)), | > plot(seq(1, length(msrs)), | ||
| > plot(seq(1, length(srs)), | > plot(seq(1, length(srs)), | ||
| > tail(msrs) | > tail(msrs) | ||
| - | [1] 9504.208 9505.041 9505.875 9506.710 9507.544 9508.379 | + | [1] 11335.75 11336.77 11337.79 11338.81 11339.84 11340.86 |
| > max(msrs) | > max(msrs) | ||
| - | [1] 11161.64 | + | [1] 11340.86 |
| > min(msrs) | > min(msrs) | ||
| - | [1] 7766.679 | + | [1] 8735.055 |
| > tail(srs) | > tail(srs) | ||
| - | [1] -41.68368 -41.69368 -41.70368 -41.71368 -41.72368 -41.73368 | + | [1] -50.99705 -51.00705 -51.01705 -51.02705 -51.03705 -51.04705 |
| > max(srs) | > max(srs) | ||
| - | [1] 58.26632 | + | [1] 48.95295 |
| > min(srs) | > min(srs) | ||
| - | [1] -41.73368 | + | [1] -51.04705 |
| - | > | + | > |
| </ | </ | ||
| - | {{: | + | {{pasted:20260314-112129.png}} |
| - | {{:pasted:20250821-121024.png}} | + | |
| ===== b값 구하기 ===== | ===== b값 구하기 ===== | ||
gradient_descent.1773480232.txt.gz · Last modified: by hkimscil
