1 Star 2 Fork 0

tianyu/featureColByTorch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
base.py 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
tianyu 提交于 2020-09-01 21:46 . initial commit
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : base.py
@Author : Braylon1002
@Version : 1.0
@Contact : S.Braylon1002@gmail.com
Desc : None
"""
from abc import ABC, abstractmethod
from transformers import Column
from transformers.columnFlow import ColumnFlow
class BaseFeature(ABC):
"""
base class for feature column classes
"""
@abstractmethod
def __init__(self, name, column_flow=None):
"""
__init__
:param name: str
name of the feature
:param column_flow: ColumnFlow or list of col transformers
transform the data
"""
self.name = name
self.column_flow = None
if column_flow:
if isinstance(column_flow, ColumnFlow):
self.column_flow = column_flow
elif isinstance(column_flow, list):
self.column_flow = ColumnFlow(column_flow)
elif isinstance(column_flow, Column):
self.column_flow = ColumnFlow([column_flow])
else:
raise NotImplementedError(
"wrong input type with ColumnFlow"
)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/S_Braylon/featureColByTorch.git
git@gitee.com:S_Braylon/featureColByTorch.git
S_Braylon
featureColByTorch
featureColByTorch
master

搜索帮助