Skip to main content

Feature Column in Pytorch

Description

this is a feature column tool implemented by pytorch, which has the same function compared to featurecol class in Tensorflow.

And it's also a tool for me to paricipate in some data science competition.

Usage

from features import Features
from number_feat import Number
from category_feat import Category

from transformers.NumberTransformer import NumberTransformer
from transformers.CategoryTransformer import CategoryTransformer
import pandas as pd
import numpy as np
  • Example
def make_data():
    data = pd.DataFrame(np.random.randint(1, 20, size=(3,4)), columns=['col1', 'col2', 'col3', 'col4'])
    return data

if __name__ == "__main__":
    data = make_data()
    Number_1 = Number('col1', NumberTransformer())
    Category_1 = Category('col2', CategoryTransformer())
    Category_2 = Category('col3', CategoryTransformer())
    Features_1 = Features(number_feat=[Number_1], category_feat=[Category_2], sequence_feat=[])
    print(Features_1.number_feat)
    Features_1.fit(data)
    res = Features_1.transform(data)
    print(res)

Returned Data

# [<number_feat.Number object at 0x0000018903E64748>]
# OrderedDict([('col1', array([-1.4048787 ,  0.8429272 ,  0.56195146], dtype=float32)), ('col3', array([1, 1, 1], dtype=int64))])

Release files for featureColByTorch 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for featureColByTorch 1.0
File Size Uploaded
featureColByTorch-1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for featureColByTorch 1.0
File Interpreter ABI Platform
featureColByTorch-1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.4 kB

Release files / featureColByTorch-1.0.tar.gz

Download URL featureColByTorch-1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d8bbf327f092954752f152dc588d86279971ff4783eae008b361970d9b6e7de4
BLAKE2b-256 checksum
How to use checksums
23518a841df3721109314f70469661546012693b7451ee326eab6bd8c01cf78f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.6.5

Release files / featureColByTorch-1.0-py2.py3-none-any.whl

Download URL featureColByTorch-1.0-py2.py3-none-any.whl
Size 5.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3d81e14b82a693ffc40934a6b58ac44ace3ef475dc2942556183b1b01a7e0d6f
BLAKE2b-256 checksum
How to use checksums
d4abe3541fb4cde1f43c151704b125197fa08931953f1cacd7c5c5307958946e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page