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
93df7377
Commit
93df7377
authored
2 years ago
by
Michele Alberti
Browse files
Options
Downloads
Patches
Plain Diff
[dataset] Rename some types.
parent
3d666199
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
src/SAVer.ml
+2
-2
2 additions, 2 deletions
src/SAVer.ml
src/dataset.ml
+15
-15
15 additions, 15 deletions
src/dataset.ml
src/dataset.mli
+4
-4
4 additions, 4 deletions
src/dataset.mli
with
21 additions
and
21 deletions
src/SAVer.ml
+
2
−
2
View file @
93df7377
...
...
@@ -111,7 +111,7 @@ let call_prover limit config config_prover predicate =
let
svm
=
predicate
.
Dataset
.
model
.
Language
.
filename
in
let
dataset
=
predicate
.
dataset
in
let
eps
=
match
predicate
.
kind
with
match
predicate
.
property
with
|
Dataset
.
Correct
->
None
|
Robust
e
|
CondRobust
e
->
Some
e
in
...
...
@@ -134,4 +134,4 @@ let call_prover limit config config_prover predicate =
~
printing_info
:
Printer
.
default_printing_info
(
Buffer
.
create
10
)
in
let
prover_result
=
Call_provers
.
wait_on_call
prover_call
in
build_answer
predicate
.
kind
prover_result
build_answer
predicate
.
property
prover_result
This diff is collapsed.
Click to expand it.
src/dataset.ml
+
15
−
15
View file @
93df7377
...
...
@@ -23,13 +23,13 @@
open
Why3
open
Base
type
feature_scaling
=
type
normalization
=
|
MinMax
of
float
*
float
(* min-max scaling *)
|
Znorm
of
float
*
float
(* z-normalization (mean, standard deviation) *)
let
require_clipping
=
function
MinMax
_
->
true
|
Znorm
_
->
false
let
apply_
feature_scaling
csv
ds
=
let
apply_
normalization
csv
ds
=
let
transform
=
match
ds
with
|
MinMax
(
min
,
max
)
->
fun
e
->
(
e
-.
min
)
/.
(
max
-.
min
)
...
...
@@ -44,7 +44,7 @@ let apply_feature_scaling csv ds =
in
class_
::
features
)
let
interpret_
feature_scaling
=
let
interpret_
normalization
=
let
float_of_real_constant
rc
=
Float
.
of_string
(
Fmt
.
str
"%a"
Number
.(
print_real_constant
full_support
)
rc
)
in
...
...
@@ -81,7 +81,7 @@ let interpret_feature_scaling =
type
eps
=
Constant
.
constant
type
pr
edicate_kind
=
type
pr
operty
=
|
Correct
|
Robust
of
eps
|
CondRobust
of
eps
...
...
@@ -89,8 +89,8 @@ type predicate_kind =
type
(
'
a
,
'
b
)
predicate
=
{
model
:
'
a
;
dataset
:
'
b
;
feature_scaling
:
feature_scaling
list
;
kind
:
predicate_kind
;
normalization
:
normalization
list
;
property
:
property
;
}
let
string_of_eps
eps
=
Fmt
.
str
"%a"
Constant
.
print_def
eps
...
...
@@ -112,7 +112,7 @@ let failwith_unsupported_ls ls =
let
interpret_predicate
env
~
on_model
~
on_dataset
task
=
let
task
=
Trans
.
apply
Introduction
.
introduce_premises
task
in
let
feature_scaling
=
Trans
.
apply
interpret_
feature_scaling
task
in
let
normalization
=
Trans
.
apply
interpret_
normalization
task
in
let
term
=
Task
.
task_goal_fmla
task
in
match
term
.
t_node
with
|
Term
.
Tapp
...
...
@@ -120,7 +120,7 @@ let interpret_predicate env ~on_model ~on_dataset task =
{
t_node
=
Tapp
(
model
,
_
);
_
}
::
{
t_node
=
Tapp
(
dataset
,
_
);
_
}
::
tt
)
->
let
kind
=
let
property
=
match
tt
with
|
[]
->
let
correct_predicate
=
find_predicate_ls
env
"correct"
in
...
...
@@ -139,7 +139,7 @@ let interpret_predicate env ~on_model ~on_dataset task =
in
let
dataset
=
on_dataset
dataset
in
let
model
=
on_model
model
in
{
model
;
dataset
;
feature_scaling
;
kind
}
{
model
;
dataset
;
normalization
;
property
}
|
_
->
(* No other term node is supported. *)
failwith_unsupported_term
term
...
...
@@ -240,12 +240,12 @@ let add_decls ~id task n =
let
tasks_of_nn_csv_predicate
env
(
predicate
:
(
Language
.
nn_shape
,
Csv
.
t
)
predicate
)
=
let
clip
,
dataset
=
List
.
fold
predicate
.
feature_scaling
~
init
:
(
false
,
predicate
.
dataset
)
List
.
fold
predicate
.
normalization
~
init
:
(
false
,
predicate
.
dataset
)
~
f
:
(
fun
(
rc
,
dataset
)
fs
->
(
rc
||
require_clipping
fs
,
apply_
feature_scaling
dataset
fs
))
(
rc
||
require_clipping
fs
,
apply_
normalization
dataset
fs
))
in
let
real
_theory
=
Env
.
read_theory
env
[
"real"
]
"Real"
in
let
task
=
Task
.
use_export
None
real
_theory
in
let
th_
real
=
Env
.
read_theory
env
[
"real"
]
"Real"
in
let
task
=
Task
.
use_export
None
th_
real
in
(* Add input declarations. *)
let
inputs
,
task
=
add_decls
~
id
:
(
Fmt
.
str
"X_%d"
)
task
predicate
.
model
.
Language
.
nb_inputs
...
...
@@ -267,8 +267,8 @@ let tasks_of_nn_csv_predicate env
tasks
)
else
let
task
=
add_input_decls
~
clip
predicate
.
kind
~
inputs
~
record
real
_theory
task
|>
add_output_decl
~
id
predicate
.
kind
~
outputs
~
record
real
_theory
add_input_decls
~
clip
predicate
.
property
~
inputs
~
record
th_
real
task
|>
add_output_decl
~
id
predicate
.
property
~
outputs
~
record
th_
real
in
task
::
tasks
)
in
...
...
This diff is collapsed.
Click to expand it.
src/dataset.mli
+
4
−
4
View file @
93df7377
...
...
@@ -24,18 +24,18 @@ open Why3
type
eps
type
pr
edicate_kind
=
private
type
pr
operty
=
private
|
Correct
|
Robust
of
eps
|
CondRobust
of
eps
type
feature_scaling
type
normalization
type
(
'
model
,
'
dataset
)
predicate
=
private
{
model
:
'
model
;
dataset
:
'
dataset
;
feature_scaling
:
feature_scaling
list
;
kind
:
predicate_kind
;
normalization
:
normalization
list
;
property
:
property
;
}
val
string_of_eps
:
eps
->
string
...
...
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