def normalizeDataSet(self): #ahora transformamos el set de datos por si existen elementos discretos... encoding = encodingFeatures.encodingFeatures(self.dataSet, 20) encoding.evaluEncoderKind() dataSetNewFreq = encoding.dataSet dataSetNorm = "" #ahora aplicamos el procesamiento segun lo expuesto if self.optionNormalize == 1: #normal scale applyNormal = ScaleNormalScore.applyNormalScale(dataSetNewFreq) dataSetNorm = applyNormal.dataTransform if self.optionNormalize == 2: #min max scaler applyMinMax = ScaleMinMax.applyMinMaxScaler(dataSetNewFreq) dataSetNorm = applyMinMax.dataTransform if self.optionNormalize == 3: #log scale applyLog = ScaleDataSetLog.applyLogScale(dataSetNewFreq) dataSetNorm = applyLog.dataTransform if self.optionNormalize == 4: #log normal scale applyLogNormal = ScaleLogNormalScore.applyLogNormalScale( dataSetNewFreq) dataSetNorm = applyLogNormal.dataTransform return dataSetNorm
def processDataSet(self, dataSetInput): #ahora transformamos el set de datos por si existen elementos discretos... #transformDataSet = transformFrequence.frequenceData(dataSetInput) #dataSetNewFreq = transformDataSet.dataTransform encoding = encodingFeatures.encodingFeatures(dataSetInput, 20) encoding.evaluEncoderKind() dataSetNewFreq = encoding.dataSet #ahora aplicamos el procesamiento segun lo expuesto if self.optionNormalize == 1: #normal scale applyNormal = ScaleNormalScore.applyNormalScale(dataSetNewFreq) self.dataSet = applyNormal.dataTransform if self.optionNormalize == 2: #min max scaler applyMinMax = ScaleMinMax.applyMinMaxScaler(dataSetNewFreq) self.dataSet = applyMinMax.dataTransform if self.optionNormalize == 3: #log scale applyLog = ScaleDataSetLog.applyLogScale(dataSetNewFreq) self.dataSet = applyLog.dataTransform if self.optionNormalize == 4: #log normal scale applyLogNormal = ScaleLogNormalScore.applyLogNormalScale( dataSetNewFreq) self.dataSet = applyLogNormal.dataTransform
def createDataSet(self): targetResponse = self.dataSet[self.featureClass] dictData = {} for key in self.dataSet: if key != self.featureClass: arrayFeature = [] for i in self.dataSet[key]: arrayFeature.append(i) dictData.update({key: arrayFeature}) #formamos el nuevo set de datos... dataSetNew = pd.DataFrame(dictData) #ahora evaluamos si la clase tiene valores discretos o continuos y los modificamos en caso de que sean discretos transformData = transformDataClass.transformClass(targetResponse) self.target = transformData.transformData self.dictTransform = transformData.dictTransform #formamos el class array... self.classArray = list(set(self.target)) #ahora transformamos el set de datos por si existen elementos discretos... #transformDataSet = transformFrequence.frequenceData(dataSetNew) encoding = encodingFeatures.encodingFeatures(dataSetNew, self.treshold) encoding.evaluEncoderKind() dataSetNewFreq = encoding.dataSet #ahora aplicamos el procesamiento segun lo expuesto if self.optionNormalize == 1: #normal scale applyNormal = ScaleNormalScore.applyNormalScale(dataSetNewFreq) self.data = applyNormal.dataTransform elif self.optionNormalize == 2: #min max scaler applyMinMax = ScaleMinMax.applyMinMaxScaler(dataSetNewFreq) self.data = applyMinMax.dataTransform elif self.optionNormalize == 3: #log scale applyLog = ScaleDataSetLog.applyLogScale(dataSetNewFreq) self.data = applyLog.dataTransform else: #log normal scale applyLogNormal = ScaleLogNormalScore.applyLogNormalScale( dataSetNewFreq) self.data = applyLogNormal.dataTransform
target=dataSet[x]#clases y=columnas[0:len(columnas)-1] data=dataSet[y]#atributos #transformamos la clase si presenta atributos discretos transformData = transformDataClass.transformClass(target) target = transformData.transformData #ahora transformamos el set de datos por si existen elementos discretos... #transformDataSet = transformFrequence.frequenceData(data) #dataSetNewFreq = transformDataSet.dataTransform encoding = encodingFeatures.encodingFeatures(data, 20) encoding.evaluEncoderKind() dataSetNewFreq = encoding.dataSet #ahora aplicamos el procesamiento segun lo expuesto applyNormal = ScaleNormalScore.applyNormalScale(dataSetNewFreq) data = applyNormal.dataTransform #generamos una lista con los valores obtenidos... header = ["Algorithm", "Params", "R_Score", "Pearson", "Spearman", "Kendalltau"] matrixResponse = [] #comenzamos con las ejecuciones... #AdaBoost for loss in ['linear', 'square', 'exponential']: for n_estimators in [10,50,100,200,500,1000,1500,2000]: try: print "Excec AdaBoostRegressor with %s - %d" % (loss, n_estimators) AdaBoostObject = AdaBoost.AdaBoost(data, target, n_estimators, loss) AdaBoostObject.trainingMethod()