Skip to content

Commit 3db06a8

Browse files
committed
updated built
1 parent bbcc8ff commit 3db06a8

File tree

12 files changed

+447
-108
lines changed

12 files changed

+447
-108
lines changed

Imbrium.egg-info/PKG-INFO

Lines changed: 336 additions & 64 deletions
Large diffs are not rendered by default.

build/lib/imbrium/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.1.3"
1+
__version__ = "0.1.4"
22

33
from imbrium import architectures
44
from imbrium import predictors

build/lib/imbrium/blueprints/abstract_multivariate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def fit_model(
7676
epochs: int,
7777
show_progress: int = 1,
7878
validation_split: float = 0.20,
79-
batch_size: int = 10):
79+
batch_size: int = 10,
80+
**callback_setting: dict):
8081
pass
8182

8283
@abstractmethod

build/lib/imbrium/blueprints/abstract_univariate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def fit_model(
6868
epochs: int,
6969
show_progress: int = 1,
7070
validation_split: float = 0.20,
71-
batch_size: int = 10):
71+
batch_size: int = 10,
72+
**callback_setting: dict):
7273
pass
7374

7475
@abstractmethod

build/lib/imbrium/predictors/multivarhybrid.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import tensorflow as tf
2020
from tensorflow import keras
21+
from tensorflow.keras.callbacks import EarlyStopping
2122
from tensorflow.keras.layers import (LSTM,
2223
Dense,
2324
Flatten,
@@ -90,8 +91,10 @@ class HybridMultStepMultVar(MultiVariateMultiStep):
9091
layer_config = {'layer0': (64, 1, 'relu'), 'layer1': (32, 1, 'relu'),
9192
'layer2': (2), 'layer3': (50, 'relu'), 'layer4': (25, 'relu')}):
9293
Builds CNN bidirectional GRU structure.
93-
fit_model(self, epochs: int, show_progress: int = 1):
94-
Fitting selected model to data provided.
94+
fit_model(self, epochs: int, show_progress: int = 1,
95+
validation_split: float = 0.20, batch_size: int = 10,
96+
**callback_setting: dict):
97+
Fitting model onto provided data.
9598
model_blueprint(self):
9699
Print blueprint of layer structure.
97100
show_performance(self):
@@ -568,21 +571,34 @@ def fit_model(
568571
epochs: int,
569572
show_progress: int = 1,
570573
validation_split: float = 0.20,
571-
batch_size: int = 10):
574+
batch_size: int = 10,
575+
**callback_setting: dict):
572576
'''Trains the model on data provided. Perfroms validation.
573577
Parameters:
574578
epochs (int): Number of epochs to train the model.
575579
show_progress (int): Prints training progress.
576580
validation_split (float): Determines size of Validation data.
577581
batch_size (int): Batch size of input data.
582+
callback_settings (dict): Create a Keras EarlyStopping object.
578583
'''
579-
self.details = self.model.fit(
580-
self.input_x,
581-
self.input_y,
582-
validation_split=0.20,
583-
batch_size=10,
584-
epochs=epochs,
585-
verbose=show_progress)
584+
if callback_setting == {}:
585+
self.details = self.model.fit(
586+
self.input_x,
587+
self.input_y,
588+
validation_split=validation_split,
589+
batch_size=batch_size,
590+
epochs=epochs,
591+
verbose=show_progress)
592+
else:
593+
callback = EarlyStopping(**callback_setting)
594+
self.details = self.model.fit(
595+
self.input_x,
596+
self.input_y,
597+
validation_split=validation_split,
598+
batch_size=batch_size,
599+
epochs=epochs,
600+
verbose=show_progress,
601+
callbacks=[callback])
586602
return self.details
587603

588604
def model_blueprint(self):

build/lib/imbrium/predictors/multivarstandard.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import tensorflow as tf
2020
from tensorflow import keras
21+
from tensorflow.keras.callbacks import EarlyStopping
2122
from tensorflow.keras.layers import (LSTM,
2223
Dense,
2324
Flatten,
@@ -116,7 +117,9 @@ class BasicMultStepMultVar(MultiVariateMultiStep):
116117
layer_config: dict = {'layer0': (64, 1, 'relu'), 'layer1': (32, 1, 'relu'),
117118
'layer2': (2), 'layer3': (50, 'relu'), 'layer4': (100, 'relu')}):
118119
Builds encoder decoder CNN structure.
119-
fit_model(self, epochs: int, show_progress: int = 1):
120+
fit_model(self, epochs: int, show_progress: int = 1,
121+
validation_split: float = 0.20, batch_size: int = 10,
122+
**callback_setting: dict):
120123
Fitting model onto provided data.
121124
model_blueprint(self):
122125
Print blueprint of layer structure.
@@ -766,19 +769,34 @@ def fit_model(
766769
epochs: int,
767770
show_progress: int = 1,
768771
validation_split: float = 0.20,
769-
batch_size: int = 10):
770-
'''Trains the model on data provided. Performs validation.
772+
batch_size: int = 10,
773+
**callback_setting: dict):
774+
'''Trains the model on data provided. Perfroms validation.
771775
Parameters:
772776
epochs (int): Number of epochs to train the model.
773777
show_progress (int): Prints training progress.
778+
validation_split (float): Determines size of Validation data.
779+
batch_size (int): Batch size of input data.
780+
callback_settings (dict): Create a Keras EarlyStopping object.
774781
'''
775-
self.details = self.model.fit(
776-
self.input_x,
777-
self.input_y,
778-
validation_split=validation_split,
779-
batch_size=batch_size,
780-
epochs=epochs,
781-
verbose=show_progress)
782+
if callback_setting == {}:
783+
self.details = self.model.fit(
784+
self.input_x,
785+
self.input_y,
786+
validation_split=validation_split,
787+
batch_size=batch_size,
788+
epochs=epochs,
789+
verbose=show_progress)
790+
else:
791+
callback = EarlyStopping(**callback_setting)
792+
self.details = self.model.fit(
793+
self.input_x,
794+
self.input_y,
795+
validation_split=validation_split,
796+
batch_size=batch_size,
797+
epochs=epochs,
798+
verbose=show_progress,
799+
callbacks=[callback])
782800
return self.details
783801

784802
def model_blueprint(self):

build/lib/imbrium/predictors/univarhybrid.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import tensorflow as tf
1818
from tensorflow import keras
19+
from tensorflow.keras.callbacks import EarlyStopping
1920
from tensorflow.keras.layers import (LSTM,
2021
Dense,
2122
Flatten,
@@ -85,8 +86,10 @@ class HybridMultStepUniVar(UniVariateMultiStep):
8586
layer_config = {'layer0': (64, 1, 'relu'), 'layer1': (32, 1, 'relu'),
8687
'layer2': (2), 'layer3': (50, 'relu'), 'layer4': (25, 'relu')}):
8788
Builds CNN bidirectional GRU structure.
88-
fit_model(self, epochs: int, show_progress: int = 1):
89-
Fitting selected model to data provided.
89+
fit_model(self, epochs: int, show_progress: int = 1,
90+
validation_split: float = 0.20, batch_size: int = 10,
91+
**callback_setting: dict):
92+
Fitting model onto provided data.
9093
model_blueprint(self):
9194
Print blueprint of layer structure.
9295
show_performance(self):
@@ -520,23 +523,35 @@ def fit_model(
520523
self,
521524
epochs: int,
522525
show_progress: int = 1,
523-
validation_split=0.20,
524-
batch_size=10):
526+
validation_split: float = 0.20,
527+
batch_size: int = 10,
528+
**callback_setting: dict):
525529
'''Trains the model on data provided. Perfroms validation.
526530
Parameters:
527531
epochs (int): Number of epochs to train the model.
528532
show_progress (int): Prints training progress.
529533
validation_split (float): Determines size of Validation data.
530534
batch_size (int): Batch size of input data.
531-
layer_config (dict): Adjust neurons and acitivation functions.
535+
callback_settings (dict): Create a Keras EarlyStopping object.
532536
'''
533-
self.details = self.model.fit(
534-
self.input_x,
535-
self.input_y,
536-
validation_split=validation_split,
537-
batch_size=batch_size,
538-
epochs=epochs,
539-
verbose=show_progress)
537+
if callback_setting == {}:
538+
self.details = self.model.fit(
539+
self.input_x,
540+
self.input_y,
541+
validation_split=validation_split,
542+
batch_size=batch_size,
543+
epochs=epochs,
544+
verbose=show_progress)
545+
else:
546+
callback = EarlyStopping(**callback_setting)
547+
self.details = self.model.fit(
548+
self.input_x,
549+
self.input_y,
550+
validation_split=validation_split,
551+
batch_size=batch_size,
552+
epochs=epochs,
553+
verbose=show_progress,
554+
callbacks=[callback])
540555
return self.details
541556

542557
def model_blueprint(self):

build/lib/imbrium/predictors/univarstandard.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import tensorflow as tf
1919
from tensorflow import keras
20+
from tensorflow.keras.callbacks import EarlyStopping
2021
from tensorflow.keras.layers import (LSTM,
2122
Dense,
2223
Flatten,
@@ -113,7 +114,9 @@ class BasicMultStepUniVar(UniVariateMultiStep):
113114
layer_config: dict = {'layer0': (64, 1, 'relu'), 'layer1': (32, 1, 'relu'),
114115
'layer2': (2), 'layer3': (50, 'relu'), 'layer4': (100, 'relu')}):
115116
Builds encoder decoder CNN structure.
116-
fit_model(self, epochs: int, show_progress: int = 1):
117+
fit_model(self, epochs: int, show_progress: int = 1,
118+
validation_split: float = 0.20, batch_size: int = 10,
119+
**callback_setting: dict):
117120
Fitting model onto provided data.
118121
model_blueprint(self):
119122
Print blueprint of layer structure.
@@ -724,21 +727,34 @@ def fit_model(
724727
epochs: int,
725728
show_progress: int = 1,
726729
validation_split: float = 0.20,
727-
batch_size: int = 10):
730+
batch_size: int = 10,
731+
**callback_setting: dict):
728732
'''Trains the model on data provided. Perfroms validation.
729733
Parameters:
730734
epochs (int): Number of epochs to train the model.
731735
show_progress (int): Prints training progress.
732736
validation_split (float): Determines size of Validation data.
733737
batch_size (int): Batch size of input data.
738+
callback_settings (dict): Create a Keras EarlyStopping object.
734739
'''
735-
self.details = self.model.fit(
736-
self.input_x,
737-
self.input_y,
738-
validation_split=validation_split,
739-
batch_size=batch_size,
740-
epochs=epochs,
741-
verbose=show_progress)
740+
if callback_setting == {}:
741+
self.details = self.model.fit(
742+
self.input_x,
743+
self.input_y,
744+
validation_split=validation_split,
745+
batch_size=batch_size,
746+
epochs=epochs,
747+
verbose=show_progress)
748+
else:
749+
callback = EarlyStopping(**callback_setting)
750+
self.details = self.model.fit(
751+
self.input_x,
752+
self.input_y,
753+
validation_split=validation_split,
754+
batch_size=batch_size,
755+
epochs=epochs,
756+
verbose=show_progress,
757+
callbacks=[callback])
742758
return self.details
743759

744760
def model_blueprint(self):
-23.9 KB
Binary file not shown.

dist/Imbrium-0.1.3.tar.gz

-13.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)