def prueba(): # create data_frame to input data = DataFrame() # create data_frame to output output = DataFrame() # create normalizer normalizer = Normalizer() data.load_data_set("breast-cancer-wisconsin-data.csv") data.drop_columns_by_name(["id"]) output.data_set = data.cut_column('diagnosis') data = data.data_set data.data_set = normalizer.normalize_data(data) data.join_data(output.data_set) rn = NeuralNetwork() kwargs = {"units": 2, "layers": 5, "activation": "sigmoid"} rn.create_model(kwargs) cv = KFoldCrossValidation(10, "diagnosis") cv.k_fold_validation(data, model=rn) cv.view_report()
def one_hot(self, data_set, column_tag): df = DataFrame() df.data_set = data_set data_list = df.get_all_values().tolist() dumies = self.dumies_tags(df, column_tag) dumies = self.biuld_dumies(data_list, dumies) return pd.DataFrame(dumies)
def one_hot2(self, data_set, column_tag): df = DataFrame() df.data_set = data_set data_list = df.get_all_values().tolist() dumies = self.dumies_tags_index(df, column_tag) for i in range(len(data_list)): data_list[i] = dumies[data_list[i][0]] dic = {str(column_tag): data_list} data = pd.DataFrame(dic) return data
def prueba2(): # create data_frame to input input = DataFrame() # create data_frame to output output = DataFrame() # create normalizer normalizer = Normalizer() cv = CategoricalValues() input.load_data_set("Churn_Modelling.csv") # drop innecesary columns in the input input.drop_columns_by_name(["RowNumber", "CustomerId", "Surname"]) output.data_set = input.cut_column('Exited') # normalizer data data = input.data_set input.data_set = normalizer.normalize_data(data) input.join_data(output.data_set) cv = KFoldCrossValidation(10, "Exited") cv.k_fold_validation(input) cv.view_report()
def load_folds(self, data_frame, k): from_index = 0 to_index = self.fold_size for i in range(k + 1): df = data_frame.sub_data_set(from_index, to_index) fold = DataFrame() fold.data_set = df self.folds += [fold] from_index += self.fold_size to_index += self.fold_size self.balance_last_fold(k)
help="Cantidad de neuronas por capa en la Red Neuronal") net_group.add_argument( "--funcion-activacion", type=str, default='relu', metavar='', help= 'Define la salida de los nodos en una Red Neuronal para un conjunto de entradas dado' ) normalizer = Normalizer() args = parser.parse_args() output = DataFrame() input = DataFrame() input.load_data_set("breast-cancer-wisconsin-data.csv") output.data_set = input.cut_column('diagnosis') input.drop_columns_by_name(['id']) data = input.data_set input.data_set = normalizer.normalize_data(data) input.join_data(output.data_set) validation = KFoldCrossValidation(10, 'diagnosis') if args.arbol: print("Arbol has been chosen") elif args.red_neuronal: model = NeuralNetwork() model.create_model( kwargs={ "layers": args.numero_capas, "units": args.unidades_por_capa,