Skip to content

Commit

Permalink
v2.2.2
Browse files Browse the repository at this point in the history
- Added the option to to *not* store the full value of pdfs in the
output of optimization/evaluation, by setting
  ```python
  glob.annz["doStorePdfBins"] = False
  ```
In this case, only the average metrics of a pdf are included in the
output.

- Added the `sampleFrac_errKNN` option, to allow to sub-sample the
input dataset for the knn uncertainty calculation (similar to e.g.,
`sampleFracInp_wgtKNN` and `sampleFracInp_inTrain`).

- Added metric plots of the distribution of the KNN error estimator vs.
the true bias. The plots are added to the output by setting
  ```python
  glob.annz["doKnnErrPlots"] = True
  ```

- Added support for input ROOT files with different Tree names.

- Added support for ROOT version `6.8.*`.

- Other minor modifications and bug fixes.
  • Loading branch information
IftachSadeh committed Mar 4, 2017
1 parent a16e179 commit 7f0674a
Show file tree
Hide file tree
Showing 16 changed files with 389 additions and 224 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Master version (20/11/2016)
<!-- ## Master version (???????) -->
## ANNZ v2.2.2 (04/03/2017)

- Added the option to to *not* store the full value of pdfs in the output of optimization/evaluation, by setting
```python
Expand All @@ -17,7 +18,7 @@ In this case, only the average metrics of a pdf are included in the output.

- Added support for input ROOT files with different Tree names.

- Updated `README.md`.
- Added support for ROOT version `6.8.*`.

- Other minor modifications and bug fixes.

Expand Down
61 changes: 32 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ include $(ROOTSYS)/etc/Makefile.arch
endif
# Tutorials dir needed by stressProof
ifneq ($(RCONFIG),)
TUTDIR := $(wildcard $(shell grep ROOTDOCDIR $(RCONFIG) | sed "s|.*\"\(.*\)\"|\1|")/tutorials)
# TUTDIR := $(wildcard $(shell grep ROOTDOCDIR $(RCONFIG) | sed "s|.*\"\(.*\)\"|\1|")/tutorials)
TUTDIR := $(ROOTSYS)/tutorials
endif
ifeq ($(TUTDIR),)
ifeq ($(ROOTSYS),)
Expand Down Expand Up @@ -72,13 +73,15 @@ BaseClassS = BaseClass.$(SrcSuf)
CatFormatS = CatFormat.$(SrcSuf)
ANNZS = ANNZ.$(SrcSuf)

OptMapsSO = libOptMaps.$(DllSuf)
UtilsSO = libUtils.$(DllSuf)
VarMapsSO = libVarMaps.$(DllSuf)
OutMngrSO = libOutMngr.$(DllSuf)
BaseClassSO = libBaseClass.$(DllSuf)
CatFormatSO = libCatFormat.$(DllSuf)
ANNZSO = libANNZ.$(DllSuf)
SoSuf := so

OptMapsSO = libOptMaps.$(SoSuf)
UtilsSO = libUtils.$(SoSuf)
VarMapsSO = libVarMaps.$(SoSuf)
OutMngrSO = libOutMngr.$(SoSuf)
BaseClassSO = libBaseClass.$(SoSuf)
CatFormatSO = libCatFormat.$(SoSuf)
ANNZSO = libANNZ.$(SoSuf)

ifeq ($(PLATFORM),win32)
OptMapsLIB = libOptMaps.lib
Expand Down Expand Up @@ -124,9 +127,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down Expand Up @@ -154,9 +157,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down Expand Up @@ -184,9 +187,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down Expand Up @@ -215,9 +218,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down Expand Up @@ -245,9 +248,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down Expand Up @@ -275,9 +278,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down Expand Up @@ -306,9 +309,9 @@ ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
ifeq ($(MACOSX_MINOR),4)
ln -sf $@ $(subst .$(DllSuf),.so,$@)
endif
# ifeq ($(MACOSX_MINOR),4)
# ln -sf $@ $(subst .$(DllSuf),.so,$@)
# endif
endif
else
ifeq ($(PLATFORM),win32)
Expand Down
31 changes: 4 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ANNZ v2.2.1
# ANNZ v2.2.2

## Introduction
ANNZ uses both regression and classification techniques for estimation of single-value photo-z (or any regression problem) solutions and PDFs. In addition it is suitable for classification problems, such as star/galaxy classification.
Expand Down Expand Up @@ -46,36 +46,13 @@ Randomized classification may be used for general classification problems. In th

- python 2.7 or higher.
- gcc 4.3 or higher.
- ROOT 5.34/11 to 6.06.
- ROOT 5.34/11 or higher.

### Download (and if needed install) ROOT

ROOT is available [here](https://root.cern.ch/drupal/content/downloading-root). ROOT v5.34/25 was used for development, and v6.06 for testing. At the moment, ROOT version 6.08 is NOT supported.
<!-- Later ROOT versions should also be compatible (please report any issues). -->
ROOT is available [here](https://root.cern.ch/downloading-root). ROOT v5.34/25 was used for development, and v6.06 for testing. Later ROOT versions should also be compatible (please report any issues).

Lets assume we want to install ROOT at `/home/work/root`. We can get ROOT, in one of two ways (as explained on the ROOT site):

1. It is possible to download a pre-compiled directory for modern operating systems. For instance, for OSX 10.10 x86-64 with clang 6.0 (ROOT version 5.34.25), do:
```bash
cd /home/work
wget http://root.cern.ch/download/root_v5.34.25.macosx64-10.10-i386.tar.gz
tar xvfz root_v5.34.25.macosx64-10.10-i386.tar.gz
```

2. Alternatively, one may download the source files and compile from scratch. This would require something like:
```bash
cd /home/work
wget http://root.cern.ch/download/root_v5.34.25.source.tar.gz
tar xvfz root_v5.34.25.source.tar.gz
cd root
./configure
make
```

In order to check that ROOT is properly installed, do:
```bash
/home/work/root/bin/root -b -q
```
For installation instructions, go [here](https://root.cern.ch/building-root). Notice the pre-compiled versions available for common operating systems.

### Install ANNZ

Expand Down
12 changes: 9 additions & 3 deletions include/ANNZ.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "TMVA/MethodBase.h"
#include "TMVA/PDF.h"

#if ROOT_VERSION_CODE >= ROOT_VERSION(6,8,0)
#include "TMVA/DataLoader.h"
#endif

// -----------------------------------------------------------------------------------------------------------
// hack to make all the private elements of MethodKNN accecible
// -----------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -111,7 +115,7 @@ class ANNZ : public BaseClass {
// -----------------------------------------------------------------------------------------------------------
// ANNZ_TMVA.cpp :
// -----------------------------------------------------------------------------------------------------------
void prepFactory(int nMLMnow = -1, TMVA::Factory * factory = NULL, bool isBiasMLM = false);
void prepFactory(int nMLMnow = -1, TMVA::Configurable * configIn = NULL, bool isBiasMLM = false);
void doFactoryTrain(TMVA::Factory * factory);
void clearReaders(Log::LOGtypes logLevel = Log::DEBUG_1);
void loadReaders(map <TString,bool> & mlmSkipNow, bool needMcPRB = true);
Expand All @@ -124,9 +128,11 @@ class ANNZ : public BaseClass {
// ANNZ_err.cpp :
// -----------------------------------------------------------------------------------------------------------
void createTreeErrKNN(int nMLMnow);
void setupKdTreeKNN(TChain * aChainKnn, TFile *& knnErrOutFile, TMVA::Factory *& knnErrFactory, TMVA::kNN::ModulekNN *& knnErrModule,
void setupKdTreeKNN(TChain * aChainKnn, TFile *& knnErrOutFile, TMVA::Factory *& knnErrFactory,
TMVA::Configurable *& knnErrDataLdr, TMVA::kNN::ModulekNN *& knnErrModule,
vector <int> & trgIndexV, int nMLMnow, TCut cutsAll, TString wgtAll);
void cleanupKdTreeKNN(TFile *& knnErrOutFile, TMVA::Factory *& knnErrFactory, bool verb = false);
void cleanupKdTreeKNN(TFile *& knnErrOutFile, TMVA::Factory *& knnErrFactory,
TMVA::Configurable *& knnErrDataLdr, bool verb = false);
void getRegClsErrKNN(VarMaps * var, TMVA::kNN::ModulekNN * knnErrModule, vector <int> & trgIndexV,
vector <int> & nMLMv, bool isREG, vector < vector <double> > & zErrV);

Expand Down
4 changes: 4 additions & 0 deletions include/CatFormat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "TMVA/MethodBase.h"
#include "TMVA/PDF.h"

#if ROOT_VERSION_CODE >= ROOT_VERSION(6,8,0)
#include "TMVA/DataLoader.h"
#endif

// -----------------------------------------------------------------------------------------------------------
// hack to make all the private elements of MethodKNN accecible
// -----------------------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 7f0674a

Please sign in to comment.