Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python/pyspark/ml/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def fit(self, dataset, params=None):
return [self.fit(dataset, paramMap) for paramMap in params]
elif isinstance(params, dict):
if params:
if isinstance(params.keys()[0],str):
param_new = dict()
for param, value in params.items():
p = getattr(self, param)
param_new.update({p: value})
params=param_new
Copy link
Member

@HyukjinKwon HyukjinKwon Nov 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just make it just like the one as below?

params = dict([(getattr(self, p), v) for p, v in params.items()])

BTW, I am not supposed to decide what should be added into Spark. We can wait for committer's review :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HyukjinKwon Ok sure.

return self.copy(params)._fit(dataset)
else:
return self._fit(dataset)
Expand Down