Skip to content

Commit

Permalink
Merge pull request #25 from A3Data/add-unsupervised
Browse files Browse the repository at this point in the history
Add Class SkLearn Unsupervised
  • Loading branch information
neylsoncrepalde authored Feb 25, 2021
2 parents 7b4e8b5 + 82e69d7 commit bbb0066
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions hermione/file_text/trainer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,32 @@ class TrainerSklearn(Trainer):
if classification:
model.train_interpret(X)
return model

class TrainerSklearnUnsupervised(Trainer):

def train(self, X,
algorithm,
preprocessing=None,
**params):
"""
Method that builds the Sklearn model

Parameters
----------
model_name : str
model name
preprocessing : Preprocessing
preprocessed object to be applied

Returns
-------
Wrapper
"""
model = algorithm(**params) #model
columns = list(X.columns)
model.fit(X)
labels = model.predict(X)
res_metrics = Metrics.clusterization(X, labels)

model = Wrapper(model, preprocessing, res_metrics, columns)
return model

0 comments on commit bbb0066

Please sign in to comment.