Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
ML Quant Sep
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hachem Kadri
ML Quant Sep
Commits
e236fcd2
Commit
e236fcd2
authored
2 years ago
by
Balthazar Casale
Browse files
Options
Downloads
Patches
Plain Diff
Update 2 files
- /src/models/approx_based.py - /README.md
parent
07bb4e21
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+5
-3
5 additions, 3 deletions
README.md
src/models/approx_based.py
+10
-0
10 additions, 0 deletions
src/models/approx_based.py
with
15 additions
and
3 deletions
README.md
+
5
−
3
View file @
e236fcd2
...
@@ -24,12 +24,13 @@ We give a typical use case in the following snipped of code :
...
@@ -24,12 +24,13 @@ We give a typical use case in the following snipped of code :
```
python
```
python
from
types
import
save_dmstack
,
load_dmstack
from
types
import
save_dmstack
,
load_dmstack
from
pipeline
import
*
from
pipeline
import
*
from
samplers.mixed
import
RandomInduced
from
models.criteria
import
PPT
from
models.criteria
import
PPT
from
models.approx_based
import
DistToSep
from
models.approx_based
import
DistToSep
from
transformers.sep_approximation
import
FrankWolfe
from
transformers.sep_approximation
import
FrankWolfe
states
,
infos
=
Pipeline
([
states
,
infos
=
Pipeline
([
(
'
sample
'
,
Induced
Measure
(
k_params
=
[
25
]).
states
),
# induced measure of parameter 25
(
'
sample
'
,
Random
Induced
(
k_params
=
[
25
]).
states
),
# induced measure of parameter 25
(
'
ppt only
'
,
select
(
PPT
.
is_respected
,
True
)),
# respecting the PPT criterion
(
'
ppt only
'
,
select
(
PPT
.
is_respected
,
True
)),
# respecting the PPT criterion
(
'
fw
'
,
add
(
FrankWolfe
(
1000
).
approximation
,
key
=
'
approx
'
),
# compute the sep approx.
(
'
fw
'
,
add
(
FrankWolfe
(
1000
).
approximation
,
key
=
'
approx
'
),
# compute the sep approx.
(
'
sel ent
'
,
select
(
DistToSep
(
0.01
,
sep_key
=
'
fw__approx
'
).
predict
,
Label
.
ENT
))
(
'
sel ent
'
,
select
(
DistToSep
(
0.01
,
sep_key
=
'
fw__approx
'
).
predict
,
Label
.
ENT
))
...
@@ -55,6 +56,7 @@ def sampler(n_states : int, dims : list[int]) -> DMStack, dict
...
@@ -55,6 +56,7 @@ def sampler(n_states : int, dims : list[int]) -> DMStack, dict
```
```
the following samplers can be found in the library :
the following samplers can be found in the library :
-
samplers.utils.FromSet
-
samplers.pure.RandomHaar
-
samplers.pure.RandomHaar
-
samplers.mixed.RandomInduced
-
samplers.mixed.RandomInduced
-
samplers.mixed.RandomBures
-
samplers.mixed.RandomBures
...
@@ -71,8 +73,8 @@ def transformer(states : DMStack, infos : dict) -> DMStack, dict
...
@@ -71,8 +73,8 @@ def transformer(states : DMStack, infos : dict) -> DMStack, dict
the following transformers can be found in the library :
the following transformers can be found in the library :
-
transformers.sep_approximations.FrankWolfe
-
transformers.sep_approximations.FrankWolfe
-
transformers.
real_
representation.GellMann
-
transformers.representation
s
.GellMann
-
transformer.
real_
representation.Measures
-
transformer.representation
s
.Measures
### model
### model
...
...
This diff is collapsed.
Click to expand it.
src/models/approx_based.py
+
10
−
0
View file @
e236fcd2
...
@@ -7,6 +7,16 @@ from ..types import Label
...
@@ -7,6 +7,16 @@ from ..types import Label
import
numpy
as
np
import
numpy
as
np
class
MlModel
:
"""
Use a machine learning model (sklearn) as model
"""
def
__init__
(
self
,
model
)
:
self
.
model
=
model
def
predict
(
self
,
states
,
infos
=
{}):
return
self
.
model
.
predict
(
state
),
{}
class
DistToSep
:
class
DistToSep
:
"""
"""
Distance from a separable approximation
Distance from a separable approximation
...
...
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