Skip to content

Instantly share code, notes, and snippets.

@rleonid
Created August 6, 2015 20:51
Show Gist options
  • Save rleonid/677c57cd52d1c515350c to your computer and use it in GitHub Desktop.
Save rleonid/677c57cd52d1c515350c to your computer and use it in GitHub Desktop.
# let pred = Array.init 100 (fun r -> Array.init 3 (fun _ -> n1 ())) ;;
val pred : float array array =
[|[|2.8291; 2.0174; 2.3971|];
[|1.5963; 2.0713; 2.3183|];
[|1.5755; 0.5216; 2.8682|];
[|1.9523; 0.4255; 3.6062|];
[|2.5397; 3.8247; 3.4417|]; ...|]
# let resp = Array.map (fun arr -> 2. +. 3. *. arr.(0) +. 4. *. arr.(1) +. 5. *. arr.(2)) pred ;;
val resp : float array =
[|30.5424; 26.6658; 23.1534; 27.5899; 33.7047; 21.5728; 16.6898; 20.5841; 17.1497; ...|]
# let regarg = { Regression.add_constant_column = true; Regression.lambda_spec = None} ;;
val regarg : Oml.Regression.multivariate_spec = {Oml.Regression.add_constant_column = true; lambda_spec = None}
# let t = Regression.Multivariate.regress (Some regarg) pred resp ;;
val t : Oml.Regression.Multivariate.t = <abstr>
# Regression.Multivariate.coefficients t ;;
- : float array = [|2.0000; 3.0000; 4.0000; 5.0000|]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment