passagem de argumentos do método train pelo método apply

This commit is contained in:
matheus_cascalho 2020-12-07 15:33:35 -03:00
parent 3dd08a9937
commit 27b55b1fde

View File

@ -38,7 +38,7 @@ class SOMTransformation(Transformation):
col != endogen_variable] col != endogen_variable]
if self.net is None: if self.net is None:
train = data[cols] train = data[cols]
self.train(data=train) self.train(data=train, **kwargs)
new_data = self.net.project(data[cols].values) new_data = self.net.project(data[cols].values)
new_data = pd.DataFrame(new_data, columns=names) new_data = pd.DataFrame(new_data, columns=names)
endogen = endogen_variable if endogen_variable is not None else data.columns[-1] endogen = endogen_variable if endogen_variable is not None else data.columns[-1]
@ -88,4 +88,5 @@ if __name__ == '__main__':
file = '/home/matheus_cascalho/Documentos/matheus_cascalho/MINDS/TimeSeries_Lab/SOM/Appliance Energy Prediction/energydata_complete.csv' file = '/home/matheus_cascalho/Documentos/matheus_cascalho/MINDS/TimeSeries_Lab/SOM/Appliance Energy Prediction/energydata_complete.csv'
df = pd.read_csv(file, index_col=0) df = pd.read_csv(file, index_col=0)
som = SOMTransformation(grid_dimension=(20, 20)) som = SOMTransformation(grid_dimension=(20, 20))
new_df = som.apply(df.iloc[:50], endogen_variable='Appliances') new_df = som.apply(df.iloc[:50], endogen_variable='Appliances', epochs=100, leaning_rate=0.1)
print(new_df.head())