-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
56 lines (42 loc) · 1.46 KB
/
Copy pathmain.py
File metadata and controls
56 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
##############################################
# DO NOT MODIFY THE SIMULATE FUNCTION
##############################################
from model import generative_model
import numpy as np
import logging
logging.basicConfig(filename="check.log", level=logging.DEBUG,
format="%(asctime)s:%(levelname)s: %(message)s",
filemode='w')
def simulate(noise, scenario):
"""
Simulation of your Generative Model
Parameters
----------
noise : ndarray
input of the generative model
scenario:ndarray
conditional variable (one-hot encoder)
Returns
-------
output: array (noise.shape[0], 4)
Generated yield containing respectively the 4 stations (49, 80, 40, 63)
"""
try:
output = generative_model(noise, scenario)
message = "Successful simulation"
assert output.shape == (
noise.shape[0], 4), "Shape error, it must be (noise.shape[0], 4). Please verify the shape of the output."
# write the output
np.save("output.npy", output)
except Exception as e:
message = e
finally:
logging.debug(message)
return output
if __name__ == "__main__":
SCENARIO_NUMBER = 1 # <- PICK A SCENARIO NUMBER BETWEEN 1 AND 9
noise = np.load("data/noise.npy")
# create a vector of zeros with shape (n_samples, 9)
scenario = np.zeros((noise.shape[0], 9))
scenario[:, SCENARIO_NUMBER-1] = 1
simulate(noise, scenario)