Skip to main content

A package for analysis of rare particle decays with machine-learning algorithms

Project description

Code Health Build Status PyPI version Dependency Status


This package consists of several tools for the event selection of particle decays, mostly built on machine learning techniques. It contains:

  • a data-container holding data, weights, labels and more and implemented root-to-python data conversion as well as plots and KFold-data splitting
  • reweighting tools from the hep_ml-repository wrapped in a KFolding structure and with metrics to evaluate the reweighting quality
  • classifier optimization tools for hyper-parameters as well as feature selection involving a backward-elimination
  • an output handler which makes it easy to add text as well as figures into your code and automatically save them to a file
  • … and more

HowTo examples

To get an idea of the package, have a look at the howto notebooks: HTML version or the IPython Notebooks

Minimal example

Want to test whether your reweighting did overfit? Use train_similar:

import raredecay as rd

mc_data =, weights=*pd.Series weights*, target=0)
real_data =, weights=*pd.Series weights*, target=1)

score = rd.score.train_similar(mc_data, real_data, old_mc_weights=1 *or whatever weights the mc had before*)

Getting started right now

If you want it the easy, fast way, have a look at the Ready-to-use scripts. All you need to do is to have a look at every “TODO” task and probably change them. Then you can run the script without the need of coding at all.

Documentation and API

The API as well as the documentation: Documentation

Setup and installation


Easiest way: use conda to install everything (except of the rep, which has to be upgraded with pip for some functionalities)

conda install raredecay -c mayou36


The package with all extras requires root_numpy as well as rootpy (and therefore a ROOT installation with python-bindings) to be installed on your system. If that is not the case, some functions won’t work.

If you want to install all the extra, first install the very newest version of REP (may also needed with conda install) (the -U can be omitted, but is recommended to have the newest dependencies):

pip install -U

Then, install the raredecay package (without ROOT-support) via

pip install raredecay

To make sure you can convert ROOT-NTuples, use

pip install raredecay[root]  # *use raredecay\[root\] in a zsh-console*

or, instead of root/additionally (comma separated) reweight or reweight for the specific functionalities.

In order to have all functionalities, use

pip install raredecay[all]

As it is a young package still under developement, it may receive regular updates and improvements and it is probably a good idea to regularly download the newest package.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
raredecay-2.0.2-py3-none-any.whl (112.2 kB) Copy SHA256 hash SHA256 Wheel py3 Nov 5, 2017
raredecay-2.0.2.tar.gz (93.9 kB) Copy SHA256 hash SHA256 Source None Nov 5, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page