Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
modelisation-statistique-coeur
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laurie Boffelli
modelisation-statistique-coeur
Commits
58be3f0c
Commit
58be3f0c
authored
1 year ago
by
adeline.paiement
Browse files
Options
Downloads
Patches
Plain Diff
nettoyage code
parent
ff2ad143
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parmorceauxMax-git/Dynamics_Model.m
+1
-39
1 addition, 39 deletions
parmorceauxMax-git/Dynamics_Model.m
with
1 addition
and
39 deletions
parmorceauxMax-git/Dynamics_Model.m
+
1
−
39
View file @
58be3f0c
...
...
@@ -12,14 +12,8 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
X
T
Y
%previous_N_fixed
%N_fixed
%nb_times_fixed
current_alpha
%alpha_variable
%confidence
window_size
display_screen
marginal_X_Yi
...
...
@@ -53,12 +47,7 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
obj
.
T
=
[];
obj
.
X
=
[];
obj
.
Y
=
[];
%obj.N_fixed = 0;
obj
.
current_alpha
=
alpha_ini
;
%obj.alpha_variable = [];
obj
.
window_size
=
[];
%obj.confidence = [];
%obj.nb_times_fixed = [];
obj
.
initial_estimate_X
=
initial_X
;
obj
.
alpha_initial
=
alpha_ini
;
...
...
@@ -68,28 +57,18 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
function
process_new_frame
(
obj
,
Yt
,
Tt
)
obj
.
T
=
[
obj
.
T
;
Tt
];
obj
.
Y
=
[
obj
.
Y
;
Yt
(:,
1
:
obj
.
num_dim_Y
)];
frame
=
size
(
obj
.
T
,
1
);
% estimate alpha and adjust the window size
alpha
=
obj
.
estimate_alpha
();
sprintf
(
'estimated alpha_variable: %f'
,
alpha
);
obj
.
current_alpha
=
alpha
;
obj
.
window_size
=
[
obj
.
window_size
,
frame
];
% estimate X inside the window (and update N_fixed)
%obj.previous_N_fixed = obj.N_fixed;
% estimate X inside the window
obj
.
estimate_X
();
%sprintf('"normalised" log likelihood of X (or confidence): %f', obj.confidence(frame));
if
obj
.
display_screen
~=
-
1
obj
.
plot_estimated_X
();
end
% save the value of alpha for the frames that have converged
%if obj.previous_N_fixed < obj.N_fixed
% for i=obj.previous_N_fixed+1:obj.N_fixed
% obj.alpha_variable(i) = alpha;
% end
%end
end
function
alpha
=
estimate_alpha
(
obj
)
N
=
size
(
obj
.
X
,
1
);
...
...
@@ -123,13 +102,6 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
if
alpha
>=
1.15
*
obj
.
alpha_initial
;
%1.25%0.015 1.25%1.15%1.1
alpha
=
1.15
*
obj
.
alpha_initial
;
%1.25%0.015;%1.15%1.1
end
% if alpha <= 0.015
% alpha = 0.015;
% end
% if alpha > 0.025
% alpha = 0.025;
% end
end
end
function
estimate_X
(
obj
)
...
...
@@ -151,7 +123,6 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
Aeq
=
[];
beq
=
[];
[
new_X_variable
,
loglikelihood
]
=
fmincon
(
f
,
X_ini
,
A
,
b
,
Aeq
,
beq
,
lb
,
ub
);
%obj.confidence = [obj.confidence, -loglikelihood / size(new_X_variable,1)];
obj
.
X
=
new_X_variable
;
end
...
...
@@ -160,7 +131,6 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
if
N
==
1
obj
.
X
=
0
;
%obj.confidence = 1;
obj
.
current_alpha
=
obj
.
alpha_initial
;
obj
.
plot_estimated_X
()
...
...
@@ -168,7 +138,6 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
return
elseif
N
==
2
obj
.
X
=
[
0
1
];
%obj.confidence = [0 1];
obj
.
current_alpha
=
1
;
obj
.
plot_estimated_X
()
...
...
@@ -207,7 +176,6 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
new_X
=
[
0
;
obj
.
normalise_X
(
new_X
);
1
];
obj
.
X
=
new_X
;
%obj.confidence = [1, -loglikelihood / size(new_X,1), 1];
%%% calcul du alpha correspondant aux X estimés
...
...
@@ -328,7 +296,6 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
indexes
=
frames
<=
1
frames
(
indexes
)
terme1
=
obj
.
logP_cond_y
(
obj
.
Y
(
frames
(
indexes
),:),
obj
.
X
(
frames
(
indexes
)));
%llh_dynamics(frames <= 1) = terme1 + obj.logP_x_Markov(obj.alpha_initial, 0, 2, 1, obj.alpha_initial, obj.sigma_test);
llh_dynamics
(
frames
<=
1
)
=
terme1
+
obj
.
logP_x_Markov
(
obj
.
X
(
1
),
obj
.
X
(
1
)
-
alpha
,
2
,
1
,
alpha
,
obj
.
sigma_test
);
end
function
plot_estimated_X
(
obj
)
...
...
@@ -388,9 +355,4 @@ classdef Dynamics_Model < matlab.mixin.Copyable %handle
periodic
=
0
;
end
end
%methods (Abstract)
% X = normalise_X(obj, X)
% periodic = is_periodic(obj)
%end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment