Skip to content

Commit

Permalink
improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-wozny committed Nov 20, 2023
1 parent d9e8ea4 commit ed5b204
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ Our package includes implementation of such algorithms, as:
## Example usage
```python
from multi_imbalance.resampling.mdo import MDO
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split

# Mahalanbois Distance Oversampling
mdo = MDO(k=9, k1_frac=0, seed=0)

# read the data
X_train, y_train, X_test, y_test = ...
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# preprocess
X_train_resampled, y_train_resampled = mdo.fit_transform(np.copy(X_train), np.copy(y_train))
X_train_resampled, y_train_resampled = mdo.fit_resample(np.copy(X_train), np.copy(y_train))

# train the classifier on preprocessed data
clf_tree = DecisionTreeClassifier(random_state=0)
Expand Down

0 comments on commit ed5b204

Please sign in to comment.