├── CMakeLists.txt ├── README.md ├── src ├── Algorithms │ ├── ConstantAlgorithm.cpp │ ├── ConstantAlgorithm.h │ ├── ConstantAlgorithmLSHTC.cpp │ ├── ConstantAlgorithmLSHTC.h │ ├── OneClassStumpAlgorithm.h │ ├── RegressionStumpAlgorithm.h │ ├── SparseStumpAlgorithm.h │ ├── StumpAlgorithm.h │ └── StumpAlgorithmLSHTC.h ├── Bandits │ ├── Exp3.cpp │ ├── Exp3.h │ ├── Exp3G.cpp │ ├── Exp3G.h │ ├── Exp3G2.cpp │ ├── Exp3G2.h │ ├── Exp3P.cpp │ ├── Exp3P.h │ ├── GenericBanditAlgorithm.cpp │ ├── GenericBanditAlgorithm.h │ ├── Random.cpp │ ├── Random.h │ ├── UCBK.cpp │ ├── UCBK.h │ ├── UCBKRandomized.cpp │ ├── UCBKRandomized.h │ ├── UCBKV.cpp │ └── UCBKV.h ├── BanditsLS │ ├── Exp3GLS.cpp │ ├── Exp3GLS.h │ ├── Exp3LS.cpp │ ├── Exp3LS.h │ ├── GenericBanditAlgorithmLS.cpp │ ├── GenericBanditAlgorithmLS.h │ ├── UCTLS.cpp │ └── UCTLS.h ├── Bzip2 │ ├── Bzip2Wrapper.cpp │ ├── Bzip2Wrapper.h │ ├── blocksort.c │ ├── bzip2.c │ ├── bzip2recover.c │ ├── bzlib.c │ ├── bzlib.h │ ├── bzlib_private.h │ ├── compress.c │ ├── crctable.c │ ├── decompress.c │ ├── dlltest.c │ ├── huffman.c │ ├── mk251.c │ ├── randtable.c │ ├── spewG.c │ └── unzcrash.c ├── Classifiers │ ├── AdaBoostMHClassifier.cpp │ ├── AdaBoostMHClassifier.h │ ├── ExampleResults.cpp │ ├── ExampleResults.h │ ├── SoftCascadeClassifier.cpp │ ├── SoftCascadeClassifier.h │ ├── VJCascadeClassifier.cpp │ └── VJCascadeClassifier.h ├── Defaults.h ├── IO │ ├── ArffParser.cpp │ ├── ArffParser.h │ ├── ArffParserBzip2.cpp │ ├── ArffParserBzip2.h │ ├── EncodeData.cpp │ ├── EncodeData.h │ ├── GenericParser.h │ ├── HaarData.cpp │ ├── HaarData.h │ ├── InputData.cpp │ ├── InputData.h │ ├── NameMap.cpp │ ├── NameMap.h │ ├── OutputInfo.cpp │ ├── OutputInfo.h │ ├── ParasiteData.h │ ├── RawData.cpp │ ├── RawData.h │ ├── SVMLightParser.cpp │ ├── SVMLightParser.h │ ├── Serialization.cpp │ ├── Serialization.h │ ├── SortedData.cpp │ ├── SortedData.h │ ├── TxtParser.cpp │ └── TxtParser.h ├── Others │ ├── Example.h │ └── Rates.h ├── Registrations.h ├── StrongLearners │ ├── AdaBoostMHLearner.cpp │ ├── AdaBoostMHLearner.h │ ├── ArcGVLearner.cpp │ ├── ArcGVLearner.h │ ├── FilterBoostLearner.cpp │ ├── FilterBoostLearner.h │ ├── GenericStrongLearner.h │ ├── SoftCascadeLearner.cpp │ ├── SoftCascadeLearner.h │ ├── VJCascadeLearner.cpp │ └── VJCascadeLearner.h ├── Utils │ ├── Args.cpp │ ├── Args.h │ ├── ClassHierarchy.cpp │ ├── ClassHierarchy.h │ ├── MathematicalTools.h │ ├── StreamTokenizer.h │ ├── UCTutils.cpp │ ├── UCTutils.h │ ├── Utils.cpp │ └── Utils.h ├── WeakLearners │ ├── AbstainableLearner.cpp │ ├── AbstainableLearner.h │ ├── AdaLineLearner.cpp │ ├── AdaLineLearner.h │ ├── BanditLearner.cpp │ ├── BanditLearner.h │ ├── BanditSingleSparseStump.cpp │ ├── BanditSingleSparseStump.h │ ├── BanditSingleStumpLearner.cpp │ ├── BanditSingleStumpLearner.h │ ├── BaseLearner.cpp │ ├── BaseLearner.h │ ├── ConstantLearner.cpp │ ├── ConstantLearner.h │ ├── FeaturewiseLearner.cpp │ ├── FeaturewiseLearner.h │ ├── Haar │ │ ├── HaarFeatures.cpp │ │ ├── HaarFeatures.h │ │ ├── HaarLearner.cpp │ │ └── HaarLearner.h │ ├── HaarMultiStumpLearner.cpp │ ├── HaarMultiStumpLearner.h │ ├── HaarSingleStumpLearner.cpp │ ├── HaarSingleStumpLearner.h │ ├── IndicatorLearner.cpp │ ├── IndicatorLearner.h │ ├── MultiStumpLearner.cpp │ ├── MultiStumpLearner.h │ ├── MultiThresholdStumpLearner.cpp │ ├── MultiThresholdStumpLearner.h │ ├── NeuronLearner.cpp │ ├── NeuronLearner.h │ ├── OneClassStumpLearner.cpp │ ├── OneClassStumpLearner.h │ ├── ParasiteLearner.cpp │ ├── ParasiteLearner.h │ ├── ProductLearner.cpp │ ├── ProductLearner.h │ ├── ProductLearnerUCT.cpp │ ├── ProductLearnerUCT.h │ ├── ScalarLearner.h │ ├── SelectorLearner.cpp │ ├── SelectorLearner.h │ ├── SigmoidSingleStumpLearner.cpp │ ├── SigmoidSingleStumpLearner.h │ ├── SingleRegressionStumpLearner.cpp │ ├── SingleRegressionStumpLearner.h │ ├── SingleSparseStump.cpp │ ├── SingleSparseStump.h │ ├── SingleSparseStumpLearner.cpp │ ├── SingleSparseStumpLearner.h │ ├── SingleStumpLearner.cpp │ ├── SingleStumpLearner.h │ ├── StochasticLearner.cpp │ ├── StochasticLearner.h │ ├── TreeLearner.cpp │ ├── TreeLearner.h │ ├── TreeLearnerUCT.cpp │ ├── TreeLearnerUCT.h │ ├── UCBVHaarSingleStumpLearner.cpp │ └── UCBVHaarSingleStumpLearner.h └── main.cpp ├── trash ├── MathUtils.cpp ├── TreeLearner2.cpp ├── TreeLearner2.h ├── TreeLearner3.cpp └── TreeLearner3.h └── version /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The following command allows the use of the "file" command 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | #The declaration of the project 5 | project(multiboost) 6 | 7 | # Multiboost Version 8 | file(READ "version" mbversion) 9 | add_definitions(-DMB_CURRENT_VERSION="${mbversion}") 10 | 11 | set(BASEPATH "${CMAKE_SOURCE_DIR}/src") 12 | 13 | #This allows recursive parsing of the source files 14 | # Including sub-directories recursively 15 | file(GLOB project_SRCS "${BASEPATH}/*.h") 16 | file(GLOB_RECURSE project_SRCS 17 | "${BASEPATH}/Algorithms/*.cpp" "${BASEPATH}/Algorithms/*.h" 18 | "${BASEPATH}/Bandits/*.cpp" "${BASEPATH}/Bandits/*.h" 19 | "${BASEPATH}/BanditsLS/*.cpp" "${BASEPATH}/BanditsLS/*.h" 20 | "${BASEPATH}/Classifiers/*.cpp" "${BASEPATH}/Classifiers/*.h" 21 | "${BASEPATH}/IO/*.cpp" "${BASEPATH}/IO/*.h" 22 | "${BASEPATH}/Others/*.cpp" "${BASEPATH}/Others/*.h" 23 | "${BASEPATH}/StrongLearners/*.cpp" "${BASEPATH}/StrongLearners/*.h" 24 | "${BASEPATH}/Utils/*.cpp" "${BASEPATH}/Utils/*.h" 25 | "${BASEPATH}/WeakLearners/*.cpp" "${BASEPATH}/WeakLearners/*.h") 26 | 27 | # Bzip2 28 | file(GLOB bzip2_SRCS "${BASEPATH}/Bzip2/*.cpp" "${BASEPATH}/Bzip2/*.c" "${BASEPATH}/Bzip2/*.h") 29 | add_library(Bzip2Lib STATIC ${bzip2_SRCS}) 30 | 31 | # By Default AlphaReal is double and FeatureReal is float 32 | # uncomment those lines to change that 33 | #ADD_DEFINITIONS( "-DFEATUREREALDOUBLE" ) 34 | #ADD_DEFINITIONS( "-DALPHAREALFLOAT" ) 35 | 36 | #set(CMAKE_INCLUDE_PATH ./) 37 | include_directories("${BASEPATH}") 38 | 39 | # make the library (used for unit testing) 40 | add_library(MultiBoostLib STATIC ${project_SRCS}) 41 | 42 | #This indicates the target (the executable) 43 | add_executable(multiboost "${BASEPATH}/main.cpp") 44 | 45 | # adding library to the exec 46 | target_link_libraries(multiboost MultiBoostLib Bzip2Lib) 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MultiBoost 2 | ========== 3 | Welcome to the MultiBoost project! 4 | ---------- 5 | The MultiBoost package is a *multi-class / multi-label / multi-task classification* boosting software implemented in C++. It implements essentially a multi-class version of **AdaBoost** (namely **AdaBoost.MH**) along with several multi-class weak-learning algorithms and cascades. It is free and easy to build into other applications due to its high modularity. 6 | 7 | If you use this software in any publication, please refer to the following article: 8 | 9 | D. Benbouzid, R. Busa-Fekete, N. Casagrande, F.-D. Collin, and B. Kégl 10 | MultiBoost: a multi-purpose boosting package 11 | Journal of Machine Learning Research, 13:549–553, 2012. 12 | 13 | * [Original website](http://multiboost.org) 14 | -------------------------------------------------------------------------------- /src/Algorithms/ConstantAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * MultiBoost - Multi-purpose boosting package 4 | * 5 | * Copyright (C) AppStat group 6 | * Laboratoire de l'Accelerateur Lineaire 7 | * Universite Paris-Sud, 11, CNRS 8 | * 9 | * This file is part of the MultiBoost library 10 | * 11 | * This library is free software; you can redistribute it 12 | * and/or modify it under the terms of the GNU General Public 13 | * License as published by the Free Software Foundation 14 | * version 2.1 of the License. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin St, 5th Floor, Boston, MA 02110-1301 USA 24 | * 25 | * Contact: : multiboost@googlegroups.com 26 | * 27 | * For more information and up-to-date version, please visit 28 | * 29 | * http://www.multiboost.org/ 30 | * 31 | */ 32 | 33 | 34 | #include "ConstantAlgorithm.h" 35 | 36 | #include 37 | #include 38 | 39 | #include "IO/InputData.h" 40 | #include "Others/Rates.h" 41 | #include "IO/NameMap.h" 42 | 43 | //To be checked with sparse with BreastCancer 44 | 45 | namespace MultiBoost { 46 | 47 | // ------------------------------------------------------------------------------ 48 | 49 | void ConstantAlgorithm::findConstantWeightsEdges( InputData* pData, 50 | vector& halfWeightsPerClass, 51 | vector& halfEdges) 52 | { 53 | const int numClasses = pData->getNumClasses(); 54 | const int numExamples = pData->getNumExamples(); 55 | 56 | memset(&(halfWeightsPerClass[0]), 0, sizeof(AlphaReal) * halfWeightsPerClass.size() ); 57 | memset(&(halfEdges[0]), 0, sizeof(AlphaReal) * halfEdges.size() ); 58 | //fill(halfWeightsPerClass.begin(), halfWeightsPerClass.end(), 0); 59 | //fill(halfEdges.begin(), halfEdges.end(), 0); 60 | 61 | for (int i = 0; i < numExamples; ++i) 62 | { 63 | vector