本文整理汇总了Python中shogun.Features.StringCharFeatures.load方法的典型用法代码示例。如果您正苦于以下问题:Python StringCharFeatures.load方法的具体用法?Python StringCharFeatures.load怎么用?Python StringCharFeatures.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shogun.Features.StringCharFeatures
的用法示例。
在下文中一共展示了StringCharFeatures.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: features_string_file_modular
# 需要导入模块: from shogun.Features import StringCharFeatures [as 别名]
# 或者: from shogun.Features.StringCharFeatures import load [as 别名]
def features_string_file_modular(directory, fname):
from shogun.Features import StringCharFeatures, RAWBYTE
from shogun.IO import AsciiFile
# load features from directory
f=StringCharFeatures(RAWBYTE)
f.load_from_directory(directory)
#and output several stats
#print("max string length", f.get_max_vector_length())
#print("number of strings", f.get_num_vectors())
#print("length of first string", f.get_vector_length(0))
#print("str[0,0:3]", f.get_feature(0,0), f.get_feature(0,1), f.get_feature(0,2))
#print("len(str[0])", f.get_vector_length(0))
#print("str[0]", f.get_feature_vector(0))
#or load features from file (one string per line)
fil=AsciiFile(fname)
f.load(fil)
#print(f.get_features())
#or load fasta file
#f.load_fasta('fasta.fa')
#print(f.get_features())
return f.get_features(), f
示例2: file
# 需要导入模块: from shogun.Features import StringCharFeatures [as 别名]
# 或者: from shogun.Features.StringCharFeatures import load [as 别名]
from shogun.Features import StringCharFeatures, RAWBYTE
# load features from directory
f=StringCharFeatures(RAWBYTE)
f.load_from_directory(".")
#and output several stats
print "max string length", f.get_max_vector_length()
print "number of strings", f.get_num_vectors()
print "length of first string", f.get_vector_length(0)
print "str[0,0:3]", f.get_feature(0,0), f.get_feature(0,1), f.get_feature(0,2)
print "len(str[0])", f.get_vector_length(0)
print "str[0]", f.get_feature_vector(0)
#or load features from file (one string per line)
f.load('features_string_char_modular.py')
print f.get_features()
#or load fasta file
#f.load_fasta('fasta.fa')
#print f.get_features()