Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gext
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
Service Desk
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
Michele Nottoli
gext
Commits
0a72fd08
Commit
0a72fd08
authored
1 year ago
by
Michele Nottoli
Browse files
Options
Downloads
Patches
Plain Diff
Lint.
parent
e7af1061
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!4
Options
Pipeline
#1951
passed
1 year ago
Stage: test
Stage: lint
Stage: coverage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gext/fitting.py
+10
-5
10 additions, 5 deletions
gext/fitting.py
gext/main.py
+2
-1
2 additions, 1 deletion
gext/main.py
with
12 additions
and
6 deletions
gext/fitting.py
+
10
−
5
View file @
0a72fd08
"""
Module which provides functionality to perform fitting.
"""
"""
Module which provides functionality to perform fitting.
"""
import
abc
from
typing
import
List
from
typing
import
List
import
numpy
as
np
import
numpy
as
np
import
abc
class
AbstractFitting
(
abc
.
ABC
):
class
AbstractFitting
(
abc
.
ABC
):
"""
Base class for fitting schemes.
"""
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
self
.
set_options
(
**
kwargs
)
self
.
set_options
(
**
kwargs
)
...
@@ -35,6 +37,7 @@ class LeastSquare(AbstractFitting):
...
@@ -35,6 +37,7 @@ class LeastSquare(AbstractFitting):
}
}
def
set_options
(
self
,
**
kwargs
):
def
set_options
(
self
,
**
kwargs
):
"""
Set options for least square minimization
"""
self
.
options
=
{}
self
.
options
=
{}
for
key
,
value
in
kwargs
.
items
():
for
key
,
value
in
kwargs
.
items
():
if
key
in
self
.
supported_options
:
if
key
in
self
.
supported_options
:
...
@@ -43,7 +46,7 @@ class LeastSquare(AbstractFitting):
...
@@ -43,7 +46,7 @@ class LeastSquare(AbstractFitting):
raise
ValueError
(
f
"
Unsupported option:
{
key
}
"
)
raise
ValueError
(
f
"
Unsupported option:
{
key
}
"
)
for
option
,
default_value
in
self
.
supported_options
.
items
():
for
option
,
default_value
in
self
.
supported_options
.
items
():
if
not
option
in
self
.
options
:
if
option
not
in
self
.
options
:
self
.
options
[
option
]
=
default_value
self
.
options
[
option
]
=
default_value
if
self
.
options
[
"
regularization
"
]
<
0
\
if
self
.
options
[
"
regularization
"
]
<
0
\
...
@@ -59,8 +62,10 @@ class LeastSquare(AbstractFitting):
...
@@ -59,8 +62,10 @@ class LeastSquare(AbstractFitting):
class
QuasiTimeReversible
(
AbstractFitting
):
class
QuasiTimeReversible
(
AbstractFitting
):
def
set_options
(
**
kwargs
):
"""
Quasi time reversible fitting scheme. Not yet implemented.
"""
"""
TODO
"""
def
compute
(
self
):
def
set_options
(
self
,
**
kwargs
):
"""
Set options for quasi time reversible fitting
"""
def
compute
(
self
,
vectors
:
List
[
np
.
ndarray
],
target
:
np
.
ndarray
):
"""
Time reversible least square minimization fitting.
"""
"""
Time reversible least square minimization fitting.
"""
This diff is collapsed.
Click to expand it.
gext/main.py
+
2
−
1
View file @
0a72fd08
...
@@ -108,7 +108,8 @@ class Extrapolator:
...
@@ -108,7 +108,8 @@ class Extrapolator:
gammas
=
self
.
gammas
.
get
(
n
)
gammas
=
self
.
gammas
.
get
(
n
)
gamma
=
self
.
fitting_calculator
.
linear_combination
(
gammas
,
fit_coefficients
)
gamma
=
self
.
fitting_calculator
.
linear_combination
(
gammas
,
fit_coefficients
)
fit_descriptor
=
self
.
fitting_calculator
.
linear_combination
(
prev_descriptors
,
fit_coefficients
)
fit_descriptor
=
self
.
fitting_calculator
.
linear_combination
(
prev_descriptors
,
fit_coefficients
)
if
self
.
options
[
"
verbose
"
]:
if
self
.
options
[
"
verbose
"
]:
print
(
"
error on descriptor:
"
,
\
print
(
"
error on descriptor:
"
,
\
...
...
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