This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from ._sklearn import * | ||
from .o3iss import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from .o3iss import compute | ||
from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin | ||
from sklearn.linear_model import LogisticRegression | ||
from sklearn.preprocessing import StandardScaler | ||
from sklearn.pipeline import Pipeline | ||
import numpy as np | ||
|
||
|
||
class IssTransformer(BaseEstimator, TransformerMixin): | ||
def __init__(self, level=4): | ||
self.level = level | ||
|
||
def fit(self, X, y=None): | ||
return self | ||
|
||
def transform(self, X): | ||
return np.array([compute(x, self.level) for x in X]) | ||
|
||
|
||
class IssClassifier(BaseEstimator, ClassifierMixin): | ||
def __init__(self, level=4): | ||
self.level = level | ||
self.pipeline = Pipeline( | ||
[ | ||
("scale", StandardScaler()), | ||
("iss", IssTransformer(level=level)), | ||
("logit", LogisticRegression()), | ||
] | ||
) | ||
|
||
def fit(self, X, y): | ||
return self.pipeline.fit(X, y) | ||
|
||
def predict(self, X): | ||
return self.pipeline.predict(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters