Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Mining Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Desiree Wyrzykala
Data Mining Project
Commits
3d61f41a
Commit
3d61f41a
authored
2 months ago
by
Desi
Browse files
Options
Downloads
Patches
Plain Diff
merge with main delete prints
parent
6d2ba2da
Branches
dev_desi/ploy
Branches containing commit
No related tags found
1 merge request
!15
merge with main delete prints
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/models/desi/call_poly.py
+5
-2
5 additions, 2 deletions
src/models/desi/call_poly.py
src/run_model_wrapper.py
+6
-6
6 additions, 6 deletions
src/run_model_wrapper.py
with
11 additions
and
8 deletions
src/models/desi/call_poly.py
+
5
−
2
View file @
3d61f41a
...
...
@@ -8,7 +8,7 @@ from src.run_model_wrapper import main
#optimal hyperparameters from autors: 'POLY': {'periodicity': 1, 'power': 4}
params
=
{
'
periodicity
'
:
[
1
,
2
,
3
],
'
power
'
:
[
1
,
2
,
3
,
4
,
5
,
7
]
'
power
'
:
[
1
,
2
,
3
,
4
,
5
]
}
def
run_POLY
(
data
,
periodicity
=
1
,
power
=
3
,
n_jobs
=
1
):
...
...
@@ -22,4 +22,7 @@ model = 'POLY'
output_path
=
'
../../../docs/evaluation/
'
#writes results in .csv
main
(
run_POLY
,
params
,
model
,
data_folders
=
'
../../../data/
'
,
model_type
=
'
unsupervised
'
,
output_dir
=
output_path
)
\ No newline at end of file
main
(
run_POLY
,
params
,
model
,
data_folders
=
'
../../../data/
'
,
model_type
=
'
unsupervised
'
,
output_dir
=
output_path
)
#pip3 install -r requirements.txt
# python src/models/desi/call_poly.py
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/run_model_wrapper.py
+
6
−
6
View file @
3d61f41a
...
...
@@ -261,11 +261,11 @@ def main(run_model, hyperparams, model_name, data_folders = '../../../data/', mo
#go through all files in train data and store additionally informations about group and anomaly types
grid_List
=
[]
print
(
f
"
Start Processing files
"
)
#
print(f"Start Processing files")
#reutrns [{file_name:str,train_data:list,data:list, label:list, sliding_window:int}]
file_data_dict_list
=
preprocess_data
(
path_data_all
)
print
(
'
Start Hyperparameter Tuning
'
)
#
print('Start Hyperparameter Tuning')
# Creates combinations of all hyperparameters
param_combinations
=
list
(
itertools
.
product
(
*
hyperparams
.
values
()))
#find hyperparametrs for each file:
...
...
@@ -278,21 +278,21 @@ def main(run_model, hyperparams, model_name, data_folders = '../../../data/', mo
# Hyperparameter-Optimierung
best_params
=
hyperparameter_optimization
(
run_model
,
data
,
label
,
train_data
,
hyperparams
,
sliding_window
,
param_combinations
,
model_type
)
print
(
f
"
File:
{
filename
}
, best hyperparameter:
{
best_params
}
"
)
#
print(f"File: {filename}, best hyperparameter: {best_params}")
#grid_list looks like this: [{ params: {key:value}, file_name:str,train_data:list,data:list, label:list, sliding_window:int}]
grid_List
.
append
({
'
file_name
'
:
filename
,
'
params
'
:
best_params
,
'
train_data
'
:
train_data
,
'
data
'
:
data
,
'
label
'
:
label
,
'
sliding_window
'
:
sliding_window
})
print
(
'
Start Training and evaluation
'
)
#
print('Start Training and evaluation')
results_list
=
train_test_model
(
run_model
,
grid_List
,
path_to_folder
,
model_type
)
#convert list of dicts to a dict with lists
results
=
create_dict_from_array
(
results_list
)
#check duration time
duration
=
sum
(
results
[
'
duration
'
])
print
(
f
'
Job done. Duration:
{
duration
:
.
3
f
}
seconds
'
)
#
print(f'Job done. Duration: {duration:.3f} seconds')
#store results for each model by folder
results_df
=
pd
.
DataFrame
(
results
)
output_csv
=
os
.
path
.
join
(
output_dir
,
model_name
+
'
.csv
'
)
results_df
.
to_csv
(
output_csv
,
index
=
False
)
print
(
f
"
Ergebnisse gespeichert in:
{
output_csv
}
"
)
#
print(f"Ergebnisse gespeichert in: {output_csv}")
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