Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TIPM-UI
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
BARBIER Marc
TIPM-UI
Commits
f0e1f8c7
Verified
Commit
f0e1f8c7
authored
3 years ago
by
BARBIER Marc
Browse files
Options
Downloads
Patches
Plain Diff
added filter and anomaly detection
parent
5e1c6edd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/MineView/MineView.ts
+112
-0
112 additions, 0 deletions
src/MineView/MineView.ts
src/MineView/MineView.vue
+86
-0
86 additions, 0 deletions
src/MineView/MineView.vue
with
198 additions
and
0 deletions
src/MineView/MineView.ts
+
112
−
0
View file @
f0e1f8c7
...
...
@@ -13,7 +13,10 @@ export default defineComponent({
selectedPatternColumns
:
null
as
string
[]
|
null
,
selectedSequenceColumns
:
null
as
string
[]
|
null
,
patternData
:
null
as
{
rows
:
string
[][],
totalSize
:
number
,
rowsStartingFrom1
:
string
[][]
}
|
null
,
selectedPatternFPOF
:
[]
as
string
[],
selectedPatternPBAD
:
[]
as
string
[],
arePatternsLoading
:
false
,
currentPattern
:
null
as
string
|
null
,
selectedAlgorithm
:
'
PrefixSpan
'
}
},
...
...
@@ -80,7 +83,9 @@ export default defineComponent({
async
fetchPatterns
(
filename
:
string
)
{
this
.
arePatternsLoading
=
true
this
.
patternData
=
null
this
.
currentPattern
=
null
this
.
patternData
=
await
(
await
fetch
(
`http://localhost:8080/rest/load-patterns-metadata?filename=
${
encodeURIComponent
(
filename
)}
&id=
${
localStorage
.
getItem
(
'
datasetId
'
)}
`
)).
json
()
this
.
currentPattern
=
filename
this
.
arePatternsLoading
=
false
},
...
...
@@ -92,6 +97,113 @@ export default defineComponent({
await
fetch
(
'
http://localhost:8080/rest/mining/remove-patternset
'
,
{
method
:
'
POST
'
,
body
:
form
})
this
.
$router
.
go
(
0
);
},
async
filterLength
(
e
:
Event
)
{
e
.
preventDefault
()
const
currentPattern
=
this
.
currentPattern
;
if
(
currentPattern
)
{
//@ts-expect-error we know target is a form
const
form
=
new
FormData
(
e
.
target
)
form
.
append
(
'
filename
'
,
currentPattern
)
form
.
append
(
'
id
'
,
''
+
localStorage
.
getItem
(
'
datasetId
'
))
await
fetch
(
'
http://localhost:8080/rest/mining/filter-length
'
,
{
method
:
'
POST
'
,
body
:
form
})
this
.
$router
.
go
(
0
);
}
else
{
alert
(
'
Please select a pattern
'
)
}
},
async
filterSupport
(
e
:
Event
)
{
e
.
preventDefault
()
const
currentPattern
=
this
.
currentPattern
;
if
(
currentPattern
)
{
//@ts-expect-error we know target is a form
const
domForm
:
HTMLFormElement
=
e
.
target
const
form
=
new
FormData
(
domForm
)
const
topk
=
form
.
get
(
'
topk
'
)?.
toString
()
if
(
!
topk
||
isNaN
(
parseInt
(
topk
))
||
parseFloat
(
topk
)
<
0
)
{
const
input
=
domForm
.
querySelector
(
'
input
'
)
input
?.
classList
.
add
(
'
is-invalid
'
)
return
}
form
.
append
(
'
filename
'
,
currentPattern
)
form
.
append
(
'
id
'
,
''
+
localStorage
.
getItem
(
'
datasetId
'
))
await
fetch
(
'
http://localhost:8080/rest/mining/filter-support
'
,
{
method
:
'
POST
'
,
body
:
form
})
this
.
$router
.
go
(
0
);
}
else
{
alert
(
'
Please select a pattern
'
)
}
},
async
removeRedundant
(
e
:
Event
)
{
e
.
preventDefault
()
const
currentPattern
=
this
.
currentPattern
;
if
(
currentPattern
)
{
//@ts-expect-error we know target is a form
const
domForm
:
HTMLFormElement
=
e
.
target
const
form
=
new
FormData
(
domForm
)
const
threshold
=
form
.
get
(
'
threshold
'
)?.
toString
()
if
(
!
threshold
||
isNaN
(
parseFloat
(
threshold
))
||
parseFloat
(
threshold
)
<=
0
||
parseFloat
(
threshold
)
>
1
)
{
const
input
=
domForm
.
querySelector
(
'
input
'
)
input
?.
classList
.
add
(
'
is-invalid
'
)
return
}
form
.
append
(
'
filename
'
,
currentPattern
)
form
.
append
(
'
id
'
,
''
+
localStorage
.
getItem
(
'
datasetId
'
))
await
fetch
(
'
http://localhost:8080/rest/mining/filter-jaccard
'
,
{
method
:
'
POST
'
,
body
:
form
})
this
.
$router
.
go
(
0
);
}
else
{
alert
(
'
Please select a pattern
'
)
}
},
async
filterGapSpan
(
e
:
Event
)
{
e
.
preventDefault
()
const
currentPattern
=
this
.
currentPattern
;
if
(
currentPattern
)
{
//@ts-expect-error we know target is a form
const
domForm
:
HTMLFormElement
=
e
.
target
const
form
=
new
FormData
(
domForm
)
const
value
=
form
.
get
(
'
maxspan
'
)?.
toString
()
||
form
.
get
(
'
maxgap
'
)?.
toString
()
if
(
!
value
||
isNaN
(
parseInt
(
value
))
||
parseFloat
(
value
)
<
0
)
{
const
input
=
domForm
.
querySelector
(
'
input
'
)
input
?.
classList
.
add
(
'
is-invalid
'
)
return
}
form
.
append
(
'
filename
'
,
currentPattern
)
form
.
append
(
'
id
'
,
''
+
localStorage
.
getItem
(
'
datasetId
'
))
await
fetch
(
'
http://localhost:8080/rest/mining/filter-time-constraint
'
,
{
method
:
'
POST
'
,
body
:
form
})
this
.
$router
.
go
(
0
);
}
else
{
alert
(
'
Please select a pattern
'
)
}
},
async
FrequentPatternOutliersFactor
(
e
:
Event
)
{
e
.
preventDefault
()
const
form
=
new
FormData
()
form
.
append
(
'
id
'
,
''
+
localStorage
.
getItem
(
'
datasetId
'
))
form
.
append
(
'
patternFilenames
'
,
this
.
selectedPatternFPOF
.
map
(
label
=>
this
.
fileItem
?.
patterns
.
find
(
pattern
=>
pattern
.
label
===
label
)?.
filename
).
join
(
'
,
'
))
await
fetch
(
'
http://localhost:8080/rest/mining/anomaly-detection-fpof
'
,
{
method
:
'
POST
'
,
body
:
form
})
},
async
PatternBasedAnomalyDetection
(
e
:
Event
)
{
e
.
preventDefault
()
console
.
log
(
this
.
selectedPatternPBAD
.
map
(
label
=>
this
.
fileItem
?.
patterns
.
find
(
pattern
=>
pattern
.
label
===
label
)?.
filename
).
join
(
'
,
'
))
const
form
=
new
FormData
()
form
.
append
(
'
id
'
,
''
+
localStorage
.
getItem
(
'
datasetId
'
))
form
.
append
(
'
patternFilenames
'
,
this
.
selectedPatternPBAD
.
map
(
label
=>
this
.
fileItem
?.
patterns
.
find
(
pattern
=>
pattern
.
label
===
label
)?.
filename
).
join
(
'
,
'
))
await
fetch
(
'
http://localhost:8080/rest/mining/anomaly-detection-pbad
'
,
{
method
:
'
POST
'
,
body
:
form
})
}
},
})
This diff is collapsed.
Click to expand it.
src/MineView/MineView.vue
+
86
−
0
View file @
f0e1f8c7
...
...
@@ -110,6 +110,92 @@
</div>
</div>
</div>
<div
class=
"accordion-item"
>
<h2
class=
"accordion-header"
id=
"headingOne"
>
<button
class=
"accordion-button collapsed"
type=
"button"
data-bs-toggle=
"collapse"
data-bs-target=
"#collapseFilters"
aria-expanded=
"false"
aria-controls=
"collapseFilters"
>
Filters
</button>
</h2>
<div
id=
"collapseFilters"
class=
"accordion-collapse collapse"
aria-labelledby=
"headingOne"
>
<div
class=
"accordion-body"
>
<form
@
submit=
"filterLength"
>
<label
class=
"form-label"
>
Filter patterns on length
</label>
<div
class=
"input-group mb-3"
>
<input
type=
"text"
class=
"form-control"
name=
"minlen"
placeholder=
"Min length"
>
<label
class=
"input-group-text"
>
-
</label>
<input
type=
"text"
class=
"form-control"
name=
"maxlen"
placeholder=
"Max length"
>
</div>
<input
type=
"submit"
class=
"btn btn-primary"
value=
"Run"
>
</form>
<hr>
<form
@
submit=
"filterSupport"
>
<label
class=
"form-label"
>
Filter patterns on support
</label>
<input
type=
"text"
class=
"form-control"
name=
"topk"
placeholder=
"Top-k"
>
<span
class=
"form-text"
>
Top-k >= 0
</span>
<br>
<input
type=
"submit"
class=
"btn btn-primary"
value=
"Run"
>
</form>
<hr>
<form
@
submit=
"removeRedundant"
>
<label
class=
"form-label"
>
Remove redundant patterns
</label>
<input
type=
"text"
class=
"form-control"
name=
"threshold"
>
<span
class=
"form-text"
>
Threshold ∈ ]0;1]
</span>
<br>
<input
type=
"submit"
class=
"btn btn-primary"
value=
"Run"
>
</form>
<hr>
<form
@
submit=
"filterGapSpan"
>
<label
class=
"form-label"
>
Filter on Max gap
</label>
<input
type=
"text"
class=
"form-control"
name=
"maxgap"
>
<span
class=
"form-text"
>
Max gap >= 0
</span>
<br>
<input
type=
"submit"
class=
"btn btn-primary"
value=
"Run"
>
</form>
<hr>
<form
@
submit=
"filterGapSpan"
>
<label
class=
"form-label"
>
Filter on MaxSpan
</label>
<input
type=
"text"
class=
"form-control"
name=
"maxspan"
>
<span
class=
"form-text"
>
Max span >= 0
</span>
<br>
<input
type=
"submit"
class=
"btn btn-primary"
value=
"Run"
>
</form>
</div>
</div>
</div>
<div
class=
"accordion-item"
>
<h2
class=
"accordion-header"
id=
"headingOne"
>
<button
class=
"accordion-button"
type=
"button"
data-bs-toggle=
"collapse"
data-bs-target=
"#collapseItemsets"
aria-expanded=
"true"
aria-controls=
"collapseItemsets"
>
Anomaly score
</button>
</h2>
<div
id=
"collapseItemsets"
class=
"accordion-collapse collapse show"
aria-labelledby=
"headingOne"
>
<div
class=
"accordion-body"
>
<form
@
submit=
"FrequentPatternOutliersFactor"
>
<label
class=
"form-label"
>
FP outlier factor
</label>
<Multiselect
mode=
"tags"
:close-on-select=
"false"
:options=
"fileItem?.patterns.map(e => e.label)"
v-model=
"selectedPatternFPOF"
></Multiselect>
<br>
<input
type=
"submit"
value=
"Run"
class=
"btn btn-primary"
>
</form>
<hr>
<form
@
submit=
"PatternBasedAnomalyDetection"
>
<label
class=
"form-label"
>
Pattern based anomaly detection
</label>
<Multiselect
mode=
"tags"
:close-on-select=
"false"
:options=
"fileItem?.patterns.map(e => e.label)"
v-model=
"selectedPatternPBAD"
></Multiselect>
<br>
<input
type=
"submit"
value=
"Run"
class=
"btn btn-primary"
>
</form>
</div>
</div>
</div>
</div>
</aside>
</div>
...
...
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