From cc6c800e0176b523969bc74546373cc0ac14f514 Mon Sep 17 00:00:00 2001 From: "J.Stark" Date: Fri, 28 Jun 2024 20:00:21 +0200 Subject: [PATCH] coding... --- examples/custom_algodiff_op.ml | 18 +++++++++--------- examples/feedforward.ml | 1 - examples/gradient_descent.ml | 1 - examples/inception_v3.ml | 1 - examples/kmeans.ml | 2 -- examples/lazy_cifar10.ml | 1 - examples/lazy_eval.ml | 1 - examples/lazy_lstm.ml | 1 - examples/lazy_mnist.ml | 1 - examples/linear_algebra.ml | 1 - examples/lstm.ml | 1 - examples/mnist_cnn.ml | 1 - examples/mnist_lenet.ml | 1 - examples/newton_method.ml | 1 - examples/regression.ml | 1 - examples/squeezenet.ml | 1 - examples/svm.ml | 1 - examples/test_lda.ml | 1 - examples/test_log.ml | 1 - examples/tfidf.ml | 1 - examples/vgg16.ml | 1 - src/owl/misc/owl_dataset.ml | 2 +- 22 files changed, 10 insertions(+), 31 deletions(-) diff --git a/examples/custom_algodiff_op.ml b/examples/custom_algodiff_op.ml index 204e80e61..0f49730be 100755 --- a/examples/custom_algodiff_op.ml +++ b/examples/custom_algodiff_op.ml @@ -31,13 +31,13 @@ let custom_cos = : Siso) let _ = - let input = Mat.uniform 1 2 in + let input = _f 1. in (* Mat.uniform 1 2 in *) (* [f] must be [f : vector -> scalar]. *) - let g' = grad custom_cos in - let h' = grad g' in - let g = grad Maths.cos in - let h = grad g in - Mat.print (g' input); - Mat.print (g input); - Mat.print (h' input); - Mat.print (h input); + let g' = diff custom_cos in + let h' = diff g' in + let g = diff Maths.cos in + let h = diff g in + print_float (g' input |> unpack_flt); print_endline "\n"; + print_float (g input |> unpack_flt); print_endline "\n"; + print_float (h' input |> unpack_flt); print_endline "\n"; + print_float (h input |> unpack_flt); print_endline "\n" diff --git a/examples/feedforward.ml b/examples/feedforward.ml index bd90d7260..604f82a90 100755 --- a/examples/feedforward.ml +++ b/examples/feedforward.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* * OWL - OCaml Scientific Computing * Copyright (c) 2016-2022 Liang Wang diff --git a/examples/gradient_descent.ml b/examples/gradient_descent.ml index 155a81e8e..96b525a36 100755 --- a/examples/gradient_descent.ml +++ b/examples/gradient_descent.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates how to write a gradient descent algorithm. *) open Owl diff --git a/examples/inception_v3.ml b/examples/inception_v3.ml index 4fc66b45e..985f0090a 100755 --- a/examples/inception_v3.ml +++ b/examples/inception_v3.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates how to use Owl to implement Google's Inception V3 (https://arxiv.org/abs/1512.00567). Note that only the network structure of Inception is defined. diff --git a/examples/kmeans.ml b/examples/kmeans.ml index 60fa6b9c8..c34d623e6 100755 --- a/examples/kmeans.ml +++ b/examples/kmeans.ml @@ -1,5 +1,3 @@ -#!/usr/bin/env owl - open Owl module LL = Owl_cluster diff --git a/examples/lazy_cifar10.ml b/examples/lazy_cifar10.ml index 5edde123f..2f6b8bf4a 100755 --- a/examples/lazy_cifar10.ml +++ b/examples/lazy_cifar10.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates using lazy functor to train a model on mnist. *) open Owl diff --git a/examples/lazy_eval.ml b/examples/lazy_eval.ml index ff6f7baed..badc77aaa 100755 --- a/examples/lazy_eval.ml +++ b/examples/lazy_eval.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates the use of lazy evaluation in Owl *) open Owl diff --git a/examples/lazy_lstm.ml b/examples/lazy_lstm.ml index 8dd499045..fc4d3b649 100755 --- a/examples/lazy_lstm.ml +++ b/examples/lazy_lstm.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates using lazy functor to train a LSTM network. *) #zoo "217ef87bc36845c4e78e398d52bc4c5b" diff --git a/examples/lazy_mnist.ml b/examples/lazy_mnist.ml index 774eaa305..281f50fb1 100755 --- a/examples/lazy_mnist.ml +++ b/examples/lazy_mnist.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates using lazy functor to train a model on mnist. *) open Owl diff --git a/examples/linear_algebra.ml b/examples/linear_algebra.ml index bdcac3587..19089fd40 100755 --- a/examples/linear_algebra.ml +++ b/examples/linear_algebra.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example shows how to use linear algebra module in Owl. *) open Owl diff --git a/examples/lstm.ml b/examples/lstm.ml index 8687ce6b7..ab06535b8 100755 --- a/examples/lstm.ml +++ b/examples/lstm.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* Text Generation using LSTM. The book used is Alice’s Adventures in Wonderland by Lewis Carroll. *) diff --git a/examples/mnist_cnn.ml b/examples/mnist_cnn.ml index 6e1b0e33d..207ef2096 100755 --- a/examples/mnist_cnn.ml +++ b/examples/mnist_cnn.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example trains a simple convolutional network on the MNIST dataset. *) open Owl diff --git a/examples/mnist_lenet.ml b/examples/mnist_lenet.ml index e3e4abbe6..f9c8edc69 100755 --- a/examples/mnist_lenet.ml +++ b/examples/mnist_lenet.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example implements LeNet-5 architecture on the MNIST dataset. *) open Owl diff --git a/examples/newton_method.ml b/examples/newton_method.ml index 75ffc92a6..d7484f448 100755 --- a/examples/newton_method.ml +++ b/examples/newton_method.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates how to implement Newton method with Algdoff. *) open Owl diff --git a/examples/regression.ml b/examples/regression.ml index 7cac0ffe9..560e7c424 100755 --- a/examples/regression.ml +++ b/examples/regression.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl #require "owl-plplot" (* Test Regression module *) diff --git a/examples/squeezenet.ml b/examples/squeezenet.ml index 6d92b745b..8e00a0ca1 100755 --- a/examples/squeezenet.ml +++ b/examples/squeezenet.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates how to use Owl to implement SqueezeNet (https://arxiv.org/abs/1602.07360). Note that only the network structure of SqueezeNet is defined. diff --git a/examples/svm.ml b/examples/svm.ml index 9b97a7e5b..74140bc01 100755 --- a/examples/svm.ml +++ b/examples/svm.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl #require "owl-plplot" (* This example demonstrates SVM regression. *) diff --git a/examples/test_lda.ml b/examples/test_lda.ml index e9dff0981..14bce8bf0 100755 --- a/examples/test_lda.ml +++ b/examples/test_lda.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* Test Topic Module *) (* diff --git a/examples/test_log.ml b/examples/test_log.ml index 9f6a3eb6c..b068f0aec 100755 --- a/examples/test_log.ml +++ b/examples/test_log.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* stochastic gradient decent algorithm *) module MX = Owl.Dense.Matrix.D diff --git a/examples/tfidf.ml b/examples/tfidf.ml index 20a5ece35..68c917f5b 100755 --- a/examples/tfidf.ml +++ b/examples/tfidf.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* test TF-IDF model *) open Owl diff --git a/examples/vgg16.ml b/examples/vgg16.ml index 56e390668..612f43066 100755 --- a/examples/vgg16.ml +++ b/examples/vgg16.ml @@ -1,4 +1,3 @@ -#!/usr/bin/env owl (* This example demonstrates how to use Owl to implement VGG16 (https://arxiv.org/abs/1409.1556). Note that only the network structure of VGG16 is defined. diff --git a/src/owl/misc/owl_dataset.ml b/src/owl/misc/owl_dataset.ml index b24412e56..8d76e41c2 100644 --- a/src/owl/misc/owl_dataset.ml +++ b/src/owl/misc/owl_dataset.ml @@ -7,7 +7,7 @@ open Owl_types -let remote_data_path () = "https://github.com/ryanrhymes/owl_dataset/raw/master/" +let remote_data_path () = "https://github.com/owlbarn/owl_dataset/raw/master/" let local_data_path () : string = let home = Sys.getenv "HOME" ^ "/.owl" in