Skip to main content

Easy to use normalization tool for machine learning.

Project description

eznorm

下の方に日本語の説明があります

Overview

  • Easy to use normalization tool for machine learning.
  • Normalization is performed on test data as well as on training parameters to prevent leakage.
  • Automatically prevents division by zero for features with a standard deviation of zero

Usage

import eznorm

train_x = [
	[1, -10, 0.3],
	[2, -5, 0.1],
	[1, -10, 0.5],
]
test_x = [[2, -5, 0.2], [1, -7, 0.3]]

# Normalize training data
norm_params = eznorm.fit(train_x)	# Fit the data to the normalization parameters (returns normalization parameters) [eznorm]
norm_train_x = eznorm.normalize(train_x, norm_params)	# Normalize the data [eznorm]
"""
norm_train_x:
[[-0.70710678 -0.70710678  0.        ]
 [ 1.41421356  1.41421356 -1.22474487]
 [-0.70710678 -0.70710678  1.22474487]]
"""

# Normalize test data
norm_test_x = eznorm.normalize(test_x, norm_params)	# Normalize the data [eznorm]
"""
norm_test_x:
[[ 1.41421356  1.41421356 -0.61237244]
 [-0.70710678  0.56568542  0.        ]]
"""

概要

  • 機械学習の正規化処理を簡単に実施するツール
  • テストデータに対してもにも学習時のパラメータで正規化を実施することでリーケージを防止
  • 標準偏差が0の特徴量に対してのゼロ割りを自動的に防止

使用例

import eznorm

train_x = [
	[1, -10, 0.3],
	[2, -5, 0.1],
	[1, -10, 0.5],
]
test_x = [[2, -5, 0.2], [1, -7, 0.3]]

# 学習データの正規化
norm_params = eznorm.fit(train_x)	# 学習データへの適合 (正規化パラメータを返す) [eznorm]
norm_train_x = eznorm.normalize(train_x, norm_params)	# データの正規化 [eznorm]
"""
norm_train_x:
[[-0.70710678 -0.70710678  0.        ]
 [ 1.41421356  1.41421356 -1.22474487]
 [-0.70710678 -0.70710678  1.22474487]]
"""

# テストデータの正規化
norm_test_x = eznorm.normalize(test_x, norm_params)	# データの正規化 [eznorm]
"""
norm_test_x:
[[ 1.41421356  1.41421356 -0.61237244]
 [-0.70710678  0.56568542  0.        ]]
"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eznorm-0.0.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

eznorm-0.0.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page