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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file eznorm-0.0.0.tar.gz
.
File metadata
- Download URL: eznorm-0.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89a803083af8873cea5fd134af58b6f1bcf92f397bd5beaae5995d40541fbce8 |
|
MD5 | a9117e731cf1d527c14f0d9c9db4391b |
|
BLAKE2b-256 | 0ed0aa4411d6f9994a3c8958251558f0879c4d77c049a8b783526567fec2b317 |
File details
Details for the file eznorm-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: eznorm-0.0.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02b47978f7b28f5de11640c7c278ae16bc079e6b7a7b577c1652fb4e6509a0a1 |
|
MD5 | 2f4c45f9364ad636d78cf2b235d574f7 |
|
BLAKE2b-256 | 8b18a707e95de07db5dbf92f4ef46a7122596abb0e2940f006f9b9396faecbe1 |