Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Carsten Eie Frigaard
GITMAL
Commits
1060661d
Commit
1060661d
authored
Oct 05, 2021
by
Carsten Eie Frigaard
Browse files
pre_l06_update1
parent
b40001f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
L06/Old/ANN - Øvelser.pdf
deleted
100644 → 0
View file @
b40001f4
File deleted
L06/Old/ANN_example.py
deleted
100644 → 0
View file @
b40001f4
#%%
import
pandas
as
pd
import
matplotlib.pyplot
as
plt
from
sklearn.datasets
import
load_diabetes
from
sklearn.neural_network
import
MLPRegressor
import
numpy
as
np
#%% data
x
=
np
.
linspace
(
-
10
,
10
,
1000
)
y
=
2
*
np
.
tanh
(
2
*
x
-
12
)
-
3
*
np
.
tanh
(
2
*
x
-
4
)
plt
.
plot
(
x
,
y
,
'.'
)
x
=
x
.
reshape
(
-
1
,
1
)
# Scikit-algoritmer kræver (:,1)-format
#%% fit model
mlp
=
MLPRegressor
(
activation
=
'tanh'
,
# aktiveringsfunktion
hidden_layer_sizes
=
2
,
# antal skjulte neuroner
alpha
=
1e-5
,
# regulariseringsparameter, her meget lille
solver
=
'lbfgs'
,
# quasi-Newton solver
max_iter
=
1000
,
verbose
=
True
)
mlp
.
fit
(
x
,
y
)
plt
.
plot
(
x
,
y
)
plt
.
plot
(
x
,
mlp
.
predict
(
x
),
'rx'
,
ms
=
1
)
mlp
.
coefs_
# w-parametre
mlp
.
intercepts_
# = bias led
#%% data 2 - Til øvelserne..
x
=
np
.
linspace
(
-
3
,
3
,
1000
)
y
=
np
.
sinc
(
x
)
plt
.
plot
(
x
,
y
,
'.'
)
x
=
x
.
reshape
(
-
1
,
1
)
# Scikit-algoritmer kræver (:,1)-format
\ No newline at end of file
L06/Old/Kunstige Neurale Netværk.pdf
deleted
100644 → 0
View file @
b40001f4
File deleted
Write
Preview
Markdown
is supported
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