Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SISIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
SFCB
SISIR
Commits
b6c8aa3d
Commit
b6c8aa3d
authored
2 years ago
by
Nathalie Vialaneix
Browse files
Options
Downloads
Patches
Plain Diff
add time in quality plots (fixed
#8
)
parent
9f47248a
No related branches found
Branches containing commit
Tags
v0.2.1
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/plot_functions.R
+31
-3
31 additions, 3 deletions
R/plot_functions.R
R/sfcb_methods.R
+3
-1
3 additions, 1 deletion
R/sfcb_methods.R
man/SFCB-class.Rd
+3
-1
3 additions, 1 deletion
man/SFCB-class.Rd
with
37 additions
and
5 deletions
R/plot_functions.R
+
31
−
3
View file @
b6c8aa3d
...
...
@@ -319,17 +319,42 @@ plot_selection <- function(x, sel.type, threshold) {
plot_quality
<-
function
(
x
,
quality.crit
)
{
valid_criteria
<-
"mse"
if
(
"computational.times"
%in%
names
(
x
))
{
valid_criteria
<-
c
(
valid_criteria
,
"time"
)
}
if
(
"quality"
%in%
names
(
x
))
{
valid_criteria
<-
c
(
"mse"
,
"Precision"
,
"Recall"
,
"ARI"
,
"NMI"
)
}
else
valid_criteria
<-
"mse"
valid_criteria
<-
c
(
valid_criteria
,
"Precision"
,
"Recall"
,
"ARI"
,
"NMI"
)
}
crit_ok
<-
all
(
sapply
(
quality.crit
,
function
(
cc
)
cc
%in%
valid_criteria
))
if
(
!
crit_ok
||
length
(
quality.crit
)
>
2
)
{
stop
(
paste0
(
"'quality.crit' must be a vector with length at most 2 in "
,
paste
(
valid_criteria
,
collapse
=
", "
),
"."
))
paste
(
valid_criteria
,
collapse
=
", "
),
"."
),
call.
=
FALSE
)
}
if
(
length
(
quality.crit
)
==
2
&&
"time"
%in%
quality.crit
)
{
stop
(
"'time' is a valid quality criterion to plot only taken alone."
,
call.
=
FALSE
)
}
if
(
"time"
%in%
quality.crit
)
{
df
<-
data.frame
(
"criterion"
=
c
(
unname
(
x
$
"computational.times"
)),
"step"
=
names
(
x
$
"computational.times"
))
df
$
step
<-
factor
(
df
$
step
,
levels
=
names
(
x
$
"computational.times"
),
ordered
=
TRUE
)
p
<-
ggplot
(
df
,
aes
(
fill
=
.data
$
step
,
y
=
.data
$
criterion
,
x
=
1
))
+
geom_bar
(
stat
=
"identity"
)
+
theme_bw
()
+
xlim
(
0
,
2
)
+
ylab
(
"computational time (s)"
)
+
theme
(
axis.title.x
=
element_blank
(),
axis.ticks.x
=
element_blank
(),
axis.text.x
=
element_blank
())
+
scale_fill_brewer
(
type
=
"qual"
,
palette
=
7
)
return
(
p
)
}
if
(
length
(
quality.crit
)
==
1
)
{
# build data frame
if
(
quality.crit
==
"mse"
)
{
df
<-
data.frame
(
"criterion"
=
x
$
mse
$
mse
,
"at"
=
x
$
mse
$
clust
)
ylimits
<-
c
(
0
,
max
(
df
$
criterion
))
...
...
@@ -340,11 +365,14 @@ plot_quality <- function(x, quality.crit) {
ylimits
<-
c
(
-1
,
1
)
}
else
ylimits
<-
c
(
0
,
1
)
}
# make plot
p
<-
ggplot
(
df
,
aes
(
x
=
.data
$
at
,
y
=
.data
$
criterion
))
+
geom_jitter
(
width
=
0.2
,
height
=
0
)
+
theme_bw
()
+
xlab
(
"number of intervals"
)
+
ylab
(
quality.crit
)
+
ylim
(
ylimits
)
+
scale_x_continuous
(
breaks
=
unique
(
df
$
at
),
limits
=
c
(
min
(
df
$
at
)
-
0.5
,
max
(
df
$
at
+
0.5
)))
}
else
{
if
(
"mse"
%in%
quality.crit
)
{
quality.crit
<-
setdiff
(
quality.crit
,
"mse"
)
...
...
This diff is collapsed.
Click to expand it.
R/sfcb_methods.R
+
3
−
1
View file @
b6c8aa3d
...
...
@@ -27,7 +27,9 @@
#' represent the importance. Default to \code{"boxplot"}
#' @param quality.crit character vector (length 1 or 2) indicating one or two
#' quality criteria to display. The values have to be taken in \{\code{"mse"},
#' \code{"Precision"}, \code{"Recall"}, \code{"ARI"}, \code{"NMI"}\}
#' \code{"time"}, \code{"Precision"}, \code{"Recall"}, \code{"ARI"},
#' \code{"NMI"}\}. If \code{"time"} is chosen, it can not be associated with any
#' other criterion
#' @param ... not used
#' @param at numeric vector. Set of the number of intervals to extract for
#' @param ground_truth numeric vector of ground truth. Target variables
...
...
This diff is collapsed.
Click to expand it.
man/SFCB-class.Rd
+
3
−
1
View file @
b6c8aa3d
...
...
@@ -51,7 +51,9 @@ represent the importance. Default to \code{"boxplot"}}
\item{quality.crit}{character vector (length 1 or 2) indicating one or two
quality criteria to display. The values have to be taken in \{\code{"mse"},
\code{"Precision"}, \code{"Recall"}, \code{"ARI"}, \code{"NMI"}\}}
\code{"time"}, \code{"Precision"}, \code{"Recall"}, \code{"ARI"},
\code{"NMI"}\}. If \code{"time"} is chosen, it can not be associated with any
other criterion}
\item{at}{numeric vector. Set of the number of intervals to extract for}
...
...
This diff is collapsed.
Click to expand it.
Nathalie Vialaneix
@nathalie.villa-vialaneix
mentioned in issue
#8 (closed)
·
2 years ago
mentioned in issue
#8 (closed)
mentioned in issue #8
Toggle commit list
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