Example #1
0
    tf.config.experimental.set_memory_growth(physical_device, True)

warnings.filterwarnings('ignore')
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

#Parameters to select the LSTM architecture
days_forecast = 1
semana = 2
n_LSTM_hidden_layers = 2
n_cells = 200
n_features = 5

dataM = DataManager(path="data/", filter_items=["pm25", "temperature", "wind"])
station82_pm25 = dataM.get_pm25("84")
station82_t = dataM.get_temperature("82")
station82_w = dataM.get_wind("82")

n_size = 100
n_input_steps = 24 * 7 * semana
n_output_steps = 24 * 3
data_pm25 = np.copy(station82_pm25.CONCENTRATION.values)
data_t = np.copy(station82_t.Value.values)
data_w = np.copy(station82_w.Value.values)

ensembles_pm25 = dataM.generate_ensambles(data_pm25, 2.4, n_size)
ensembles_t = dataM.generate_ensambles(data_t, 0.5, n_size)
ensembles_w = dataM.generate_ensambles(data_w, 0.05, n_size)

file_name = "m_Weeks_" + str(semana) + "_hidden_" + str(
    n_LSTM_hidden_layers) + "_cells_" + str(
Example #2
0
mls = CnnMeteo(n_input_steps,
               n_features,
               n_output_steps,
               drop=True,
               n_LSTM_hidden_layers=n_LSTM_hidden_layers,
               n_cells=n_cells)
csv_writer_1 = CsvWriter()
csv_writer_2 = CsvWriter()
csv_writer_3 = CsvWriter()

for j in range(days_forecast):
    for station in range(len(stations_SIATA)):

        print(stations_SIATA[station])
        station_pm25 = dataM.get_pm25(stations_SIATA[station])
        station_t = dataM.get_temperature(stations_Meteo[station])
        station_w = dataM.get_wind(stations_Meteo[station])
        number_samples = min(len(station_t.Value.values),
                             len(station_pm25.CONCENTRATION.values))
        station_pm25 = station_pm25[0:number_samples]
        station_t = station_t[0:number_samples]
        station_w = station_w[0:number_samples]
        pre_processor = Combiner()
        X, y = pre_processor.combine(
            n_input_steps, n_output_steps, station_t.Value.values,
            station_w.Value.values, station_pm25.CONCENTRATION.values,
            station_t.Date.dt.dayofweek.values, station_t.Date.dt.hour.values,
            station_pm25.CONCENTRATION.values)

        # Create Model
        n_train = 9500 + 527 + 72
Example #3
0
param = int(sys.argv[1])
print(param)
# Comment to run with GPU o Select CPU

physical_devices = tf.config.experimental.list_physical_devices('GPU')
for physical_device in physical_devices:
    tf.config.experimental.set_memory_growth(physical_device, True)

warnings.filterwarnings('ignore')
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

dataM = DataManager(path="data/", filter_items=["pm25", "temperature", "wind"])
station82_pm25 = dataM.get_pm25("82")
station82_t = dataM.get_temperature("271")
station82_w = dataM.get_wind("271")
weeks = 2
n_input_steps = 24 * 7 * weeks
data = station82_pm25.CONCENTRATION.values[:n_input_steps]
n_size = data.size
ensembles = dataM.generate_ensambles(data, 2.4, 100)
cov1 = dataM.calculate_cov(ensembles)
cov2 = dataM.calculate_cov2(ensembles)

##Make a 3D plot
fig = plt.figure()
ax = fig.gca(projection='3d')
x = np.linspace(-10, 10, n_size)
y = np.linspace(-10, 10, n_size)
X, Y = np.meshgrid(x, y)