Detect outliers using DBSCAN or other methods, then optionally remove them or down-weight them before supervised learning.
Usage
tl_anomaly_aware(
data,
formula,
response,
anomaly_method = "dbscan",
action = "flag",
supervised_method = "tree",
...
)Arguments
- data
A data frame
- formula
Model formula
- response
Response variable name
- anomaly_method
Method for anomaly detection. Only "dbscan" is implemented; its noise points are the anomalies.
- action
Action to take: "remove", "flag", "downweight".
"downweight"gives anomalies a case weight of 0.1, and needs asupervised_methodthat takes case weights:"linear","polynomial","logistic","tree","ridge","lasso","elastic_net"or"forest". A forest reads them as sampling weights.- supervised_method
Supervised learning method (default:
"tree", which handles both regression and classification with any number of classes)."logistic"is binary-only and errors on a response with more than two levels.- ...
Additional arguments
