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
8069bfc3
Commit
8069bfc3
authored
1 year ago
by
Michele Nottoli
Browse files
Options
Downloads
Patches
Plain Diff
Lint.
parent
7dfaccc0
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
QTR
Pipeline
#1959
passed
1 year ago
Stage: test
Stage: lint
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gext/fitting.py
+6
-6
6 additions, 6 deletions
gext/fitting.py
with
6 additions
and
6 deletions
gext/fitting.py
+
6
−
6
View file @
8069bfc3
...
...
@@ -61,11 +61,11 @@ class LeastSquare(AbstractFitting):
"""
Given a set of vectors and a target return the fitting
coefficients.
"""
matrix
=
np
.
array
(
vectors
).
T
A
=
matrix
.
T
@
matrix
a
=
matrix
.
T
@
matrix
b
=
matrix
.
T
@
target
if
self
.
options
[
"
regularization
"
]
>
0.0
:
A
+=
np
.
identity
(
len
(
b
))
*
self
.
options
[
"
regularization
"
]
coefficients
=
np
.
linalg
.
solve
(
A
,
b
)
a
+=
np
.
identity
(
len
(
b
))
*
self
.
options
[
"
regularization
"
]
coefficients
=
np
.
linalg
.
solve
(
a
,
b
)
return
np
.
array
(
coefficients
,
dtype
=
np
.
float64
)
class
QuasiTimeReversible
(
AbstractFitting
):
...
...
@@ -98,12 +98,12 @@ class QuasiTimeReversible(AbstractFitting):
else
:
time_reversible_matrix
=
matrix
[:,
:
q
//
2
+
1
]
+
matrix
[:,
:
q
//
2
-
1
:
-
1
]
A
=
time_reversible_matrix
.
T
@
time_reversible_matrix
a
=
time_reversible_matrix
.
T
@
time_reversible_matrix
b
=
time_reversible_matrix
.
T
@
(
target
+
past_target
)
if
self
.
options
[
"
regularization
"
]
>
0.0
:
A
+=
np
.
identity
(
len
(
b
))
*
self
.
options
[
"
regularization
"
]
coefficients
=
np
.
linalg
.
solve
(
A
,
b
)
a
+=
np
.
identity
(
len
(
b
))
*
self
.
options
[
"
regularization
"
]
coefficients
=
np
.
linalg
.
solve
(
a
,
b
)
if
q
==
1
:
full_coefficients
=
np
.
concatenate
(([
-
1.0
],
coefficients
))
...
...
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