Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bannier Delphine
Projet_FR
Commits
c9f6290b
Commit
c9f6290b
authored
May 18, 2021
by
Bannier Delphine
Browse files
set up kfold
parent
20c0e823
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
clean_notebooks/CNN_injection_superposition_4Chann.ipynb
View file @
c9f6290b
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
processing/models.py
View file @
c9f6290b
...
@@ -14,7 +14,7 @@ from tensorflow.keras.layers import GaussianNoise
...
@@ -14,7 +14,7 @@ from tensorflow.keras.layers import GaussianNoise
from
tensorflow
import
TensorShape
from
tensorflow
import
TensorShape
import
numpy
as
np
import
numpy
as
np
from
tensorflow
import
TensorShape
from
tensorflow
import
TensorShape
import
numpy
as
np
from
sklearn.model_selection
import
train_test_split
...
@@ -161,4 +161,16 @@ def create_hybrid_transfer(nb_attributes,new_model, custom_model, modify_name,in
...
@@ -161,4 +161,16 @@ def create_hybrid_transfer(nb_attributes,new_model, custom_model, modify_name,in
x
=
Dense
(
4
,
activation
=
"relu"
)(
combinedInput
)
x
=
Dense
(
4
,
activation
=
"relu"
)(
combinedInput
)
x
=
Dense
(
1
,
activation
=
"linear"
)(
x
)
x
=
Dense
(
1
,
activation
=
"linear"
)(
x
)
model
=
Model
(
inputs
=
[
mlp
.
input
,
cnn
.
input
],
outputs
=
x
)
model
=
Model
(
inputs
=
[
mlp
.
input
,
cnn
.
input
],
outputs
=
x
)
return
model
return
model
\ No newline at end of file
def
fit_and_evaluate
(
t_x
,
val_x
,
t_y
,
val_y
,
EPOCHS
=
30
,
BATCH_SIZE
=
8
,
model
=
None
,
es
=
None
,
cp
=
None
):
"""
`es`: earlystopping keras object
`cp`: checkpoint keras object
"""
mod
=
None
mod
=
model
results
=
mod
.
fit
(
t_x
,
t_y
,
epochs
=
EPOCHS
,
batch_size
=
BATCH_SIZE
,
callbacks
=
[
es
,
cp
],
verbose
=
1
,
validation_split
=
0.1
)
print
(
"Val Score: "
,
mod
.
evaluate
(
val_x
,
val_y
))
return
results
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment