Skip to content

Commit

Permalink
fixing...
Browse files Browse the repository at this point in the history
  • Loading branch information
jzstark committed Jun 27, 2024
1 parent 600c21a commit 26f2e06
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions examples/backprop.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env owl
(* This example demonstrates how to write the backpropogation algorithm from
scratch using Algodiff module. With the backprop algorithm, we further make
a naive neural network without using Owl' DNN to train on mnist dataset.
Execute 'Dataset.download_all ()' to accquire all necessary dataset before running this example.'
*)


open Owl

open Algodiff.S
Expand Down Expand Up @@ -49,7 +51,7 @@ let backprop nn eta x y =
loss |> unpack_flt

let test nn x y =
Dense.Matrix.S.iter2_rows (fun u v ->
Dense.Matrix.S.iter2_rows (fun u _ ->
Dataset.print_mnist_image u;
let p = run_network (Arr u) nn |> unpack_arr in
Dense.Matrix.Generic.print p;
Expand Down
1 change: 0 additions & 1 deletion examples/checkpoint.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env owl
(* This example shows how to use checkpoint in a stateful optimisation. *)

open Owl
Expand Down
1 change: 0 additions & 1 deletion examples/cifar10_vgg.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env owl
(* This example demonstrates how to build a VGG-like convolutional neural
* network for CIFAR10 dataset.
*)
Expand Down
6 changes: 5 additions & 1 deletion examples/computation_graph_01.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env owl
(*
* Please install the graphvis tool before executing this example.
E.g. on Ubuntu system: `sudo apt install graphviz`
*)


open Owl
module G = Owl_computation_cpu_engine.Make (Owl_algodiff_primal_ops.D)
Expand Down
6 changes: 5 additions & 1 deletion examples/computation_graph_02.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env owl
(*
* Please install the graphvis tool before executing this example.
E.g. on Ubuntu system: `sudo apt install graphviz`
*)


open Owl
module G = Owl_computation_cpu_engine.Make (Owl_algodiff_primal_ops.D)
Expand Down
3 changes: 3 additions & 0 deletions examples/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name backprop)
(libraries owl))
5 changes: 3 additions & 2 deletions examples/regression.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ let test_poly () =
let z = Array.init (n + 1) (fun i -> Mat.(pow_scalar x (float_of_int i)))
|> Mat.concatenate ~axis:1
in
let y' = Mat.(z *@ p) in
Mat.(z *@ p)
(* let y' = Mat.(z *@ p) in
let open Owl_plplot in
let h = Plot.create "plot_regression.png" in
Plot.(scatter ~h ~spec:[ RGB (100,100,50) ] x y);
Plot.(scatter ~h ~spec:[ Marker "+" ] x y');
Plot.output h
Plot.output h *)


let _ =
Expand Down

0 comments on commit 26f2e06

Please sign in to comment.