frankenstein91 / sonnenbatterie-ki Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Currently, learning is done with the existing data, but you can't continue to improve the AI later.
I think we should change that.
Since it is easier for humans to compare values than an interpretation of the Loss value, a single prediction should be started after training and saved to a CSV. The output dir is already created in 4e99c46
when running measurements_model.fit(train_measurements, epochs=100, batch_size=1, verbose=2, validation_split=0.2, callbacks=[measurements_model_checkpoint_callback, measurements_model_earlystopping_callback])
we get this error
% python ./solarKI-train.py
Measurements:
count mean std min 25% 50% 75% max
production 1662.0 799.126955 1182.978117 0.0 0.0 128.5 1113.75 4472.0
consumption 1662.0 458.116727 552.151204 96.0 240.0 358.0 504.75 7705.0
battery_charge 1662.0 169.667268 383.778746 0.0 0.0 5.0 53.00 2071.0
battery_discharge 1662.0 130.580024 175.052748 0.0 0.0 56.0 200.00 1717.0
grid_feedin 1662.0 432.141998 817.662773 0.0 0.0 0.0 443.00 3657.0
grid_consumption 1662.0 130.219013 411.663270 0.0 0.0 31.0 84.00 7227.0
battery_state_of_charge 1662.0 43.147413 34.329361 0.0 4.0 44.0 70.00 100.0
direct_consumption 1662.0 228.770156 336.913024 0.0 0.0 126.5 379.00 4068.0
Statistics:
count mean std min 25% 50% 75% max
produced_energy 208.0 19178.134615 11107.263080 649.0 7814.5 21813.5 29311.25 35171.0
consumed_energy 208.0 10987.937500 5427.975153 5669.0 8656.5 9616.0 10806.75 37079.0
battery_charged_energy 208.0 4070.625000 2030.822482 363.0 2837.5 4185.0 5563.00 9969.0
battery_discharged_energy 208.0 3129.774038 1613.599089 0.0 2332.5 3161.5 4166.50 9060.0
grid_feedin_energy 208.0 10529.706731 9016.965193 0.0 198.5 11014.0 18887.75 27601.0
grid_purchase_energy 208.0 3280.375000 5045.327483 305.0 414.0 559.0 4120.50 33850.0
Measurements:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1662 entries, 0 to 1661
Data columns (total 9 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 timestamp 1662 non-null object
1 production 1662 non-null int64
2 consumption 1662 non-null int64
3 battery_charge 1662 non-null int64
4 battery_discharge 1662 non-null int64
5 grid_feedin 1662 non-null float64
6 grid_consumption 1662 non-null float64
7 battery_state_of_charge 1662 non-null int64
8 direct_consumption 1662 non-null int64
dtypes: float64(2), int64(6), object(1)
memory usage: 117.0+ KB
None
Statistics:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 208 entries, 0 to 207
Data columns (total 7 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 timestamp 208 non-null object
1 produced_energy 208 non-null int64
2 consumed_energy 208 non-null int64
3 battery_charged_energy 208 non-null int64
4 battery_discharged_energy 208 non-null int64
5 grid_feedin_energy 208 non-null int64
6 grid_purchase_energy 208 non-null int64
dtypes: int64(6), object(1)
memory usage: 11.5+ KB
None
Train measurements:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1329 entries, 0 to 1328
Data columns (total 9 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 timestamp 1329 non-null object
1 production 1329 non-null int64
2 consumption 1329 non-null int64
3 battery_charge 1329 non-null int64
4 battery_discharge 1329 non-null int64
5 grid_feedin 1329 non-null float64
6 grid_consumption 1329 non-null float64
7 battery_state_of_charge 1329 non-null int64
8 direct_consumption 1329 non-null int64
dtypes: float64(2), int64(6), object(1)
memory usage: 93.6+ KB
None
Test measurements:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 333 entries, 1329 to 1661
Data columns (total 9 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 timestamp 333 non-null object
1 production 333 non-null int64
2 consumption 333 non-null int64
3 battery_charge 333 non-null int64
4 battery_discharge 333 non-null int64
5 grid_feedin 333 non-null float64
6 grid_consumption 333 non-null float64
7 battery_state_of_charge 333 non-null int64
8 direct_consumption 333 non-null int64
dtypes: float64(2), int64(6), object(1)
memory usage: 23.5+ KB
None
Train statistics:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 166 entries, 0 to 165
Data columns (total 7 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 timestamp 166 non-null object
1 produced_energy 166 non-null int64
2 consumed_energy 166 non-null int64
3 battery_charged_energy 166 non-null int64
4 battery_discharged_energy 166 non-null int64
5 grid_feedin_energy 166 non-null int64
6 grid_purchase_energy 166 non-null int64
dtypes: int64(6), object(1)
memory usage: 9.2+ KB
None
Test statistics:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 42 entries, 166 to 207
Data columns (total 7 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 timestamp 42 non-null object
1 produced_energy 42 non-null int64
2 consumed_energy 42 non-null int64
3 battery_charged_energy 42 non-null int64
4 battery_discharged_energy 42 non-null int64
5 grid_feedin_energy 42 non-null int64
6 grid_purchase_energy 42 non-null int64
dtypes: int64(6), object(1)
memory usage: 2.4+ KB
None
2022-07-29 23:56:49.969541: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1126 MB memory: -> device: 0, name: NVIDIA GeForce GTX 960, pci bus id: 0000:03:00.0, compute capability: 5.2
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
Input (LSTM) (None, 1, 128) 70144
_________________________________________________________________
lstm (LSTM) (None, 1, 128) 131584
_________________________________________________________________
lstm_1 (LSTM) (None, 1, 64) 49408
_________________________________________________________________
lstm_2 (LSTM) (None, 1, 64) 33024
_________________________________________________________________
Output (Dense) (None, 1, 8) 520
=================================================================
Total params: 284,680
Trainable params: 284,680
Non-trainable params: 0
_________________________________________________________________
None
Model: "sequential_1"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
Input (LSTM) (None, 1, 128) 69120
_________________________________________________________________
lstm_3 (LSTM) (None, 1, 128) 131584
_________________________________________________________________
lstm_4 (LSTM) (None, 1, 64) 49408
_________________________________________________________________
lstm_5 (LSTM) (None, 1, 64) 33024
_________________________________________________________________
Output (Dense) (None, 1, 6) 390
=================================================================
Total params: 283,526
Trainable params: 283,526
Non-trainable params: 0
_________________________________________________________________
None
Traceback (most recent call last):
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py", line 102, in normalize_element
spec = type_spec_from_value(t, use_fallback=False)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py", line 485, in type_spec_from_value
raise TypeError("Could not build a `TypeSpec` for {} with type {}".format(
TypeError: Could not build a `TypeSpec` for timestamp production consumption battery_charge battery_discharge grid_feedin grid_consumption battery_state_of_charge direct_consumption
0 2022-01-01 00:00:00+01:00 0 749 5 0 0.0 754.0 0 0
1 2022-01-01 03:00:00+01:00 0 200 26 0 0.0 226.0 0 0
2 2022-01-01 06:00:00+01:00 3 225 5 0 0.0 227.0 0 3
3 2022-01-01 09:00:00+01:00 129 582 23 0 0.0 476.0 0 129
4 2022-01-01 12:00:00+01:00 178 757 26 0 0.0 605.0 0 178
... ... ... ... ... ... ... ... ... ...
1058 2022-05-13 06:00:00+02:00 806 242 4 11 571.0 0.0 31 242
1059 2022-05-13 09:00:00+02:00 2886 574 23 7 2296.0 0.0 29 574
1060 2022-05-13 12:00:00+02:00 3681 400 1486 0 1795.0 0.0 58 400
1061 2022-05-13 15:00:00+02:00 2397 347 18 14 2046.0 0.0 100 347
1062 2022-05-13 18:00:00+02:00 400 455 18 207 134.0 0.0 98 400
[1063 rows x 9 columns] with type DataFrame
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/GitHub/User/GitFolder/ProjectFolder/./solarKI-train.py", line 125, in <module>
main()
File "/GitHub/User/GitFolder/ProjectFolder/./solarKI-train.py", line 122, in main
measurements_model.fit(train_measurements, train_measurements, epochs=100, batch_size=1, verbose=2, validation_split=0.2, callbacks=[measurements_model_checkpoint_callback, measurements_model_earlystopping_callback])
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/keras/engine/training.py", line 1139, in fit
data_handler = data_adapter.get_data_handler(
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 1394, in get_data_handler
return DataHandler(*args, **kwargs)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 1149, in __init__
self._adapter = adapter_cls(
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 335, in __init__
dataset = self.slice_inputs(indices_dataset, inputs)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 361, in slice_inputs
dataset_ops.DatasetV2.from_tensors(inputs).repeat()
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 729, in from_tensors
return TensorDataset(tensors, name=name)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 4531, in __init__
element = structure.normalize_element(element)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py", line 107, in normalize_element
ops.convert_to_tensor(t, name="component_%d" % i))
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/profiler/trace.py", line 183, in wrapped
return func(*args, **kwargs)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/framework/ops.py", line 1640, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 343, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 267, in constant
return _constant_impl(value, dtype, shape, name, verify_shape=False,
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 279, in _constant_impl
return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 304, in _constant_eager_impl
t = convert_to_eager_tensor(value, ctx, dtype)
File "/GitHub/User/GitFolder/ProjectFolder/KiPython/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 102, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name, dtype)
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type datetime.datetime).
python ./solarKI-train.py 6,96s user 4,56s system 173% cpu 6,625 total
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.