Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
skais
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
Raphael Sturgis
skais
Merge requests
!10
Resolve "Image creation bugs with 0 size windows"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Resolve "Image creation bugs with 0 size windows"
21-image-creation-bugs-with-0-size-windows
into
main
Overview
0
Commits
27
Pipelines
0
Changes
1
Closed
Raphael Sturgis
requested to merge
21-image-creation-bugs-with-0-size-windows
into
main
3 years ago
Overview
0
Commits
27
Pipelines
0
Changes
1
Expand
Closes
#21 (closed)
0
0
Merge request reports
Viewing commit
243e8f69
Prev
Next
Show latest version
1 file
+
51
−
27
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
243e8f69
Normalisation improvements
· 243e8f69
Raphael
authored
3 years ago
skais/ais/ais_points.py
+
51
−
27
Options
@@ -73,35 +73,59 @@ class AISPoints:
self
.
df
=
self
.
df
[
self
.
df
[
"
heading
"
]
<=
360
]
self
.
df
=
self
.
df
[
self
.
df
[
"
heading
"
]
>=
0
]
def
normalize
(
self
,
features
,
normalization_type
=
"
min-max
"
):
normalization_dict
=
{}
if
normalization_
type
==
"
min-max
"
:
for
f
in
features
:
minimum
=
self
.
df
[
f
].
min
()
max
imum
=
self
.
df
[
f
].
m
ax
()
diff
=
(
maximum
-
minimum
)
if
diff
=
=
0
:
print
(
"
Warning: diff = %d
"
,
diff
)
diff
=
1
self
.
df
[
f
]
=
(
self
.
df
[
f
]
-
minimum
)
/
diff
normalization_dict
[
f
"
{
f
}
_minimum
"
]
=
minimum
normalization_dict
[
f
"
{
f
}
_m
ax
imum
"
]
=
m
ax
imum
elif
normalization_type
==
"
standardization
"
:
normali
s
ation_
factors
=
(
"
standardization
"
,
{})
for
f
in
features
:
mean
=
self
.
df
[
f
].
mean
()
std
=
self
.
df
[
f
].
std
()
if
std
==
0
:
print
(
"
Warning: std = %d
"
,
std
)
std
=
1
self
.
df
[
f
]
=
(
self
.
df
[
f
]
-
mean
)
/
std
normalization_dict
[
f
"
{
f
}
_mean
"
]
=
mean
normalization_dict
[
f
"
{
f
}
_std
"
]
=
std
def
normalize
(
self
,
features
,
normalization_type
=
"
min-max
"
,
normalization_dict
=
None
):
if
normalization_dict
is
None
:
normalization_
dict
=
{
'
normalization_type
'
:
normalization_type
}
if
normalization_type
==
"
min-max
"
:
for
f
in
features
:
min
imum
=
self
.
df
[
f
].
m
in
()
maximum
=
self
.
df
[
f
].
max
(
)
diff
=
(
maximum
-
minimum
)
if
diff
==
0
:
print
(
"
Warning: diff = %d
"
,
diff
)
diff
=
1
self
.
df
[
f
]
=
(
self
.
df
[
f
]
-
minimum
)
/
diff
normalization_dict
[
f
"
{
f
}
_m
in
imum
"
]
=
m
in
imum
normalization_dict
[
f
"
{
f
}
_maximum
"
]
=
maximum
elif
normali
z
ation_
type
=
=
"
standardization
"
:
for
f
in
features
:
mean
=
self
.
df
[
f
].
mean
()
std
=
self
.
df
[
f
].
std
()
if
std
==
0
:
print
(
"
Warning: std = %d
"
,
std
)
std
=
1
self
.
df
[
f
]
=
(
self
.
df
[
f
]
-
mean
)
/
std
normalization_dict
[
f
"
{
f
}
_mean
"
]
=
mean
normalization_dict
[
f
"
{
f
}
_std
"
]
=
std
else
:
raise
ValueError
(
f
"
{
normalization_type
}
not a valid normalization method. Must be on of [min-max,
"
f
"
standardization]
"
)
else
:
raise
ValueError
(
f
"
{
normalization_type
}
not a valid normalization method. Must be on of [min-max,
"
f
"
standardization]
"
)
normalization_type
=
normalization_dict
[
'
normalization_type
'
]
if
normalization_type
==
"
min-max
"
:
for
f
in
features
:
minimum
=
normalization_dict
[
f
"
{
f
}
_minimum
"
]
maximum
=
normalization_dict
[
f
"
{
f
}
_maximum
"
]
diff
=
(
maximum
-
minimum
)
if
diff
==
0
:
print
(
"
Warning: diff = %d
"
,
diff
)
diff
=
1
self
.
df
[
f
]
=
(
self
.
df
[
f
]
-
minimum
)
/
diff
elif
normalization_type
==
"
standardization
"
:
for
f
in
features
:
mean
=
normalization_dict
[
f
"
{
f
}
_mean
"
]
std
=
normalization_dict
[
f
"
{
f
}
_std
"
]
if
std
==
0
:
print
(
"
Warning: std = %d
"
,
std
)
std
=
1
self
.
df
[
f
]
=
(
self
.
df
[
f
]
-
mean
)
/
std
else
:
raise
ValueError
(
f
"
{
normalization_type
}
not a valid normalization method. Must be on of [min-max,
"
f
"
standardization]
"
)
return
normalization_type
,
normalization_dict
# New features
Loading