Skip to content

Commit e174077

Browse files
docstring fixes
1 parent f1d1188 commit e174077

File tree

2 files changed

+5
-42
lines changed

2 files changed

+5
-42
lines changed

docs/src/api/training.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Linear Models
44

5+
```@docs
6+
StandardRidge
7+
```
8+
59
## Gaussian Regression
610

711
Currently, v0.10, is unavailable.

src/train/linear_regression.jl

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,6 @@ The equations for ridge regression are as follows:
1515
there's usually no need to tweak this
1616
- `reg`: regularization coefficient. Default is set to 0.0 (linear regression).
1717
18-
# Examples
19-
```jldoctest
20-
julia> ridge_reg = StandardRidge()
21-
StandardRidge(0.0)
22-
23-
julia> ol = train(ridge_reg, rand(Float32, 10, 10), rand(Float32, 10, 10))
24-
OutputLayer successfully trained with output size: 10
25-
26-
julia> ol.output_matrix #visualize output matrix
27-
10×10 Matrix{Float32}:
28-
0.456574 -0.0407612 0.121963 … 0.859327 -0.127494 0.0572494
29-
0.133216 -0.0337922 0.0185378 0.24077 0.0297829 0.31512
30-
0.379672 -1.24541 -0.444314 1.02269 -0.0446086 0.482282
31-
1.18455 -0.517971 -0.133498 0.84473 0.31575 0.205857
32-
-0.119345 0.563294 0.747992 0.0102919 1.509 -0.328005
33-
-0.0716812 0.0976365 0.628654 … -0.516041 2.4309 -0.113402
34-
0.0153872 -0.52334 0.0526867 0.729326 2.98958 1.32703
35-
0.154027 0.6013 1.05548 -0.0840203 0.991182 -0.328555
36-
1.11007 -0.0371736 -0.0529418 0.186796 -1.21815 0.204838
37-
0.282996 -0.263799 0.132079 0.875417 0.497951 0.273423
38-
39-
julia> ridge_reg = StandardRidge(0.001) #passing a value
40-
StandardRidge(0.001)
41-
42-
julia> ol = train(ridge_reg, rand(Float16, 10, 10), rand(Float16, 10, 10))
43-
OutputLayer successfully trained with output size: 10
44-
45-
julia> ol.output_matrix
46-
10×10 Matrix{Float16}:
47-
-1.251 3.074 -1.566 -0.10297 … 0.3823 1.341 -1.77 -0.445
48-
0.11017 -2.027 0.8975 0.872 -0.643 0.02615 1.083 0.615
49-
0.2634 3.514 -1.168 -1.532 1.486 0.1255 -1.795 -0.06555
50-
0.964 0.9463 -0.006855 -0.519 0.0743 -0.181 -0.433 0.06793
51-
-0.389 1.887 -0.702 -0.8906 0.221 1.303 -1.318 0.2634
52-
-0.1337 -0.4453 -0.06866 0.557 … -0.322 0.247 0.2554 0.5933
53-
-0.6724 0.906 -0.547 0.697 -0.2664 0.809 -0.6836 0.2358
54-
0.8843 -3.664 1.615 1.417 -0.6094 -0.59 1.975 0.4785
55-
1.266 -0.933 0.0664 -0.4497 -0.0759 -0.03897 1.117 0.3152
56-
0.6353 1.327 -0.6978 -1.053 0.8037 0.6577 -0.7246 0.07336
57-
5818
```
5919
"""
6020
struct StandardRidge
@@ -84,8 +44,7 @@ function train(sr::StandardRidge, states::AbstractArray, target_data::AbstractAr
8444
))
8545
end
8646

87-
T = eltype(states)
88-
output_layer = Matrix(((states * states' + T(sr.reg) * I) \
47+
output_layer = Matrix(((states * states' + sr.reg * I) \
8948
(states * target_data'))')
9049
return OutputLayer(sr, output_layer, size(target_data, 1), target_data[:, end])
9150
end

0 commit comments

Comments
 (0)