Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard scaler link #309

Merged
merged 5 commits into from
Jan 24, 2019
Merged

Conversation

corochann
Copy link
Member

@corochann corochann commented Jan 23, 2019

StandardScaler with chainer.Link

there are several benefits:

  • serialization inside chainer.Chain
  • gpu calculation support
  • only scale indices, if specified.

def _compute_mean_std_all(self, input_dim):
if self.indices is None:
std_all = self.xp.ones(input_dim, dtype=self.xp.float32)
std_all[self.std != 0] = self.std[self.std != 0]
Copy link
Member

Choose a reason for hiding this comment

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

It is kind to raise warning when std == 0. Because it is very strange situation.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated: show warning at fit.

if x.ndim == 1:
# Deal with as 1 feature with several samples.
x = x[:, None]
if x.ndim != 2:
Copy link
Member

Choose a reason for hiding this comment

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

elif ?

x = x[:, None]
if x.ndim != 2:
raise ValueError(
"Unexpected value x.shape={}, only x.ndim=2 is supported."
Copy link
Member

Choose a reason for hiding this comment

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

x.ndim 1 or 2?

@codecov-io
Copy link

Codecov Report

Merging #309 into master will decrease coverage by 5.81%.
The diff coverage is 88.75%.

@@            Coverage Diff             @@
##           master     #309      +/-   ##
==========================================
- Coverage    89.6%   83.78%   -5.82%     
==========================================
  Files         179      182       +3     
  Lines        8112     8272     +160     
==========================================
- Hits         7269     6931     -338     
- Misses        843     1341     +498

@mottodora mottodora merged commit e0fd17e into chainer:master Jan 24, 2019
@corochann corochann deleted the standard_scaler_link branch January 24, 2019 09:43
@corochann corochann added this to the 0.5.0 milestone Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants