No project description provided
Project description
Biased Classifier
Biased Classifier
Install
Directly from PyPi
servers:
pip install BiasedClassifier
Use
Example using Random Forests from scikit-learn
.
Assume X, y
is a training set with three classes and two heavily inbalanced classes. In this case, we'd like to bias two classifiers into these subsets. We've decided that 0.3
and 0.2
proportions are enough for the minority classes (from smaller up)
from biasedclassifier import BiasedClassifier
from sklearn.ensemble import RandomForestClassifier
clf = BiasedClassifier(
k=5,
p=[0.3, 0.2],
unbiased_classifier=RandomForestClassifier(),
knn_jobs=1
)
# Train
clf.fit(X,y)
# Obtain probabilities for each class
prob = clf.predict_proba(X)
# Predicted values
y_pred = clf.predict(X)
# Average accuracy score
score = clf.score(X, y)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
BiasedClassifier-0.1.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for BiasedClassifier-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5f77c0f42dbb91e7201ec91b9b28264317e0f394d2ff2118edf52870c43f82e |
|
MD5 | b090f943b9be2940eb71a2c7d4239c96 |
|
BLAKE2b-256 | 1d4f84fbd8fbad1e982f7e0ed6d595cd853702178a4fba238fa7aeff2d0be9e5 |