本文整理汇总了Python中dataset.DataSet.labelencode方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.labelencode方法的具体用法?Python DataSet.labelencode怎么用?Python DataSet.labelencode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.DataSet
的用法示例。
在下文中一共展示了DataSet.labelencode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exp_
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import labelencode [as 别名]
def exp_(self):
#"""
data = DataSet()
self.quick = DataSet()
data.dataimport("D:\Dropbox\St Andrews\IT\IS5189 MSc Thesis\\02 Data\InnoCentive_Challenge_9933493_training_data.csv")
data.labelencode(columns=self.configLE)
xtest, xtrain, ytest, ytrain = data.split(quick=True)
self.quick.import_split(xtest, xtrain, ytest, ytrain)
self.output_str("10 percent of original dataset loaded (into train. Testset is 90 percent).")
rows_train = len(xtrain)
self.feedback("Challenge data loaded. self.quick init with " + str(rows_train) + " rows.")
correlation_list, descstats = self.quick.correlation()
self._output_last(correlation_list)
#print(test)
#a = test.sort_values(by='Correlation', ascending=True).head(20)
#b = test.sort_values(by='Correlation',ascending=False).head(20)
#print(a)
#print(b)
#print(descstats)
#self.quick.descstats()
#"""
#Clock.schedule_once(lambda dt: self.feedback("this is good"), -1)
#descstats = data.descstats(self.configLE)
############################################################
# df is short for DataFrame , to make it more readable when manipulating the Pandas DataFrame.
# Might be easier (and is shorter) to read by developers as an in house var name.
threshold = 0.7
df = correlation_list[correlation_list['Correlation'] > threshold]
df = df.sort_values(by='Correlation',ascending=False)
column_a_b = df['Var1']
column_a_b = column_a_b.append(df['Var2'])
print(df[df['Var1'] == 'C31'])
print(column_a_b.value_counts())
#print(df.head(10))
print(pd.crosstab(df['Var1'], df['Var2']))
示例2: load
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import labelencode [as 别名]
def load():
data = DataSet()
data.dprint("Import data.")
data.dataimport("D:\Dropbox\St Andrews\IT\IS5189 MSc Thesis\\02 Data\InnoCentive_Challenge_9933493_training_data.csv")
data.dprint("Label Encode.")
data.labelencode(columns=categorical_columns)
data.dprint("Split data. Test set size: " + str(test_set_size))
data.split(target_column_name=target_value, test_set_size=test_set_size,random_state_is=True)
return data
示例3: exp_quick_load
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import labelencode [as 别名]
def exp_quick_load(self):
self.output_str("Import.")
global data
data = DataSet()
data.dataimport("D:\Dropbox\St Andrews\IT\IS5189 MSc Thesis\\02 Data\InnoCentive_Challenge_9933493_training_data.csv")
self.loaded = True
self.output_str("Label Encode.")
data.labelencode(columns=self.configLE)
self.output_str("Split (quick = True).")
data.split(target_column_name=self.configCV['target_value'], test_set_size=self.configCV['test_set_size'],
seed=self.configCV['seed'], random_state_is=self.configCV['random_state_is'],quick=True)
self.update_overview(trainrows=len(data.X_train), testrows=len(data.X_test),
ncols=len(data.X_train.columns.values))
self.output_str("Function 'exp_quick_load()' finished running.")
data.descstats(self.configLE,write=True,workdir=self.configGeneral['workdir'])