本文整理汇总了Python中feature.Feature.transform方法的典型用法代码示例。如果您正苦于以下问题:Python Feature.transform方法的具体用法?Python Feature.transform怎么用?Python Feature.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feature.Feature
的用法示例。
在下文中一共展示了Feature.transform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import transform [as 别名]
def main():
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
root = Feature('root')
featureList = np.array([])
for i in range(len(X[0])):
feature = Feature('feature_%d' % i)
root.transform('init', feature)
featureList = np.append(featureList, feature)
model = PCA(n_components=1)
model.fit(X)
doWithPCA(model, featureList)
root.printTree()
示例2: main
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import transform [as 别名]
def main():
X = [[1, 2], [2, 3]]
root = Feature('root')
featureList = np.array([])
for i in range(len(X[0])):
feature = Feature('feature_%d' % i)
root.transform('init', feature)
featureList = np.append(featureList, feature)
model = OneHotEncoder(n_values=[5,8], sparse=True)
model.fit(X)
doWithOneHotEncoder(model, featureList)
root.printTree()
示例3: main
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import transform [as 别名]
def main():
from sklearn.feature_selection import VarianceThreshold
X = [[0, 2, 0, 3], [0, 1, 4, 3], [0, 1, 1, 3]]
root = Feature('root')
featureList = np.array([])
for i in range(len(X[0])):
feature = Feature('feature_%d' % i)
root.transform('init', feature)
featureList = np.append(featureList, feature)
model = VarianceThreshold()
model.fit(X)
doWithSelector(model, featureList)
root.printTree()
示例4: initRoot
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import transform [as 别名]
def initRoot(featureNameList):
root = Feature('root')
for featureName in featureNameList:
newFeature = Feature(featureName)
root.transform('init', newFeature)
return root