Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Leipzig Machine Learning Group
conML
python
Commits
ec941e90
Commit
ec941e90
authored
5 years ago
by
dmt
Browse files
Options
Downloads
Patches
Plain Diff
Log datablock processing.
parent
2b9e1089
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cml/domain/data_source.py
+42
-1
42 additions, 1 deletion
cml/domain/data_source.py
with
42 additions
and
1 deletion
cml/domain/data_source.py
+
42
−
1
View file @
ec941e90
...
@@ -2,6 +2,8 @@ from os.path import commonprefix
...
@@ -2,6 +2,8 @@ from os.path import commonprefix
from
itertools
import
cycle
from
itertools
import
cycle
from
array
import
array
from
array
import
array
from
cml.shared.parameter
import
PROTOCOL_LEVEL
__all__
=
(
__all__
=
(
"
DataSource
"
,
"
DataSource
"
,
"
Preprocessor
"
,
"
Preprocessor
"
,
...
@@ -9,22 +11,62 @@ __all__ = (
...
@@ -9,22 +11,62 @@ __all__ = (
)
)
def
log_learnblock_processing
(
func
):
def
wrapper
(
self
):
for
learnblock
in
func
(
self
):
if
self
.
logger
and
self
.
logger
.
level
==
PROTOCOL_LEVEL
:
self
.
logger
.
protocol
(
"
\t
"
.
join
([
""
,
str
(
learnblock
.
length
),
str
(
learnblock
.
min_timestamp
),
str
(
learnblock
.
max_timestamp
),
str
(
learnblock
.
relatives
),
])
)
yield
learnblock
return
wrapper
def
log_block_processing
(
func
):
counter
=
0
def
wrapper
(
self
):
nonlocal
counter
counter
+=
1
block
=
func
(
self
)
if
self
.
logger
and
self
.
logger
.
level
==
PROTOCOL_LEVEL
:
self
.
logger
.
protocol
(
"
\t
"
.
join
([
str
(
counter
),
str
(
block
.
length
),
str
(
block
.
min_timestamp
),
str
(
block
.
max_timestamp
)
])
)
return
block
return
wrapper
class
DataSource
:
class
DataSource
:
_SIGNED_CHAR
=
'
b
'
_SIGNED_CHAR
=
'
b
'
def
__init__
(
self
,
source
,
learnblock_identifier
,
*
,
block_size
):
def
__init__
(
self
,
source
,
learnblock_identifier
,
*
,
block_size
):
self
.
block_size
=
block_size
self
.
block_size
=
block_size
self
.
logger
=
None
self
.
__source
=
source
self
.
__source
=
source
self
.
__learnblock_identifier
=
learnblock_identifier
self
.
__learnblock_identifier
=
learnblock_identifier
self
.
__source_halde_flags
=
None
self
.
__source_halde_flags
=
None
@property
@property
@log_learnblock_processing
def
learnblocks
(
self
):
def
learnblocks
(
self
):
for
block
in
self
:
for
block
in
self
:
learnblock
=
self
.
__learnblock_identifier
.
identify
(
block
)
learnblock
=
self
.
__learnblock_identifier
.
identify
(
block
)
self
.
_flip_source_halde_flags
(
learnblock
.
indexes
)
self
.
_flip_source_halde_flags
(
learnblock
.
indexes
)
yield
learnblock
yield
learnblock
@log_block_processing
def
__next__
(
self
):
def
__next__
(
self
):
return
next
(
self
.
__next_helper
)
return
next
(
self
.
__next_helper
)
...
@@ -44,7 +86,6 @@ class DataSource:
...
@@ -44,7 +86,6 @@ class DataSource:
elif
old_index
>
i
:
elif
old_index
>
i
:
halde_runs
+=
1
halde_runs
+=
1
old_index
=
i
old_index
=
i
counter
=
0
counter
=
0
yield
self
.
__source
.
get_block_via_index
(
block_indexes
)
yield
self
.
__source
.
get_block_via_index
(
block_indexes
)
block_indexes
.
clear
()
block_indexes
.
clear
()
...
...
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