File size: 783 Bytes
7c045bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

"""
K-Nearest Neighbors Classifier setup.

Features:
- Uses `KNeighborsClassifier`.
- Works for binary and multi-class tasks.
- Default scoring: 'accuracy'.

Considerations:
- `n_neighbors`, `weights`, and `p` (Minkowski distance) are common parameters to tune.
"""

from sklearn.neighbors import KNeighborsClassifier

estimator = KNeighborsClassifier()

param_grid = {
    'model__n_neighbors': [3, 5],  # Reduced to two neighbor options
    'model__weights': ['uniform'],  # Focused on one weighting strategy
    'model__p': [2],  # Fixed to Euclidean distance
    # Preprocessing params
    #'preprocessor__num__imputer__strategy': ['mean'],
    #'preprocessor__num__scaler__with_mean': [True],
    #'preprocessor__num__scaler__with_std': [True],
}

default_scoring = 'accuracy'