Skip to content

Commit

Permalink
Merge pull request #461 from jklontz/master
Browse files Browse the repository at this point in the history
Remove some deprecated function calls and add cmake project files.
  • Loading branch information
Soeren Sonnenburg committed Apr 17, 2012
2 parents 1be6198 + b8bec85 commit ce82cc1
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
@@ -0,0 +1,11 @@
# Instructions:
# $ ./configure --disable-svm-light
# $ mkdir build
# $ cd build
# $ cmake ..
# $ make

project(shogun)
cmake_minimum_required(VERSION 2.8)

add_subdirectory(shogun)
55 changes: 55 additions & 0 deletions src/shogun/CMakeLists.txt
@@ -0,0 +1,55 @@
include_directories(. ..)

aux_source_directory(base BASE)
aux_source_directory(classifier CLASSIFIER)
aux_source_directory(classifier/mkl CLASSIFIER_MKL)
aux_source_directory(classifier/svm CLASSIFIER_SVM)
aux_source_directory(classifier/vw CLASSIFIER_WV)
aux_source_directory(classifier/vw/cache CLASSIFIER_WV_CACHE)
aux_source_directory(classifier/vw/learners CLASSIFIER_WV_LEARNERS)
aux_source_directory(clustering CLUSTERING)
aux_source_directory(converter CONVERTER)
aux_source_directory(distance DISTANCE)
aux_source_directory(distributions DISTRIBUTIONS)
aux_source_directory(evaluation EVALUATION)
aux_source_directory(features FEATURES)
aux_source_directory(io IO)
aux_source_directory(kernel KERNEL)
aux_source_directory(lib LIB)
aux_source_directory(loss LOSS)
aux_source_directory(machine MACHINE)
aux_source_directory(mathematics MATHEMATICS)
aux_source_directory(modelselection MODELSELECTION)
aux_source_directory(preprocessor PREPROCESSOR)
aux_source_directory(regression REGRESSION)
aux_source_directory(regression/svr REGRESSION_SVR)
aux_source_directory(structure STRUCTURE)
aux_source_directory(ui UI)

add_library(shogun SHARED
${BASE}
${CLASSIFIER}
${CLASSIFIER_MKL}
${CLASSIFIER_SVM}
${CLASSIFIER_WV}
${CLASSIFIER_WV_CACHE}
${CLASSIFIER_WV_LEARNERS}
${CLUSTERING}
${CONVERTER}
${DISTANCE}
${DISTRIBUTIONS}
${EVALUATION}
${FEATURES}
${IO}
${KERNEL}
${LIB}
${LOSS}
${MACHINE}
${MATHEMATICS}
${MODELSELECTION}
${PREPROCESSOR}
${REGRESSION}
${REGRESSION_SVR}
${STRUCTURE}
${UI})

2 changes: 1 addition & 1 deletion src/shogun/classifier/vw/VwRegressor.cpp
Expand Up @@ -65,7 +65,7 @@ void CVwRegressor::init(CVwEnvironment* env_to_use)
if (env->random_weights)
{
for (vw_size_t j = 0; j < length/num_threads; j++)
weight_vectors[i][j] = drand48() - 0.5;
weight_vectors[i][j] = CMath::random(-0.5, 0.5);
}

if (env->initial_weight != 0.)
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/lib/v_array.h
Expand Up @@ -190,7 +190,7 @@ inline void v_array<T>::reserve(size_t length)
size_t old_length = end_array-begin;
begin = SG_REALLOC(T, begin, length);
if (old_length < length)
bzero(begin + old_length, (length - old_length)*sizeof(T));
memset(begin + old_length, 0, (length - old_length)*sizeof(T));

end = begin;
end_array = begin + length;
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/mathematics/Math.cpp
Expand Up @@ -263,7 +263,7 @@ float64_t CMath::fishers_exact_test_for_2x3_table(SGMatrix<float64_t> table)
for (int32_t i=0; i<3*2; i++)
{
log_denom+=CMath::lgammal((floatmax_t) table.matrix[i]+1);
log_denomf+=gamma(table.matrix[i]+1);
log_denomf+=CMath::lgammal((floatmax_t) table.matrix[i]+1);
}

floatmax_t prob_table_log=log_nom - log_denom;
Expand Down

0 comments on commit ce82cc1

Please sign in to comment.