knn

systemds.operator.algorithm.knn(Train: Matrix, Test: Matrix, CL: Matrix, START_SELECTED: Matrix, **kwargs: Dict[str, DAGNode | str | int | float | bool])

This script implements KNN (K Nearest Neighbor) algorithm.

Parameters:
  • Train – The input matrix as features

  • Test – The input matrix for nearest neighbor search

  • CL – The input matrix as target

  • CL_T – The target type of matrix CL whether columns in CL are continuous ( =1 ) or categorical ( =2 ) or not specified ( =0 )

  • trans_continuous – Option flag for continuous feature transformed to [-1,1]: FALSE = do not transform continuous variable; TRUE = transform continuous variable;

  • k_value – k value for KNN, ignore if select_k enable

  • select_k – Use k selection algorithm to estimate k (TRUE means yes)

  • k_min – Min k value( available if select_k = 1 )

  • k_max – Max k value( available if select_k = 1 )

  • select_feature – Use feature selection algorithm to select feature (TRUE means yes)

  • feature_max – Max feature selection

  • interval – Interval value for K selecting ( available if select_k = 1 )

  • feature_importance – Use feature importance algorithm to estimate each feature (TRUE means yes)

  • predict_con_tg – Continuous target predict function: mean(=0) or median(=1)

  • START_SELECTED – feature selection initial value

Returns:

Applied clusters to X

Returns:

Cluster matrix

Returns:

Feature importance value