Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quantum Support Vector Regression
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
sdlrs
Quantum Support Vector Regression
Commits
42c57a5f
Commit
42c57a5f
authored
Jul 12, 2022
by
Edoardo Pasetto
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
0248ba05
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
GRSL/MERIS_dataset_generation/meris_case_1.py
+82
-0
82 additions, 0 deletions
GRSL/MERIS_dataset_generation/meris_case_1.py
with
82 additions
and
0 deletions
GRSL/MERIS_dataset_generation/meris_case_1.py
0 → 100644
+
82
−
0
View file @
42c57a5f
import
numpy
as
np
import
os
import
library
as
lib
from
pathlib
import
Path
CURRENT_DIR
=
Path
(
__file__
).
parent
#mu and sigmas refer to the underlying normal distribution, not the distribution itself
wl_array
=
[
412.5
,
442.5
,
490
,
510
,
560
,
620
,
665
,
681.25
]
n_samples
=
650
C_mu
=-
0.86
X_mu
=-
1.21
Y_mu
=-
1.75
C_sigma
=
0.3
X_sigma
=
0.3
Y_sigma
=
0.3
corr_CX
=
0.8
corr_CY
=
0.8
##########################################à
mu
=
np
.
array
([
C_mu
,
X_mu
,
Y_mu
])
cov
=
np
.
zeros
((
len
(
mu
),
len
(
mu
)))
cov
[
0
,
0
]
=
C_sigma
cov
[
1
,
1
]
=
X_sigma
cov
[
2
,
2
]
=
Y_sigma
cov_CX
=
corr_CX
*
C_sigma
*
X_sigma
cov_CY
=
corr_CY
*
C_sigma
*
Y_sigma
#######################################
cov
[
0
,
1
]
=
cov_CX
cov
[
1
,
0
]
=
cov_CX
cov
[
0
,
2
]
=
cov_CY
cov
[
2
,
0
]
=
cov_CY
###################################
generator
=
np
.
random
.
default_rng
()
samples
=
generator
.
multivariate_normal
(
mean
=
mu
,
cov
=
cov
,
size
=
n_samples
)
oap
=
np
.
power
(
10
,
samples
)
#%%
################################
R
=
np
.
zeros
((
oap
.
shape
[
0
],
len
(
wl_array
)))
for
i
in
range
(
R
.
shape
[
0
]):
C
,
X
,
Y
=
oap
[
i
,:]
R
[
i
,:]
=
lib
.
get_reflectance_vector
(
wl_array
,
C
,
X
,
Y
)
C_array
=
oap
[:,
0
]
save_path
=
CURRENT_DIR
/
'
generated_dataset
'
os
.
makedirs
(
save_path
,
exist_ok
=
True
)
np
.
save
(
save_path
/
'
target.npy
'
,
C_array
)
np
.
save
(
save_path
/
'
input.npy
'
,
R
)
np
.
save
(
save_path
/
'
oap.npy
'
,
oap
)
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