Skip to content

Commit

Permalink
Merge d6417c7 into 0b22253
Browse files Browse the repository at this point in the history
  • Loading branch information
rleonid committed Feb 1, 2018
2 parents 0b22253 + d6417c7 commit d10d13a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ os:
- linux
- osx
env:
- OCAML_VERSION=4.03 OPAM_VERSION=1.2.2
- OCAML_VERSION=4.05 OPAM_VERSION=1.2.2
1 change: 1 addition & 0 deletions src-full/cls/omlf_logistic_regression.mlt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

open Test_utils
module P = Oml_probabilities
open Dsfo

let () =
let add_simple_test = Test.add_simple_test_group "Logistic Regression" in
Expand Down
1 change: 1 addition & 0 deletions src-full/cls/omlf_naive_bayes.mlt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*)

open Test_utils
open Dsfo

let () =
let add_simple_test = Test.add_simple_test_group "Naive Bayes" in
Expand Down
3 changes: 2 additions & 1 deletion src/util/oml_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ let zip x y =

let unzip arr = Array.map fst arr, Array.map snd arr

let permute ?(copy=true) arr =
let permute ?seed ?(copy=true) arr =
random_init seed;
let a = if copy then Array.copy arr else arr in
for n = Array.length a - 1 downto 1 do
let k = Random.int (n + 1) in
Expand Down
10 changes: 8 additions & 2 deletions src/util/oml_array.mli
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,11 @@ val unzip : ('a * 'b) array -> ('a array * 'b array)

(** [permute arr] will permute a copy of [arr].
@param copy can be set to false to perform the permutation in place. *)
val permute : ?copy:bool -> 'a array -> 'a array
@param copy can be set to false to perform the permutation in place and
and returning arr.
@param seed can be used to initialize the Random state before performing
the permutation to obtain better or consistent permutations. *)
val permute : ?seed:[`Self | `Init of int | `Full of int array ]
-> ?copy:bool
-> 'a array
-> 'a array
6 changes: 6 additions & 0 deletions src/util/oml_util_base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ let fst3 (x,_,_) = x
let snd3 (_,x,_) = x
let thr3 (_,_,x) = x

let random_init = function
| None -> ()
| Some `Self -> Random.self_init ()
| Some `Init i -> Random.init i
| Some `Full a -> Random.full_init a

8 changes: 3 additions & 5 deletions tools/travis_ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ travis_install_on_linux () {

travis_install_on_osx () {
echo "brew install lapack"
brew install homebrew/dupes/lapack > /dev/null
brew install lapack > /dev/null
echo "brew install gcc"
brew install gcc > /dev/null # for gfortran
echo "brew install libffi"
Expand Down Expand Up @@ -38,18 +38,16 @@ opam pin add dsfo git://github.com/rleonid/dsfo
echo ----------Testing lite----------
make test_lite

echo ----------Install bisect ppx and ocveralls for coverage reporting----------
echo ----------Installing C and Fortran deps----------
opam install ocephes lacaml lbfgs
opam install bisect_ppx ocveralls ocephes lacaml.9.2.2 lbfgs

echo ----------Compiling full----------
make build

echo ----------Examples ----
make examples

echo ----------Install bisect ppx and ocveralls for coverage reporting----------
opam install bisect_ppx ocveralls

echo ----------Testing full----------
make covered_test
cd _covered_test_build
Expand Down

0 comments on commit d10d13a

Please sign in to comment.