Created
March 24, 2020 04:35
-
-
Save FelixChop/d3d6ce29da1700e31e3f794e33e6e9a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.ensemble import IsolationForest | |
outlier_detection = IsolationForest(random_state=1, behaviour="new") | |
outlier_detection.fit(titanic[['Fare', 'SibSp', 'Parch', 'Age']].dropna()) | |
data = titanic[['Fare', 'SibSp', 'Parch', 'Age']].dropna() | |
data['anomaly_score'] = outlier_detection.score_samples(data) | |
data.sort_values('anomaly_score') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment