当前位置: 首页>>代码示例>>Python>>正文


Python DataSet.import_split方法代码示例

本文整理汇总了Python中dataset.DataSet.import_split方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.import_split方法的具体用法?Python DataSet.import_split怎么用?Python DataSet.import_split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dataset.DataSet的用法示例。


在下文中一共展示了DataSet.import_split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Root

# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import import_split [as 别名]

#.........这里部分代码省略.........
        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'])



    """
    Experimental Function to test new features.
    """

    def exp_nbn_best(self):
        if self.loaded & self.split:
            result,string = nbn.imp_topten(data,self.configFIUse,self.configFI)
            self._output_last(string)
        else:
            if self.loaded is False:
                self.feedback("Please load a dataset.")
            elif self.split is False:
                self.feedback("Please split the data set into training and validation sets.")


    """
    Experimental Function to test new features.
    """

    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']))


    """

    FUTURE EXTENSIONS:
开发者ID:Dismeth,项目名称:gui,代码行数:70,代码来源:main.py


注:本文中的dataset.DataSet.import_split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。