Skip to content

Commit

Permalink
Add NCA
Browse files Browse the repository at this point in the history
  • Loading branch information
toandm2 committed Mar 9, 2021
1 parent 6db71c0 commit 359c9ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions pipelineservice/neighbors/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._neighbors import neighborhoodComponentsAnalysis
12 changes: 12 additions & 0 deletions pipelineservice/neighbors/_neighbors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import numpy as np
import pandas as pd
from sklearn.neighbors import NeighborhoodComponentsAnalysis


class neighborhoodComponentsAnalysis(NeighborhoodComponentsAnalysis):
feature_name = 'nca'
def transform(self, X):
data = super().transform(X)
cols = [f'{self.feature_name}_{i}' for i in range(data.shape[1])]
return pd.DataFrame(data, columns = cols, index = X.index)

0 comments on commit 359c9ff

Please sign in to comment.