pyproteonet.imputation.sklearn.knn_impute

pyproteonet.imputation.sklearn.knn_impute(dataset: Dataset, molecule: str, column: str, result_column: str | None = None, **kwargs) Dataset

Apply the scikit learn k nearest neighbor imputation to a dataset.

Parameters:
  • dataset (Dataset) – Dataset to impute.

  • molecule (str) – Molecule type to impute (e.g. protein, peptide etc.).

  • column (str) – Name of the value column to impute.

  • result_column (Optional[str], optional) – If given, name of the value column to store the imputed values in. Defaults to None.

  • n_neighbors (int, optional) – Number of neighbors to use for imputation. Defaults to 5.

  • transpose (bool, optional) – Whether to transpose the matrix before imputation. Defaults to False.

Returns:

The imputed values.

Return type:

pd.Series