Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AQ-Bench
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
Container registry
Model registry
Operate
Environments
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
esde
machine-learning
AQ-Bench
Commits
67ba865a
Commit
67ba865a
authored
4 years ago
by
Clara Betancourt
Browse files
Options
Downloads
Patches
Plain Diff
eliminate logging
parent
1d025c0e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/dataset_preanalysis.py
+10
-10
10 additions, 10 deletions
source/dataset_preanalysis.py
source/mapping_data.py
+9
-9
9 additions, 9 deletions
source/mapping_data.py
source/utils.py
+6
-6
6 additions, 6 deletions
source/utils.py
with
25 additions
and
25 deletions
source/dataset_preanalysis.py
+
10
−
10
View file @
67ba865a
...
...
@@ -3,7 +3,7 @@ Class and routine for AQbench preanalysis and visualization.
"""
# general
import
logging
#
import logging
# import pdb
# data science
...
...
@@ -88,7 +88,7 @@ class PreVis:
elif
this_res
[
'
data_type
'
]
==
'
str
'
:
fill
=
str
(
this_res
[
'
fill_value
'
])
else
:
logging
.
warning
(
'
Forgotten datatypes?
'
)
pass
#
logging.warning('Forgotten datatypes?')
av
=
round
(
len
(
this_data
[
this_data
!=
fill
])
/
compl
*
100
)
mis
=
100
-
av
this_data
=
this_data
[
this_data
!=
fill
]
...
...
@@ -189,7 +189,7 @@ class PreVis:
self
.
plot_dir
+
column_name
.
replace
(
'
.
'
,
'
p
'
)
+
'
_
'
+
plot_naming
,
dpi
=
175
)
logging
.
info
(
column_name
+
'
plot saved
'
)
#
logging.info(column_name + ' plot saved')
class
PreMis
:
...
...
@@ -287,7 +287,7 @@ def main_previs():
previs
.
vis
(
col
)
plt
.
close
()
except
Exception
as
exc
:
logging
.
warning
(
col
+
'
no plot produced
'
)
#
logging.warning(col + ' no plot produced')
print
(
exc
)
...
...
@@ -319,12 +319,12 @@ if __name__ == '__main__':
"""
# logging
log_file
=
__file__
.
replace
(
'
py
'
,
'
log
'
)
#
log_file = __file__.replace('py', 'log')
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
"
%(asctime)s [%(levelname)s] %(message)s
"
,
handlers
=
[
logging
.
FileHandler
(
log_dir
+
log_file
),
logging
.
StreamHandler
()])
#
logging.basicConfig(
#
level=logging.INFO,
#
format="%(asctime)s [%(levelname)s] %(message)s",
#
handlers=[logging.FileHandler(log_dir+log_file),
#
logging.StreamHandler()])
main_previs
()
main_premis
()
This diff is collapsed.
Click to expand it.
source/mapping_data.py
+
9
−
9
View file @
67ba865a
...
...
@@ -3,7 +3,7 @@ import pandas as pd
from
sklearn
import
preprocessing
import
math
import
logging
#
import logging
from
settings
import
*
from
dataset_datasplit
import
DataSplit
...
...
@@ -73,7 +73,7 @@ class Data:
# Logging
logging
.
info
(
f
'
{
self
.
data_yx
.
shape
[
0
]
}
rows were read in.
'
)
#
logging.info(f'{self.data_yx.shape[0]} rows were read in.')
def
delete_rows
(
self
):
"""
...
...
@@ -93,7 +93,7 @@ class Data:
# Logging
logging
.
info
(
f
'
{
self
.
data_yx
.
shape
[
0
]
}
rows are remaining after deleting invalid ones.
'
)
#
logging.info(f'{self.data_yx.shape[0]} rows are remaining after deleting invalid ones.')
def
transform
(
self
):
"""
...
...
@@ -126,7 +126,7 @@ class Data:
elif
column_name
!=
self
.
target
:
print
(
f
"
!!! Warning !!! Preparation could not be found:
{
row
[
'
column_name
'
]
}
"
)
logging
.
warning
(
f
"
!!! Warning !!! Preparation could not be found:
{
row
[
'
column_name
'
]
}
"
)
#
logging.warning(f"!!! Warning !!! Preparation could not be found: {row['column_name']}")
def
list_inputs
(
self
):
"""
...
...
@@ -210,11 +210,11 @@ class Data:
"""
Set up logging
"""
log_file
=
__file__
.
replace
(
'
py
'
,
'
log
'
).
split
(
"
/
"
)[
-
1
]
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
"
%(asctime)s [%(levelname)s] %(message)s
"
,
filename
=
log_dir
+
log_file
#
log_file = __file__.replace('py', 'log').split("/")[-1]
#
logging.basicConfig(
#
level=logging.DEBUG,
#
format="%(asctime)s [%(levelname)s] %(message)s",
#
filename=log_dir+log_file
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
source/utils.py
+
6
−
6
View file @
67ba865a
...
...
@@ -5,7 +5,7 @@ Helper functions for our project
"""
# general
import
logging
#
import logging
import
pdb
# data science
...
...
@@ -28,7 +28,7 @@ def read_csv_to_df(filename, converters=None):
df
=
pd
.
read_csv
(
filename
,
converters
=
converters
)
return
df
except
Exception
as
exc
:
logging
.
error
(
f
'
Error reading csv file
{
filename
}
'
)
#
logging.error(f'Error reading csv file {filename}')
print
(
exc
)
exit
()
...
...
@@ -41,7 +41,7 @@ def read_pkl_to_df(filename):
df
=
pd
.
read_pickle
(
filename
)
return
df
except
Exception
as
exc
:
logging
.
error
(
f
'
Error reading pickle
{
filename
}
'
)
#
logging.error(f'Error reading pickle {filename}')
print
(
exc
)
...
...
@@ -52,13 +52,13 @@ def save_data_to_file(df, filename):
try
:
if
filename
.
endswith
(
'
pkl
'
):
df
.
to_pickle
(
filename
)
logging
.
info
(
f
'
Data saved to pickle
{
filename
}
'
)
#
logging.info(f'Data saved to pickle {filename}')
elif
filename
.
endswith
(
'
csv
'
):
df
.
to_csv
(
filename
,
index
=
False
)
logging
.
info
(
f
'
Data saved to csv
{
filename
}
'
)
#
logging.info(f'Data saved to csv {filename}')
except
Exception
as
exc
:
logging
.
warning
(
f
'
Could not write file
{
filename
}
'
)
#
logging.warning(f'Could not write file {filename}')
print
(
exc
)
...
...
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