Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CRP Toolbox for MATLAB
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Norbert Marwan
CRP Toolbox for MATLAB
Commits
bedf0131
Commit
bedf0131
authored
12 years ago
by
marwan
Browse files
Options
Downloads
Patches
Plain Diff
bug fix: normalisation of data when data contains Inf
parent
c936c4e1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
crp.m
+15
-7
15 additions, 7 deletions
crp.m
crp2.m
+27
-12
27 additions, 12 deletions
crp2.m
crp_big.m
+17
-8
17 additions, 8 deletions
crp_big.m
with
59 additions
and
27 deletions
crp.m
+
15
−
7
View file @
bedf0131
...
@@ -38,7 +38,7 @@ function xout=crp(varargin)
...
@@ -38,7 +38,7 @@ function xout=crp(varargin)
% minnorm - Minimum norm.
% minnorm - Minimum norm.
% nrmnorm - Euclidean norm between normalized vectors
% nrmnorm - Euclidean norm between normalized vectors
% (all vectors have the length one).
% (all vectors have the length one).
%
maxnorm
- Maximum norm, fixed recurrence rate.
%
rr
- Maximum norm, fixed recurrence rate.
% fan - Fixed amount of nearest neighbours.
% fan - Fixed amount of nearest neighbours.
% inter - Interdependent neighbours.
% inter - Interdependent neighbours.
% omatrix - Order matrix.
% omatrix - Order matrix.
...
@@ -84,6 +84,9 @@ function xout=crp(varargin)
...
@@ -84,6 +84,9 @@ function xout=crp(varargin)
% $Revision$
% $Revision$
%
%
% $Log$
% $Log$
% Revision 5.16 2010/06/29 12:46:47 marwan
% bug in checking the lengths of x and y
%
% Revision 5.15 2009/03/24 08:31:17 marwan
% Revision 5.15 2009/03/24 08:31:17 marwan
% copyright address changed
% copyright address changed
%
%
...
@@ -288,22 +291,27 @@ if isnumeric(varargin{1}) % read commandline input
...
@@ -288,22 +291,27 @@ if isnumeric(varargin{1}) % read commandline input
errordlg
(
'The embedding vectors cannot be created. Dimension M and/ or delay T are to big. Please use smaller values.'
,
'Dimension/ delay to big'
)
errordlg
(
'The embedding vectors cannot be created. Dimension M and/ or delay T are to big. Please use smaller values.'
,
'Dimension/ delay to big'
)
waitforbuttonpress
waitforbuttonpress
end
end
% normalise the data
if
size
(
x
,
2
)
>=
2
if
size
(
x
,
2
)
>=
2
xscale
=
x
(:,
1
);
xscale
=
x
(:,
1
);
if
~
isempty
(
find
(
diff
(
xscale
)
<
0
)),
error
(
'First column of the first vector must be monotonically non-decreasing.'
),
end
if
~
isempty
(
find
(
diff
(
xscale
)
<
0
)),
error
(
'First column of the first vector must be monotonically non-decreasing.'
),
end
if
nonorm
==
1
,
x
=
(
x
(:,
2
)
-
mean
(
x
(:,
2
)))/
std
(
x
(:,
2
));
else
x
=
x
(:,
2
);
end
idx
=
find
(
~
isinf
(
x
(:,
2
)));
if
nonorm
==
1
,
x
=
(
x
(:,
2
)
-
mean
(
x
(
idx
,
2
)))/
std
(
x
(
idx
,
2
));
else
x
=
x
(:,
2
);
end
else
else
if
nonorm
==
1
,
x
=
(
x
-
mean
(
x
))/
std
(
x
);
end
idx
=
find
(
~
isinf
(
x
));
if
nonorm
==
1
,
x
=
(
x
-
mean
(
x
(
idx
)))/
std
(
x
(
idx
));
end
xscale
=
(
1
:
length
(
x
))
'
;
xscale
=
(
1
:
length
(
x
))
'
;
end
end
if
size
(
y
,
2
)
>=
2
if
size
(
y
,
2
)
>=
2
yscale
=
y
(:,
1
);
yscale
=
y
(:,
1
);
if
~
isempty
(
find
(
diff
(
yscale
)
<
0
)),
error
(
'First column of the second vector must be monotonically non-decreasing.'
),
end
if
~
isempty
(
find
(
diff
(
yscale
)
<
0
)),
error
(
'First column of the second vector must be monotonically non-decreasing.'
),
end
if
nonorm
==
1
,
y
=
(
y
(:,
2
)
-
mean
(
y
(:,
2
)))/
std
(
y
(:,
2
));
else
y
=
y
(:,
2
);
end
idx
=
find
(
~
isinf
(
y
(:,
2
)));
if
nonorm
==
1
,
y
=
(
y
(:,
2
)
-
mean
(
y
(
idx
,
2
)))/
std
(
y
(
idx
,
2
));
else
y
=
y
(:,
2
);
end
else
else
if
nonorm
==
1
,
y
=
(
y
-
mean
(
y
))/
std
(
y
);
end
idx
=
find
(
~
isinf
(
y
));
yscale
=
(
1
:
length
(
y
))
'
;
if
nonorm
==
1
,
y
=
(
y
-
mean
(
y
(
idx
)))/
std
(
y
(
idx
));
end
yscale
=
(
1
:
length
(
y
))
'
;
end
end
ds
=
eye
(
m
);
ds
=
eye
(
m
);
...
@@ -692,7 +700,7 @@ switch(action)
...
@@ -692,7 +700,7 @@ switch(action)
if
check_stop
(
hCRP
,
hCtrl
,
nogui
,
obj
),
return
,
end
if
check_stop
(
hCRP
,
hCtrl
,
nogui
,
obj
),
return
,
end
set
(
findobj
(
'Tag'
,
'Status'
,
'Parent'
,
findobj
(
'Parent'
,
hCRP
,
'Tag'
,
'CRPPlot'
)
'),'
String
','
Building
CRP
Matrix
'
),
drawnow
set
(
findobj
(
'Tag'
,
'Status'
,
'Parent'
,
findobj
(
'Parent'
,
hCRP
,
'Tag'
,
'CRPPlot'
)
'),'
String
','
Building
CRP
Matrix
'
),
drawnow
X
=
(
uint8
(
255
*
s
/
max
(
s
(:)))
<
(
255
*
e
/
max
(
s
(:))))
'
;
clear
s
s1
x1
y1
px
py
X
=
uint8
(
(
s
/
max
(
s
(:)))
<
(
e
/
max
(
s
(:))))
'
;
clear
s
s1
x1
y1
px
py
matext
=
[
num2str
(
round
(
100
*
e
)/
100
)
unit
' (normalized distance euclidean norm)'
];
matext
=
[
num2str
(
round
(
100
*
e
)/
100
)
unit
' (normalized distance euclidean norm)'
];
...
...
This diff is collapsed.
Click to expand it.
crp2.m
+
27
−
12
View file @
bedf0131
...
@@ -37,7 +37,7 @@ function xout=crp2(varargin)
...
@@ -37,7 +37,7 @@ function xout=crp2(varargin)
% minnorm - Minimum norm.
% minnorm - Minimum norm.
% nrmnorm - Euclidean norm between normalized vectors
% nrmnorm - Euclidean norm between normalized vectors
% (all vectors have the length one).
% (all vectors have the length one).
%
maxnorm
- Maximum norm, fixed recurrence rate.
%
rr
- Maximum norm, fixed recurrence rate.
% fan - Fixed amount of nearest neighbours.
% fan - Fixed amount of nearest neighbours.
% omatrix - Order matrix (disabled).
% omatrix - Order matrix (disabled).
% opattern - Order patterns recurrence plot.
% opattern - Order patterns recurrence plot.
...
@@ -86,6 +86,9 @@ function xout=crp2(varargin)
...
@@ -86,6 +86,9 @@ function xout=crp2(varargin)
% $Revision$
% $Revision$
%
%
% $Log$
% $Log$
% Revision 5.18 2010/06/29 12:47:30 marwan
% some minor bugs in output and test of time series lengths (of x and y)
%
% Revision 5.17 2009/03/24 08:31:17 marwan
% Revision 5.17 2009/03/24 08:31:17 marwan
% copyright address changed
% copyright address changed
%
%
...
@@ -295,19 +298,31 @@ if isnumeric(varargin{1}) % read commandline input
...
@@ -295,19 +298,31 @@ if isnumeric(varargin{1}) % read commandline input
'Either too much NaN or the number of columns in the vectors do not match.'
])
'Either too much NaN or the number of columns in the vectors do not match.'
])
end
end
Nx
=
size
(
x
,
1
);
Ny
=
size
(
y
,
1
);
Nx
=
size
(
x
,
1
);
Ny
=
size
(
y
,
1
);
NX
=
Nx
-
t
*
(
m0
-
1
);
NY
=
Ny
-
t
*
(
m0
-
1
);
NX
=
Nx
-
t
*
(
m0
-
1
);
NY
=
Ny
-
t
*
(
m0
-
1
);
x0
=
zeros
(
Nx
,
m
);
y0
=
zeros
(
Ny
,
m
);
x0
=
zeros
(
Nx
,
m
);
y0
=
zeros
(
Ny
,
m
);
x0
(
1
:
size
(
x
,
1
),
1
:
size
(
x
,
2
))
=
x
;
x0
(
1
:
size
(
x
,
1
),
1
:
size
(
x
,
2
))
=
x
;
y0
(
1
:
size
(
y
,
1
),
1
:
size
(
y
,
2
))
=
y
;
y0
(
1
:
size
(
y
,
1
),
1
:
size
(
y
,
2
))
=
y
;
if
nonorm
==
1
,
% normalise the data
x
=
(
x0
-
repmat
(
mean
(
x0
),
Nx
,
1
))
.
/
repmat
(
std
(
x0
),
Nx
,
1
);
if
nonorm
==
1
,
y
=
(
y0
-
repmat
(
mean
(
y0
),
Ny
,
1
))
.
/
repmat
(
std
(
y0
),
Ny
,
1
);
for
k
=
1
:
size
(
x0
,
2
)
end
idx
=
find
(
~
isinf
(
x0
(:,
k
)));
stdx
=
std
(
x0
(
idx
,
k
));
meanx
=
mean
(
x0
(
idx
,
k
));
x
(:,
k
)
=
(
x0
(:,
k
)
-
meanx
)
/
stdx
;
end
for
k
=
1
:
size
(
y0
,
2
)
idy
=
find
(
~
isinf
(
x0
(:,
k
)));
stdy
=
std
(
y0
(
idy
,
k
));
meany
=
mean
(
y0
(
idy
,
k
));
y
(:,
k
)
=
(
y0
(:,
k
)
-
meany
)
/
stdy
;
end
end
if
~
isempty
(
find
(
isnan
(
x
))),
for
k
=
1
:
size
(
x
,
2
),
x
(
find
(
isnan
(
x
(:,
k
))),:)
=
[];
end
,
end
if
~
isempty
(
find
(
isnan
(
x
))),
for
k
=
1
:
size
(
x
,
2
),
x
(
find
(
isnan
(
x
(:,
k
))),:)
=
[];
end
,
end
if
~
isempty
(
find
(
isnan
(
y
))),
for
k
=
1
:
size
(
y
,
2
),
y
(
find
(
isnan
(
y
(:,
k
))),:)
=
[];
end
,
end
if
~
isempty
(
find
(
isnan
(
y
))),
for
k
=
1
:
size
(
y
,
2
),
y
(
find
(
isnan
(
y
(:,
k
))),:)
=
[];
end
,
end
if
size
(
x
,
1
)
<
t
*
(
m0
-
1
)
+
1
|
size
(
y
,
1
)
<
t
*
(
m0
-
1
)
+
1
if
size
(
x
,
1
)
<
t
*
(
m0
-
1
)
+
1
|
size
(
y
,
1
)
<
t
*
(
m0
-
1
)
+
1
error
([
'Too less data'
,
10
,
...
error
([
'Too less data'
,
10
,
...
'Either too much NaN or the number of columns in the vectors do not match.'
])
'Either too much NaN or the number of columns in the vectors do not match.'
])
...
@@ -1118,7 +1133,7 @@ switch(action)
...
@@ -1118,7 +1133,7 @@ switch(action)
if
check_stop
(
hCRP
,
hCtrl
,
nogui
,
obj
),
return
,
end
if
check_stop
(
hCRP
,
hCtrl
,
nogui
,
obj
),
return
,
end
set
(
findobj
(
'Tag'
,
'Status'
,
'Parent'
,
findobj
(
'Parent'
,
hCRP
,
'Tag'
,
'CRPPlot'
)),
'String'
,
'Building CRP Matrix'
),
drawnow
set
(
findobj
(
'Tag'
,
'Status'
,
'Parent'
,
findobj
(
'Parent'
,
hCRP
,
'Tag'
,
'CRPPlot'
)),
'String'
,
'Building CRP Matrix'
),
drawnow
X
=
reshape
(
uint8
(
255
*
s
/
max
(
s
))
<
(
255
*
e
/
max
(
s
)),
Ny
,
Nx
);
clear
s
x1
y1
X
=
uint8
(
reshape
(
(
s
/
max
(
s
))
<
(
e
/
max
(
s
)),
Ny
,
Nx
)
)
;
clear
s
x1
y1
matext
=
[
num2str
(
round
(
100
*
e
)/
100
)
unit
' (normalized distance euclidean norm)'
];
matext
=
[
num2str
(
round
(
100
*
e
)/
100
)
unit
' (normalized distance euclidean norm)'
];
...
...
This diff is collapsed.
Click to expand it.
crp_big.m
+
17
−
8
View file @
bedf0131
...
@@ -40,7 +40,7 @@ function xout=crp_big(varargin)
...
@@ -40,7 +40,7 @@ function xout=crp_big(varargin)
% minnorm - Minimum norm.
% minnorm - Minimum norm.
% nrmnorm - Euclidean norm between normalized vectors
% nrmnorm - Euclidean norm between normalized vectors
% (all vectors have the length one).
% (all vectors have the length one).
%
maxnorm
- Maximum norm, fixed recurrence rate.
%
rr
- Maximum norm, fixed recurrence rate.
% fan - Fixed amount of nearest neighbours.
% fan - Fixed amount of nearest neighbours.
% inter - Interdependent neighbours.
% inter - Interdependent neighbours.
% omatrix - Order matrix.
% omatrix - Order matrix.
...
@@ -82,6 +82,9 @@ function xout=crp_big(varargin)
...
@@ -82,6 +82,9 @@ function xout=crp_big(varargin)
% $Revision$
% $Revision$
%
%
% $Log$
% $Log$
% Revision 5.14 2010/06/29 12:48:16 marwan
% bug in checking the lengths of x and y
%
% Revision 5.13 2009/03/24 08:31:17 marwan
% Revision 5.13 2009/03/24 08:31:17 marwan
% copyright address changed
% copyright address changed
%
%
...
@@ -278,21 +281,27 @@ if isnumeric(varargin{1})==1 % read commandline input
...
@@ -278,21 +281,27 @@ if isnumeric(varargin{1})==1 % read commandline input
errordlg
(
'The embedding vectors cannot be created. Dimension M and/ or delay T are to big. Please use smaller values.'
,
'Dimension/ delay to big'
)
errordlg
(
'The embedding vectors cannot be created. Dimension M and/ or delay T are to big. Please use smaller values.'
,
'Dimension/ delay to big'
)
waitforbuttonpress
waitforbuttonpress
end
end
% normalise the data
if
size
(
x
,
2
)
>=
2
if
size
(
x
,
2
)
>=
2
xscale
=
x
(:,
1
);
xscale
=
x
(:,
1
);
if
~
isempty
(
find
(
diff
(
xscale
)
<
0
)),
error
(
'First column of the first vector must be monotonically non-decreasing.'
),
end
if
~
isempty
(
find
(
diff
(
xscale
)
<
0
)),
error
(
'First column of the first vector must be monotonically non-decreasing.'
),
end
if
nonorm
==
1
,
x
=
(
x
(:,
2
)
-
mean
(
x
(:,
2
)))/
std
(
x
(:,
2
));
else
x
=
x
(:,
2
);
end
idx
=
find
(
~
isinf
(
x
(:,
2
)));
if
nonorm
==
1
,
x
=
(
x
(:,
2
)
-
mean
(
x
(
idx
,
2
)))/
std
(
x
(
idx
,
2
));
else
x
=
x
(:,
2
);
end
else
else
if
nonorm
==
1
,
x
=
(
x
-
mean
(
x
))/
std
(
x
);
end
idx
=
find
(
~
isinf
(
x
));
if
nonorm
==
1
,
x
=
(
x
-
mean
(
x
(
idx
)))/
std
(
x
(
idx
));
end
xscale
=
(
1
:
length
(
x
))
'
;
xscale
=
(
1
:
length
(
x
))
'
;
end
end
if
size
(
y
,
2
)
>=
2
if
size
(
y
,
2
)
>=
2
yscale
=
y
(:,
1
);
yscale
=
y
(:,
1
);
if
~
isempty
(
find
(
diff
(
yscale
)
<
0
)),
error
(
'First column of the second vector must be monotonically non-decreasing.'
),
end
if
~
isempty
(
find
(
diff
(
yscale
)
<
0
)),
error
(
'First column of the second vector must be monotonically non-decreasing.'
),
end
if
nonorm
==
1
,
y
=
(
y
(:,
2
)
-
mean
(
y
(:,
2
)))/
std
(
y
(:,
2
));
else
y
=
y
(:,
2
);
end
idx
=
find
(
~
isinf
(
y
(:,
2
)));
if
nonorm
==
1
,
y
=
(
y
(:,
2
)
-
mean
(
y
(
idx
,
2
)))/
std
(
y
(
idx
,
2
));
else
y
=
y
(:,
2
);
end
else
else
if
nonorm
==
1
,
y
=
(
y
-
mean
(
y
))/
std
(
y
);
end
idx
=
find
(
~
isinf
(
y
));
yscale
=
(
1
:
length
(
y
))
'
;
if
nonorm
==
1
,
y
=
(
y
-
mean
(
y
(
idx
)))/
std
(
y
(
idx
));
end
yscale
=
(
1
:
length
(
y
))
'
;
end
end
ds
=
eye
(
m
);
ds
=
eye
(
m
);
...
@@ -704,7 +713,7 @@ switch(action)
...
@@ -704,7 +713,7 @@ switch(action)
matext
=
[
num2str
(
round
(
100
*
e
)/
100
)
unit
' (fixed distance minimum norm)'
];
matext
=
[
num2str
(
round
(
100
*
e
)/
100
)
unit
' (fixed distance minimum norm)'
];
end
end
X1
=
255
*
s
/
max
(
s
(:))
<
(
255
*
e
/
max
(
s
(:)));
X1
=
s
/
max
(
s
(:))
<
(
e
/
max
(
s
(:)));
X0
=
(
uint8
(
X1
))
'
;
clear
s
s1
x1
y1
px
py
X1
X0
=
(
uint8
(
X1
))
'
;
clear
s
s1
x1
y1
px
py
X1
X
(
1
+
Ny2
*
(
j
-
1
):
Ny2
+
Ny2
*
(
j
-
1
),
1
+
Nx2
*
(
i
-
1
):
Nx2
+
Nx2
*
(
i
-
1
))
=
X0
;
X
(
1
+
Ny2
*
(
j
-
1
):
Ny2
+
Ny2
*
(
j
-
1
),
1
+
Nx2
*
(
i
-
1
):
Nx2
+
Nx2
*
(
i
-
1
))
=
X0
;
X
(
NY0
+
1
:
end
,:)
=
[];
X
(
NY0
+
1
:
end
,:)
=
[];
...
@@ -731,7 +740,7 @@ switch(action)
...
@@ -731,7 +740,7 @@ switch(action)
s1
=
px
(:,
ones
(
1
,
NY
),:)
-
py
(
ones
(
1
,
NX
),:,:);
s1
=
px
(:,
ones
(
1
,
NY
),:)
-
py
(
ones
(
1
,
NX
),:,:);
s
=
sqrt
(
sum
(
s1
.^
2
,
3
));
s
=
sqrt
(
sum
(
s1
.^
2
,
3
));
X0
=
(
uint8
(
255
*
s
/
max
(
s
(:)))
<
(
255
*
e
/
max
(
s
(:))))
'
;
clear
s
s1
x1
y1
px
py
X0
=
uint8
(
(
s
/
max
(
s
(:)))
<
(
e
/
max
(
s
(:))))
'
;
clear
s
s1
x1
y1
px
py
X
(
1
+
Ny2
*
(
j
-
1
):
Ny2
+
Ny2
*
(
j
-
1
),
1
+
Nx2
*
(
i
-
1
):
Nx2
+
Nx2
*
(
i
-
1
))
=
X0
;
X
(
1
+
Ny2
*
(
j
-
1
):
Ny2
+
Ny2
*
(
j
-
1
),
1
+
Nx2
*
(
i
-
1
):
Nx2
+
Nx2
*
(
i
-
1
))
=
X0
;
X
(
NY0
+
1
:
end
,:)
=
[];
X
(
NY0
+
1
:
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