lapros data for better AI
Project description
LaPros
Install
pip install -U lapros
How to use
LaPros works with classifiers. It ranks the suspicious labels given probabilies by some classification model. You can use normal Python lists, Numpy arrays or Pandas data. Return values are in a Numpy array or a Pandas series, the larger the value, the more suspicious are the coresponding labels.
from lapros import suspect
suspect
Rank the suspicious labels given probas from a classifier.
Params: accept numpy arrays, pandas dataframes and series, and normal Python lists.
- probas: shape n x m, probabilites for possible classes.
- labels: shape n x 1, observed class labels
We can use interger, string or even float labels, given that the probability dataframe’s columns are indexed by the same label set.
Returns: a Pandas DataFrame including 1 index and 2 columns:
- id (int): the index which is the same to the original data row index
- err (float): the magnitude of suspiciousness, valued between [0, 1]
- suspected (bool): whether the data row is suspected as having a label error.
labels = [1, 0, 0, 1, 1];
probas = [
#
[0.5, 0.6, 0.7, 0.8, 0.9],
[0.5, 0.4, 0.3, 0.2, 0.1],
];
suspect(
probas,
labels=labels,
)
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
err | suspected | |
---|---|---|
0 | 0.4 | False |
1 | 0.3 | False |
2 | 0.1 | False |
3 | 0.7 | False |
4 | 0.9 | True |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.