def countInconsistencyFromFile(path, reduceData=False): data=Loader.loadExtensionSensitive(path) if (reduceData): data = Loader.reduceRepetitions(data) inconsistencyCounter=countInconsistency(data) inconsistencyRatio = float(inconsistencyCounter)/len(data) return inconsistencyCounter, inconsistencyRatio
def loadAndCount(pathToFile, reduceData=False): loadedData = Loader.loadExtensionSensitive(pathToFile) if reduceData: loadedData = Loader.reduceRepetitions(loadedData) rows = len(loadedData) cols = len(loadedData[0]) fields = rows*cols dicts=countOccurency(loadedData) pDicts = countProbabilities(dicts) eDicts = countEntropyOfDicts(pDicts) sumEnt, meanEnt = countEntropyInData(eDicts) metricEnt = sumEnt/(float)(rows) bitsToSaveData = sumEnt*(float)(rows) numberOfInstances = len(loadedData) valuesOfAtts,importantAtts = countValuesOfAttributes(dicts) return (sumEnt,meanEnt,metricEnt,bitsToSaveData,numberOfInstances,valuesOfAtts,importantAtts)