diff --git a/pywatts/db.py b/pywatts/db.py index 88af8f7..b877125 100644 --- a/pywatts/db.py +++ b/pywatts/db.py @@ -34,21 +34,14 @@ class Result(Model): def rows_to_df(indices): - temps = [] dcs = [] - winds = [] db.connect() for result in Result.select().where(Result.id << indices): - temps += result.temperature dcs += result.dc_output - winds += result.wind_speed db.close() return pd.DataFrame( - {'temp': temps, - 'dc': dcs, - 'wind': winds - }) + {'dc': dcs}) diff --git a/pywatts/eval_training.py b/pywatts/eval_training.py index ab95090..439b3bf 100644 --- a/pywatts/eval_training.py +++ b/pywatts/eval_training.py @@ -4,13 +4,13 @@ from pywatts.routines import * from pywatts import kcross NUM_STATIONS_FROM_DB = 75 -K = 2 +K = 10 NUM_EVAL_STATIONS = 40 TRAIN = True PLOT = True -TRAIN_STEPS = 1 -TOTAL_STEPS = 2 -NUM_QUERIES = 1 +TRAIN_STEPS = 10 +TOTAL_STEPS = 6 +NUM_QUERIES = 5 PREDICT_QUERY = "query-sample_24hour.json" PREDICT_RESULT = PREDICT_QUERY.replace("query", "result") FIGURE_OUTPUT_DIR = "../figures/" diff --git a/pywatts/neural.py b/pywatts/neural.py index 1304b8f..e6e42b3 100644 --- a/pywatts/neural.py +++ b/pywatts/neural.py @@ -30,11 +30,11 @@ def pywatts_input_fn(X, y=None, num_epochs=None, shuffle=True, batch_size=1): class Net: __regressor = None - __feature_cols = [tf.feature_column.numeric_column(col) for col in ['dc', 'temp', 'wind']] + __feature_cols = [tf.feature_column.numeric_column(col) for col in ['dc']] def __init__(self, feature_cols=__feature_cols): self.__regressor = tf.estimator.DNNRegressor(feature_columns=feature_cols, - hidden_units=[128, 512, 128], + hidden_units=[64, 128, 64], model_dir='tf_pywatts_model') def train(self, training_data, training_results, batch_size, steps): diff --git a/pywatts/photovoltaic_gruppe1.py b/pywatts/photovoltaic_gruppe4.py similarity index 90% rename from pywatts/photovoltaic_gruppe1.py rename to pywatts/photovoltaic_gruppe4.py index 3889f6c..2378d7c 100644 --- a/pywatts/photovoltaic_gruppe1.py +++ b/pywatts/photovoltaic_gruppe4.py @@ -10,7 +10,7 @@ from pywatts.routines import * os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' if len(sys.argv) != 2: - print("Usage: python photovoltaic_gruppe1.py ") + print("Usage: python photovoltaic_gruppe4.py ") exit(1) json_file = sys.argv[1] # json file diff --git a/pywatts/routines.py b/pywatts/routines.py index 54e3beb..e500cd7 100644 --- a/pywatts/routines.py +++ b/pywatts/routines.py @@ -9,7 +9,7 @@ from random import randint def train_split(data, size): used_idxs = [] - X_values = {'dc': [], 'temp': [], 'wind': []} + X_values = {'dc': []} y_values = [] for i in range(size): rnd_idx = randint(0, data.size / data.shape[1] - 337) @@ -20,8 +20,6 @@ def train_split(data, size): used_idxs.append(rnd_idx) X_values['dc'].extend(data['dc'][rnd_idx:rnd_idx + 336].tolist()) - X_values['temp'].extend(data['temp'][rnd_idx:rnd_idx + 336].tolist()) - X_values['wind'].extend(data['wind'][rnd_idx:rnd_idx + 336].tolist()) y_values.append(data['dc'][rnd_idx + 337].tolist()) return pandas.DataFrame.from_dict(X_values), pandas.DataFrame.from_dict({'dc': y_values}) @@ -31,9 +29,7 @@ def input_query(json_str, idx=0): tmp_df = pandas.read_json(json_str) return pandas.DataFrame.from_dict( - {'dc': tmp_df['dc'][idx], - 'temp': tmp_df['temp'][idx], - 'wind': tmp_df['wind'][idx]} + {'dc': tmp_df['dc'][idx]} ) def input_queries(json_str): @@ -48,9 +44,7 @@ def input_queries(json_str): queries = [] for i in range(len(tmp_df)): queries.append(pandas.DataFrame.from_dict( - {'dc': tmp_df['dc'][i], - 'temp': tmp_df['temp'][i], - 'wind': tmp_df['wind'][i]} + {'dc': tmp_df['dc'][i]} )) return oneH, queries @@ -85,7 +79,7 @@ def plot_training(evaluation): def predict(nn, X_pred): pred = nn.predict1h(X_pred) # Cap results to 0 - predictions = np.array([max(p['predictions'], 0) for p in pred]) + predictions = np.array([max(p['predictions'], [0]) for p in pred]) return predictions