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


Python SSUtilities.isNullable方法代码示例

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


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

示例1: runModels

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import isNullable [as 别名]
    def runModels(self):
        """Performs additional validation and populates the
        SSDataObject."""

        #### Shorthand Attributes ####
        ssdo = self.ssdo

        #### Create Dependent Variable ####
        self.y = ssdo.fields[self.dependentVar].returnDouble()
        self.n = ssdo.numObs
        self.y.shape = (self.n, 1)

        #### Assure that Variance is Larger than Zero ####
        yVar = NUM.var(self.y)
        if NUM.isnan(yVar) or yVar <= 0.0:
            ARCPY.AddIDMessage("Error", 906)
            raise SystemExit()

        #### Validate Chosen Number of Combos ####
        k = len(ssdo.fields)
        if self.maxIndVars > (k - 1):
            ARCPY.AddIDMessage("WARNING", 1171, self.maxIndVars)
            self.maxIndVars = k - 1
            ARCPY.AddIDMessage("WARNING", 1172, self.maxIndVars)

        #### Assure Degrees of Freedom ####
        withIntercept = self.maxIndVars + 1
        dof = self.n - withIntercept
        if dof <= 2:
            ARCPY.AddIDMessage("WARNING", 1128, 2)
            dofLimit = self.n - 4
            ARCPY.AddIDMessage("WARNING", 1419, dofLimit)
            self.maxIndVars = dofLimit

        if self.maxIndVars < 1:
            ARCPY.AddIDMessage("WARNING", 1173)

        #### Assure Min Vars is less than or equal to Max Vars ####
        if self.maxIndVars < self.minIndVars:
            ARCPY.AddIDMessage("WARNING", 1174)
            ARCPY.AddIDMessage("WARNING", 1175)
            self.minIndVars = self.maxIndVars

        #### Gen Range Combos ####
        rangeVars = range(1, k)
        rangeCombos = NUM.arange(self.minIndVars, self.maxIndVars+1)

        #### Create Base Design Matrix ####
        self.x = NUM.ones((self.n, k), dtype = float)
        for column, variable in enumerate(self.independentVars):
            self.x[:,column + 1] = ssdo.fields[variable].data

        #### Calculate Global VIF ####
        self.globalVifVals = COLL.defaultdict(float)
        if k > 2:
            #### Values Less Than One Were Forced by Psuedo-Inverse ####
            self.printVIF = True
        else:
            self.printVIF = False

        #### Create Output Table Info ####
        if self.outputTable:

            #### List of Results ####
            self.tableResults = []

            #### Valid Table Name and Type ####
            self.outputTable, dbf = UTILS.returnTableName(self.outputTable)
            outPath, outName = OS.path.split(self.outputTable)

            #### Set Field Names (Base) ####
            self.outFieldNames = UTILS.getFieldNames(erFieldNames, outPath)
            self.outFieldTypes = ["LONG", "DOUBLE", "DOUBLE", "DOUBLE",
                                  "DOUBLE", "DOUBLE", "DOUBLE", "LONG"]

            #### Add Field Names (Independent Vars as X#) ####
            maxRange = range(1, self.maxIndVars+1)
            self.outFieldNames += [ "X" + str(j) for j in maxRange ]
            self.outFieldTypes += ["TEXT"] * self.maxIndVars

            #### Calculate Max Text Length for Output Fields ####
            fieldLens = [ len(i) for i in self.independentVars ]
            self.maxFieldLen = max(fieldLens) + 5
            tableReportCount = 0

            #### Set NULL Values and Flag to Reset Table Name ####
            isNullable = UTILS.isNullable(self.outputTable)
            if isNullable:
                self.nullValue = NUM.nan
            else:
                self.nullValue = UTILS.shpFileNull["DOUBLE"]
            self.dbf = dbf

        #### Create Output Report File ####
        if self.outputReportFile:
            fo = UTILS.openFile(self.outputReportFile, "w")

        #### Hold Results for Every Choose Combo ####
        self.resultDict = {}
        self.vifVarCount = COLL.defaultdict(int)
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:ExploratoryRegression.py


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