Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Owl
- module R = Regression.D
- (* input dim: lines indexed by samples, columns by dimension of input (here 1)*)
- let input =
- Arr.uniform ~a:0.0 ~b:10.0 [| 30; 1 |]
- let b = 2.0
- let c = 4.0
- (* the output as obtained from the true model *)
- let output =
- Arr.map (fun x -> c *. x +. b) input
- let _ =
- Arr.print input
- let _ =
- Arr.print output
- let w, bias =
- let res = R.ols ~i:true input output in
- res.(0), res.(1)
- let _ =
- Printf.printf "result: \n";
- Arr.print w;
- Arr.print bias
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement