Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dADP
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luca Tornatore
dADP
Commits
bb07cd30
Commit
bb07cd30
authored
7 months ago
by
lykos98
Browse files
Options
Downloads
Patches
Plain Diff
deleted other unnecessary files
parent
dd3eed92
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
check.py
+0
-110
0 additions, 110 deletions
check.py
var.py
+0
-6
0 additions, 6 deletions
var.py
with
2 additions
and
116 deletions
.gitignore
+
2
−
0
View file @
bb07cd30
...
@@ -4,3 +4,5 @@ leo_sync.sh
...
@@ -4,3 +4,5 @@ leo_sync.sh
bb
bb
**.ipynb*
**.ipynb*
scalability_results
scalability_results
check.py
var.py
This diff is collapsed.
Click to expand it.
check.py
deleted
100644 → 0
+
0
−
110
View file @
dd3eed92
#!/usr/bin/env python
# coding: utf-8
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
sklearn.neighbors
import
NearestNeighbors
ndims
=
5
k
=
500
p
=
10
with
open
(
"
bb/top_nodes.csv
"
,
"
r
"
)
as
f
:
l
=
f
.
readlines
()
def
parse_lines
(
l
,
n_dims
):
ll
=
[
line
.
split
(
"
,
"
)
for
line
in
l
]
level
=
np
.
array
([
int
(
line
[
0
])
for
line
in
ll
])
owner
=
np
.
array
([
int
(
line
[
1
])
for
line
in
ll
])
split_dim
=
np
.
array
([
int
(
line
[
2
])
for
line
in
ll
])
split_val
=
np
.
array
([
float
(
line
[
3
])
for
line
in
ll
])
box_lb
=
np
.
array
([
[
float
(
el
)
for
el
in
line
[
4
:(
4
+
n_dims
)]]
for
line
in
ll
])
box_ub
=
np
.
array
([
[
float
(
el
)
for
el
in
line
[
4
+
n_dims
:]]
for
line
in
ll
])
return
level
,
owner
,
split_dim
,
split_val
,
box_lb
,
box_ub
def
plot_boxes
(
x
,
d0
,
d1
,
owner
,
split_dim
,
split_val
,
box_lb
,
box_ub
,
ratio
=
0.7
):
from
matplotlib.patches
import
Rectangle
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
12
*
ratio
,
10
*
ratio
))
ax
.
scatter
(
x
[:,
d0
],
x
[:,
d1
],
s
=
0.1
)
procs
=
np
.
where
(
owner
!=
-
1
)
for
p
in
procs
[
0
]:
lbx
=
box_lb
[
p
,
d0
]
ubx
=
box_ub
[
p
,
d0
]
lby
=
box_lb
[
p
,
d1
]
uby
=
box_ub
[
p
,
d1
]
bw
=
ubx
-
lbx
bh
=
uby
-
lby
col
=
(
np
.
random
.
rand
(),
np
.
random
.
rand
(),
np
.
random
.
rand
(),
0.5
)
ax
.
add_patch
(
Rectangle
((
lbx
,
lby
),
bw
,
bh
,
facecolor
=
col
,
label
=
owner
[
p
]))
plt
.
legend
(
loc
=
"
lower left
"
)
#ax.add_patch(Rectangle((lbx,lby),2,2, facecolor = (np.random.rand(),np.random.rand(),np.random.rand(),0.3)))
def
plot_planes
(
x
,
d0
,
d1
,
owner
,
split_dim
,
split_val
,
box_lb
,
box_ub
,
ratio
=
0.7
):
from
matplotlib.patches
import
Rectangle
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
12
*
ratio
,
10
*
ratio
))
ax
.
scatter
(
x
[:,
d0
],
x
[:,
d1
],
s
=
0.1
)
procs
=
np
.
where
(
owner
==
-
1
)[
0
]
for
p
in
procs
:
if
split_dim
[
p
]
==
d0
:
line_bounds
=
[
box_lb
[
p
,
d1
],
box_ub
[
p
,
d1
]]
line_coord
=
split_val
[
p
]
#print("vline",split_dim[p],split_dim[p], line_bounds, line_coord)
plt
.
vlines
(
line_coord
,
line_bounds
[
0
],
line_bounds
[
1
],
color
=
"
y
"
)
elif
split_dim
[
p
]
==
d1
:
line_bounds
=
[
box_lb
[
p
,
d0
],
box_ub
[
p
,
d0
]]
line_coord
=
split_val
[
p
]
#print("hline",split_dim[p],split_dim[p], line_bounds, line_coord)
plt
.
hlines
(
line_coord
,
line_bounds
[
0
],
box_ub
[
p
,
d0
],
color
=
"
y
"
)
plt
.
show
()
if
__name__
==
"
__main__
"
:
level
,
owner
,
split_dim
,
split_val
,
box_lb
,
box_ub
=
parse_lines
(
l
,
ndims
)
#x = np.fromfile("../../robavaria/50_blobs_more_var.npy", np.float32)
print
(
"
Loading data file
"
)
x
=
np
.
fromfile
(
"
./bb/ordered_data.npy
"
,
np
.
float64
)
x
=
x
.
reshape
((
x
.
shape
[
0
]
//
ndims
,
ndims
))
#plot_boxes(x,0,1,owner,split_dim,split_val,box_lb,box_ub)
#plot_planes(x,0,1,owner,split_dim,split_val,box_lb,box_ub)
print
(
"
Loading ngbh results
"
)
ngbh
=
[]
for
pp
in
range
(
p
):
ngbh
.
append
(
np
.
fromfile
(
f
"
./bb/rank_
{
pp
}
.ngbh
"
,
dtype
=
[(
"
value
"
,
"
f8
"
),(
"
array_idx
"
,
"
u8
"
)]))
ngbh
=
np
.
concatenate
(
ngbh
)
print
(
"
Searching for neighbors
"
)
nn
=
NearestNeighbors
(
n_jobs
=-
1
,
n_neighbors
=
k
)
nn
.
fit
(
x
)
dist
,
idx
=
nn
.
kneighbors
(
x
)
idx_c
=
ngbh
[
"
array_idx
"
]
idx_c
.
shape
dist_c
=
ngbh
[
"
value
"
]
idx_c
=
idx_c
.
reshape
((
len
(
idx_c
)
//
k
,
k
))
dist_c
=
dist_c
.
reshape
((
len
(
dist_c
)
//
k
,
k
))
same_dist
=
0
sd_el
=
[]
abs_errors
=
0
print
(
"
Check
"
)
for
i
in
range
(
len
(
idx_c
)):
r1
=
idx
[
i
]
r2
=
idx_c
[
i
]
w
=
np
.
where
(
r1
!=
r2
)
if
len
(
w
[
0
])
>
0
:
d1
=
dist
[
i
,
w
[
0
][
0
]]
d2
=
dist
[
i
,
w
[
0
][
1
]]
#print(i, w[0])
if
not
np
.
isclose
(
d1
,
d2
):
abs_errors
+=
1
same_dist
+=
1
#print(" Found error in ", w[0], d1, d2)
print
(
f
"
Found
{
abs_errors
}
errors
"
)
This diff is collapsed.
Click to expand it.
var.py
deleted
100644 → 0
+
0
−
6
View file @
dd3eed92
import
numpy
as
np
d
=
np
.
fromfile
(
"
../norm_data/std_LR_091_0000
"
,
dtype
=
np
.
float32
)
print
(
d
.
shape
)
d
=
d
.
reshape
((
d
.
shape
[
0
]
//
5
,
5
))
print
(
np
.
cov
(
d
.
T
))
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