How to determine the abnormality of a specific variable by taking into account all the other variables in the data?
If you want to focus on the outliers wrt the class, you can do as follows:
Using Isolation Forest
import pandas as pd
import numpy as np

from sklearn.datasets import load_iris
from sklearn.preprocessing import StandardScaler, FunctionTransformer
from sklearn.model_selection import train_test_split
from sklearn.ensemble import IsolationForest
from sklearn.decomposition import PCA
from sklearn.pipeline import Pipeline

import plotly.express as px

X, y = load_iris(return_X_y= True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = .2, random_state = 42)

out_model = Pipeline([(&quot;model&quot;, IsolationForest(random_state= 42))]).fit(X_train)

visualizer = Pipeline([(&quot;scaler&quot;,StandardScaler()),
                (&quot;decomposer&quot;,PCA(n_components= 3)),
                (&quot;framer&quot;, FunctionTransformer(lambda x: pd.DataFrame(x, columns = [&quot;p1&quot;,&quot;p2&quot;,&quot;p3&quot;])))]).fit(X_train)

outliers = out_model.predict(X_train)
X3D = visualizer.transform(X_train)

px.scatter_3d(data_frame=X3D, x = &quot;p1&quot;, y = &quot;p2&quot;, z = &quot;p3&quot;, color = y_train, symbol=outliers )

pd.crosstab(index = y_train, columns= outliers, margins= True, normalize= 0 )

Output:


We can see that ~ 35% of observations that belong to class 2 are marked as outliers
This is a good starting point to analyze the reasons behind this.
Hope it helps