Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
caisar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
caisar
Commits
c620b39f
Commit
c620b39f
authored
3 years ago
by
Julien Girard-Satabin
Browse files
Options
Downloads
Patches
Plain Diff
[SAVer] Test for SVM parser.
parent
2fc02270
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/ovo/ovo.ml
+4
-4
4 additions, 4 deletions
lib/ovo/ovo.ml
tests/TestSVM.ovo
+9
-8
9 additions, 8 deletions
tests/TestSVM.ovo
tests/dune
+1
-0
1 addition, 0 deletions
tests/dune
tests/simple_ovo.t
+47
-0
47 additions, 0 deletions
tests/simple_ovo.t
with
61 additions
and
12 deletions
lib/ovo/ovo.ml
+
4
−
4
View file @
c620b39f
...
@@ -44,11 +44,10 @@ let skip_ovo_header filename in_channel =
...
@@ -44,11 +44,10 @@ let skip_ovo_header filename in_channel =
|
End_of_file
->
|
End_of_file
->
Error
(
Format
.
sprintf
"OVO model not found in file `%s'."
filename
)
Error
(
Format
.
sprintf
"OVO model not found in file `%s'."
filename
)
(* Retrieve
number of layers,
inputs
,
outputs
and maximum layer
size. *)
(* Retrieve inputs
and
outputs size. *)
let
handle_ovo_basic_info
in_channel
=
let
handle_ovo_basic_info
in_channel
=
match
handle_ovo_line
~
f
:
Int
.
of_string
in_channel
with
match
handle_ovo_line
~
f
:
Int
.
of_string
in_channel
with
|
[
n_layers
;
n_inputs
;
n_outputs
;
max_layer_size
]
->
|
[
dim
]
->
Ok
dim
Ok
(
n_layers
,
n_inputs
,
n_outputs
,
max_layer_size
)
|
_
->
ovo_format_error
"second"
|
_
->
ovo_format_error
"second"
|
exception
End_of_file
->
ovo_format_error
"second"
|
exception
End_of_file
->
ovo_format_error
"second"
...
@@ -67,8 +66,9 @@ let parse_in_channel filename in_channel =
...
@@ -67,8 +66,9 @@ let parse_in_channel filename in_channel =
try
try
skip_ovo_header
filename
in_channel
>>=
fun
()
->
skip_ovo_header
filename
in_channel
>>=
fun
()
->
let
in_channel
=
Csv
.
of_channel
in_channel
in
let
in_channel
=
Csv
.
of_channel
in_channel
in
handle_ovo_basic_info
in_channel
>>=
fun
(
_
,
n_is
,
n_os
,
_
)
->
handle_ovo_unused_flag
in_channel
>>=
fun
()
->
handle_ovo_unused_flag
in_channel
>>=
fun
()
->
handle_ovo_basic_info
in_channel
>>=
fun
(
n_is
)
->
handle_ovo_basic_info
in_channel
>>=
fun
(
n_os
)
->
Csv
.
close_in
in_channel
;
Csv
.
close_in
in_channel
;
Ok
{
n_inputs
=
n_is
;
n_outputs
=
n_os
}
Ok
{
n_inputs
=
n_is
;
n_outputs
=
n_os
}
with
with
...
...
This diff is collapsed.
Click to expand it.
tests/TestSVM.ovo
+
9
−
8
View file @
c620b39f
// Generated using the base example shown at https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html
ovo
ovo 2 2
3
2
rbf auto
rbf auto
2 2
2 2
1 2
1 2
-0.6
592196433465484 -0.47786540839731506 0.6612929735049311 0.4757920782389323
-0.6
19789656282082 -0.47452400048273524 0.6201752226538415 0.4741384341109759
-0.6324555320336759 -1.0
-0.6324555320336759 -1.0
-1.0
-1.2649110640673518 -1.0
-1.2649110640673518 -1.0
-1.0
0.6324555320336759 1.0
0.6324555320336759 1.0
1.0
1.2649110640673518 1.0
1.2649110640673518 1.0
1.0
-
2.866041953212284
e-0
5
-
3.135855377809087
e-0
6
This diff is collapsed.
Click to expand it.
tests/dune
+
1
−
0
View file @
c620b39f
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
(package caisar)
(package caisar)
TestNetwork.nnet
TestNetwork.nnet
TestNetworkONNX.onnx
TestNetworkONNX.onnx
TestSVM.ovo
bin/pyrat.py
bin/pyrat.py
bin/Marabou
bin/Marabou
bin/saver
bin/saver
...
...
This diff is collapsed.
Click to expand it.
tests/simple_ovo.t
0 → 100644
+
47
−
0
View file @
c620b39f
Test
verify
$
cat
-
>
bin
/
alt
-
ergo
<<
EOF
>
#!/bin/sh
>
echo
"
2.4.0
"
>
EOF
$
chmod
u
+
x
bin
/alt-ergo bin/p
yrat
.
py
bin
/Marabou bin/sa
ver
$
bin
/
alt
-
ergo
2.4.0
$
bin
/
pyrat
.
py
--
version
PyRAT
1.1
$
bin
/
Marabou
--
version
1.0
.+
$
bin
/
saver
--
version
v1
.0
$
PATH
=
$
(
pwd
)
/
bin:$PATH
$
caisar
verify
-
L
.
--
format
whyml
--
prover
=
PyRAT
-
2
>&
1
<<
EOF
|
sed
'
s/\/tmp\/[a-z0-9./]*/$TMPFILE/
'
>
theory
T
>
use
TestSVM
.
AsArray
>
use
ieee_float
.
Float64
>
use
caisar
.
IOShape
>
>
goal
G:
forall
x1
x2
x3
.
>
(
0.0
:
t
)
.<
x1
.<
(
0.5
:
t
)
->
>
let
(
y1
,
_
)
=
svm_apply
x1
x2
x3
in
>
(
0.0
:
t
)
.<
y1
.<
(
0.5
:
t
)
>
end
>
EOF
<
autodetect
>
0
prover
(
s) added
<autodetect>Generating strategies:
<autodetect>Run: (Marabou --version) > $TMPFILE 2>&1
<autodetect>Run: (alt-ergo --version)
>
$TMPFILE
2
>&
1
<
autodetect
>
Run:
(
pyrat
.
py
--
version
)
>
$TMPFILE
2
>&
1
<
autodetect
>
Run:
(
saver
--
version
2
>&
1
|
cat
)
>
$TMPFILE
2
>&
1
<
autodetect
>
Found
prover
Alt
-
Ergo
version
2.4.0
,
OK
.
<
autodetect
>
Found
prover
Marabou
version
1.0
.+
,
OK
.
<
autodetect
>
Found
prover
PyRAT
version
1.1
,
OK
.
<
autodetect
>
Found
prover
SAVer
version
v1
.0
,
OK
.
<
autodetect
>
4
prover
(
s
)
added
Goal
G:
Unknown
()
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