Skip to content

Instantly share code, notes, and snippets.

@dpo
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save dpo/388b3d8aa2a030c055f3 to your computer and use it in GitHub Desktop.

Select an option

Save dpo/388b3d8aa2a030c055f3 to your computer and use it in GitHub Desktop.
require 'formula'
class Jblas < Formula
homepage 'http://mikiobraun.github.io/jblas'
url 'http://mikiobraun.github.io/jblas/jars/jblas-1.2.3.jar'
sha1 '3c0d35c4e6b8d7ea7bbcbf109fd1863e54f9d061'
def install
(share / "java").install "jblas-#{version}.jar" => "jblas.jar"
end
end
require "formula"
class Shogun < Formula
homepage "http://www.shogun-toolbox.org"
url "http://shogun-toolbox.org/archives/shogun/releases/3.2/sources/shogun-3.2.0.tar.bz2"
sha1 "442e212a19d0297b4df45a4dfe7deb6312441e54"
head "https://github.com/shogun-toolbox/shogun.git", :branch => "develop"
#option "without-check", "Skip build-time tests (not recommended)"
option "with-check", "Perform build-time tests (there are failures!)"
option "without-svm-light", "Disable SVM-light module, which is GPLv3 and makes all of shogun GPLv3"
option "with-java", "Enable Java modular interface (requires JDK)"
depends_on "pkg-config" => :build
depends_on "arpack"
depends_on "json-c"
depends_on "readline" => :recommended
depends_on "lzo" => :recommended
depends_on "xz" => :recommended # provides lzma
# To enable system Ruby, you must have permission to install gems. See
# https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Gems%2C-Eggs-and-Perl-Modules.md#with-systems-ruby
# Other versions of Ruby might work but they must be compiled with clang.
option "with-ruby", "Enable Ruby modular interface (requires narray gem)"
depends_on :java if build.with? "java"
depends_on "jblas" if build.with? "java"
depends_on "eigen" => :recommended
depends_on "glpk" => :recommended
depends_on "hdf5" => :recommended
depends_on "lua" => :recommended
depends_on "nlopt" => :recommended
depends_on "snappy" => :recommended
depends_on :python => ["numpy", "matplotlib", :recommended]
depends_on "swig" if build.with? :python
depends_on "colpack" => :optional # Broken.
depends_on "octave" => :optional # Broken.
depends_on "r" => :optional # Broken.
def onoff(s, cond)
s + ((cond) ? "ON" : "OFF")
end
stable do
# See http://comments.gmane.org/gmane.comp.ai.machine-learning.shogun/4471
patch :DATA
end
def install
if build.with? "r"
onoe "Compilation of the Shogun/R interface fails!"
onoe "See https://github.com/shogun-toolbox/shogun/issues/2395"
exit 1
end
if build.with? "octave"
onoe "Compilation of the Shogun/Octave interface fails!"
onoe "See https://github.com/shogun-toolbox/shogun/issues/2396"
exit 1
end
# Fail if ColPack is installed.
colpack_opts = Tab.for_formula(Formula["colpack"])
if colpack_opts.time != nil
onoe "Shogun will pick up your ColPack install and compilation will fail!"
onoe "Please `brew uninstall colpack` before proceeding."
onoe "See https://github.com/shogun-toolbox/shogun/issues/1804"
exit 1
end
ENV.cxx11
cmake_args = std_cmake_args
cmake_args += ["-DBUNDLE_COLPACK=OFF"] # Will fail if ColPack is installed!
if build.with? "colpack"
cmake_args += ["-DColpack_Include_Dir=#{Formula['colpack'].opt_include}",
"-DColpack_Library_Dir=#{Formula['colpack'].opt_lib}",
"-DColpack_Libraries=#{Formula['colpack'].opt_lib}/libColPack.dylib"]
end
cmake_args += ["-DArpack_Include_Dir=#{Formula['arpack'].opt_include}",
"-DArpack_Lib=#{Formula['arpack'].opt_lib}/libarpack.dylib",
"-DArpack_Path=#{Formula['arpack'].opt_prefix}"]
cmake_args << "-DBUNDLE_JSON=OFF"
if build.with? "eigen"
cmake_args += ["-DBUNDLE_EIGEN=OFF",
"-DEigen_Include_Dir=#{Formula['eigen'].opt_include}"]
end
if build.with? "nlopt"
cmake_args += ["-DBUNDLE_NLOPT=OFF",
"-DNLOPT_Include_Dir=#{Formula['nlopt'].opt_include}",
"-DNLOPT_Library=#{Formula['nlopt'].opt_lib}/libnlopt_cxx.dylib"]
end
if build.with? "glpk"
cmake_args += ["-DGLPK_Include_Dir=#{Formula['glpk'].opt_include}",
"-DGLPK_Library=#{Formula['glpk'].opt_lib}/libglpk.dylib"]
end
if build.with? "snappy"
cmake_args += ["-DSnappy_Include_Dir=#{Formula['snappy'].opt_include}",
"-DSnappy_Libraries=#{Formula['snappy'].opt_lib}/libsnappy.dylib"]
end
cmake_args << onoff("-DJavaModular=", (build.with? "java"))
cmake_args << onoff("-DPythonModular=", (build.with? :python))
cmake_args << onoff("-DOctaveModular=", (build.with? "octave"))
cmake_args << onoff("-DRModular=", (build.with? "r"))
cmake_args << onoff("-DRubyModular=", (build.with? "ruby"))
cmake_args << onoff("-DLuaModular=", (build.with? "lua"))
cmake_args << onoff("-DUSE_SVMLIGHT=", (build.with? "svm-light"))
cmake_args << onoff("-DENABLE_TESTING=", (build.with? "check"))
cmake_args << "-DPYTHON_LIBRARY=#{%x(python-config --prefix).chomp}/lib/libpython2.7.dylib" if build.with? :python
mkdir "build" do
system "cmake", "..", *cmake_args
system "make"
system "make", "install"
system "ctest", "-R", "unit" if build.with? "check"
end
end
end
__END__
diff --git a/src/shogun/evaluation/ContingencyTableEvaluation.cpp b/src/shogun/evaluation/ContingencyTableEvaluation.cpp
index 6a40d8f..e478112 100644
--- a/src/shogun/evaluation/ContingencyTableEvaluation.cpp
+++ b/src/shogun/evaluation/ContingencyTableEvaluation.cpp
@@ -52,7 +52,7 @@ float64_t CContingencyTableEvaluation::evaluate(CLabels* predicted, CLabels* gro
return 42;
}
-inline EEvaluationDirection CContingencyTableEvaluation::get_evaluation_direction() const
+EEvaluationDirection CContingencyTableEvaluation::get_evaluation_direction() const
{
switch (m_type)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment