Skip to content

Commit

Permalink
add multi dimension subplots and chosen 2 features scatter from many …
Browse files Browse the repository at this point in the history
…features
  • Loading branch information
Tatsuya-hasegawa committed Nov 6, 2024
1 parent ea6873a commit 56788e5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions msticpy/analysis/outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""

import math
from typing import List, Optional, Tuple
from typing import List, Optional, Tuple, Union

import numpy as np
import pandas as pd
Expand All @@ -41,7 +41,7 @@ def identify_outliers(
x: np.ndarray,
x_predict: np.ndarray,
contamination: float = 0.05,
max_features: Optional[int] = None,
max_features: Optional[Union[int, float]] = None,
) -> Tuple[IsolationForest, np.ndarray, np.ndarray]:
"""
Identify outlier items using SkLearn IsolationForest.
Expand All @@ -54,8 +54,10 @@ def identify_outliers(
Model
contamination : float
Percentage contamination (default: {0.05})
max_features : int, optional
The maximum number of features to be used for Isolation Forest (default: None)
max_features : int or float, optional
Specifies max num or max rate of features
to be randomly selected when building each tree.
default: None => {math.floor(math.sqrt(cols))}
Returns
-------
Expand Down Expand Up @@ -90,7 +92,7 @@ def identify_outliers(
return clf, x_outliers, y_pred_outliers


# pylint: disable=too-many-arguments, too-many-statements, too-many-locals
# pylint: disable=too-many-arguments, too-many-locals
def plot_outlier_results(
clf: IsolationForest,
x: np.ndarray,
Expand Down Expand Up @@ -231,7 +233,6 @@ def plot_outlier_results(
"new regular observations",
"new abnormal observations",
],
loc="best",
facecolor="#0072BD",
framealpha=0.3,
)
Expand Down

0 comments on commit 56788e5

Please sign in to comment.