A custom n8n node to clean data using Recursive Feature Elimination (RFE) powered by Python.
npm install n8n-nodes-clean-dataThe Clean Data by RFE node for n8n allows you to clean your dataset by applying Recursive Feature Elimination (RFE) to select the most important features for predictive modeling. This node helps you reduce the number of features in your dataset, improving model performance and interpretability.
The Clean Data by RFE node uses Recursive Feature Elimination (RFE) to automatically select the most relevant features in your dataset based on their importance in predicting a target column. After applying RFE, the node outputs the cleaned dataset with only the selected features.
To install this custom node, follow the steps below:
1. Fork or clone this repository.
2. Follow the official n8n custom node installation guide.
3. Add the node to your n8n workflow.
Once the Clean Data by RFE node is added to your workflow, you can configure the following parameters:
- Target Column (string):
- Default: target
- Description: The name of the target column for RFE (the column you are predicting).
- Number of Features to Keep (number):
- Default: 5
- Description: The number of features to keep after applying RFE. Features are ranked by importance, and the specified number of features are retained.
- Output Format (options):
- JSON: The output will be in JSON format, containing the selected features and the cleaned dataset.
- Table: Placeholder for future functionality (currently outputs JSON).
- Default: json
- Description: Choose the output format for the result.
Here’s an example configuration for cleaning data and selecting the top 5 features:
#### Input Data
``json`
{
"data": [
{"feature1": 1, "feature2": 2, "feature3": 3, "target": 0},
{"feature1": 4, "feature2": 5, "feature3": 6, "target": 1},
{"feature1": 7, "feature2": 8, "feature3": 9, "target": 1}
]
}
Node Configuration:
- Target Column: target
- Number of Features to Keep: 2
- Output Format: JSON
#### Output
Once the node has completed, it will return the following data:
`json`
{
"selected_features": ["feature1", "feature3"],
"output_file": "cleaned_data.csv"
}
- selected_features: A list of the selected features based on RFE.
- output_file: Path to the cleaned data file (cleaned_data.csv`).