Different helpful functions, objects, methods are collected here.
This is the sane as previous function, but a bit slower and naive
Splits the data of parallel arrays into bins, the first array is binning variable
Prepares normalization function for some set of values transforms it to uniform distribution from [0, 1]. Example of usage:
| Parameters: |
|
|---|
>>> normalizer = Flattener(signal)
>>> hist(normalizer(background))
>>> hist(normalizer(signal))
| Return func: | normalization function |
|---|
Calculate roc curve
| Parameters: |
|
|---|---|
| Returns: | (tpr, tnr), (err_tnr, err_tpr), thresholds |
Calculate correlation matrix
| Parameters: | df (pandas.DataFrame) – data |
|---|---|
| Returns: | correlation matrix for dataFrame |
| Return type: | numpy.ndarray |
Calculate data for error bar (for plot pdf with errors)
| Parameters: |
|
|---|---|
| Returns: | tuple (x-points (list), y-points (list), y points errors (list), x points errors (list)) |
Checks the weights, returns normalized version
Get (new column: old column) dict expressions
| Parameters: | columns (list[str]) – columns names |
|---|---|
| Return type: | dict |
Get columns in data frame using numexpr evaluation
| Parameters: |
|
|---|---|
| Returns: | data frame with pointed columns |
Construct efficiency function dependent on spectator for each threshold
Different score functions available: Efficiency, Precision, Recall, F1Score, and other things from sklearn.metrics
| Parameters: |
|
|---|---|
| Returns: | if errors=False OrderedDict threshold -> (x_values, y_values) if errors=True OrderedDict threshold -> (x_values, y_values, y_err, x_err) All the parts: x_values, y_values, y_err, x_err are numpy.arrays of the same length. |
Applies the same permutation to all passed arrays, permutation sorts the first passed array
Does the same thing as train_test_split, but preserves columns in DataFrames. Uses the same parameters: test_size, train_size, random_state, and has the same interface
| Parameters: | arrays (list[numpy.array] or list[pandas.DataFrame]) – arrays to split |
|---|