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


Python SSUtilities.writeText方法代码示例

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


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

示例1: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import writeText [as 别名]
    def report(self, fileName = None):
        """Generate Text and Graphical Output."""

        if fileName:
            f = UTILS.openFile(fileName, "w")
            UTILS.writeText(f, "{0}\n".format(self.coefTable))
            UTILS.writeText(f, "{0}\n".format(self.diagTable))
            UTILS.writeText(f, "{0}".format(self.interpretTable))
            f.close()
        else:
            ARCPY.AddMessage(self.coefTable)
            ARCPY.AddMessage(self.diagTable)
            ARCPY.AddMessage(self.interpretTable)

            #### Report if Bad Probabilities Found ####
            if self.badProbs:
                ARCPY.AddIDMessage("WARNING", 738)
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:19,代码来源:OLS.py

示例2: runModels

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import writeText [as 别名]

#.........这里部分代码省略.........
            #### Loop Through All Combinations ####
            modelCount = 0
            emptyTabValues = [""] * ( self.maxIndVars - choose )
            perfectMultiModels = []
            for combo in comboGenerator:
                #### Create Design Matrix for Given Combination ####
                columns = [0] + list(combo)
                comboX = self.x[0:,columns]

                #### Get Model Info for given Combination ####
                N, K = comboX.shape
                varNameList = [ self.independentVars[j-1] for j in combo ]
                varNameListInt = ["Intercept"] + varNameList
                modelAll = self.dependentVar + " ~ "
                modelAll += " + ".join(varNameListInt)
                modelID = str(K) + ":" + str(modelCount)

                #### Run Linear Regression ####
                runModel = self.calculate(comboX)

                #### Set Near/Perfect Multicoll Bool ####
                nearPerfectBool = False
                if K > 2 and runModel:
                    nearPerfectBool = NUM.any(abs(self.vifVal) >= 1000)

                if (not runModel) or nearPerfectBool:
                    #### Perfect Multicollinearity ####
                    #### Unable to Invert the Matrix ####
                    perfectMultiModels.append(modelAll)

                else:
                    #### Keep Track of Total Number of Models Ran ####
                    modelCount += 1
                    self.sumRuns += 1
                    residuals = self.residuals.flatten()

                    #### Evaluate p-values ####
                    if self.BPProb < .1:
                        #### Use Robust Coefficients ####
                        pValsOut = self.pValsRob[1:]
                    else:
                        pValsOut = self.pVals[1:]
                    coefOut = self.coef[1:]

                    #### Process Largest VIF Values ####
                    if K > 2:
                        for ind, varName in enumerate(varNameList):
                            vif = self.vifVal[ind]
                            previousVIF = self.globalVifVals[varName]
                            if vif > previousVIF:
                                self.globalVifVals[varName] = vif

                    #### Set OLS Result ####
                    res = OLSResult(modelID, varNameList, coefOut, pValsOut,
                                    self.vifVal, self.r2Adj, self.aicc,
                                    self.JBProb, self.BPProb,
                                    allMIPass = self.allMIPass)

                    #### Evaluate Jarque-Bera Stat ####
                    keep = self.pushPopJB(res, self.residuals.flatten())

                    boolReport = rh.evaluateResult(res, residuals, keep = keep)
                    r2Bool, pvBool, vifBool, jbBool, giBool, keepBool = boolReport

                    #### Add Booleans for End Total Summary ####
                    boolResult = [r2Bool, pvBool, vifBool, jbBool]
                    self.boolResults += boolResult

                    #### Delete OLS Instance if Not Necessary For Summary ####
                    if not keepBool:
                        del res


            #### Run Moran's I for Highest Adj. R2 ####
            r2ResultList = rh.runR2Moran()
            self.neighborWarn = True

            #### Add Results to Report File ####
            result2Print = rh.report()
            UTILS.writeText(fo, result2Print)
            if len(perfectMultiModels):
                self.perfectMultiWarnBool = True
                ARCPY.AddIDMessage("WARNING", 1304)
                for modelStr in perfectMultiModels:
                    ARCPY.AddIDMessage("WARNING", 1176, modelStr)

            #### Add Choose Run to Result Dictionary ####
            self.resultDict[choose] = rh

        #### Run Moran's I on Best Jarque-Bera ####
        self.createJBReport()

        #### Final Moran Stats ####
        self.getMoranStats()

        #### Ending Summary ####
        self.endSummary()

        UTILS.writeText(fo, self.fullReport)
        fo.close()
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:104,代码来源:ModelSelectionOLS.py


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