Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cpp_sisso
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
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
nomad-lab
cpp_sisso
Commits
ca70a8f6
Commit
ca70a8f6
authored
4 years ago
by
Thomas Purcell
Browse files
Options
Downloads
Patches
Plain Diff
revert changes with dgemv as it was slower
parent
151837d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/feature_creation/feature_space/FeatureSpace.cpp
+3
-10
3 additions, 10 deletions
src/feature_creation/feature_space/FeatureSpace.cpp
src/utils/compare_features.cpp
+19
-35
19 additions, 35 deletions
src/utils/compare_features.cpp
with
22 additions
and
45 deletions
src/feature_creation/feature_space/FeatureSpace.cpp
+
3
−
10
View file @
ca70a8f6
...
@@ -568,10 +568,8 @@ void FeatureSpace::sis(std::vector<double>& prop)
...
@@ -568,10 +568,8 @@ void FeatureSpace::sis(std::vector<double>& prop)
if
(
node_value_arrs
::
N_SELECTED
>
_n_sis_select
)
if
(
node_value_arrs
::
N_SELECTED
>
_n_sis_select
)
_project
(
prop
.
data
(),
scores_sel_all
.
data
(),
_phi_selected
,
_task_sizes
,
prop
.
size
()
/
_n_samp
);
_project
(
prop
.
data
(),
scores_sel_all
.
data
(),
_phi_selected
,
_task_sizes
,
prop
.
size
()
/
_n_samp
);
for
(
auto
&
feat
:
_phi_selected
)
feat
->
set_standardized_value
();
start
=
omp_get_wtime
();
start
=
omp_get_wtime
();
std
::
cout
<<
"Number of features: "
<<
_start_gen
[
0
]
<<
'\t'
<<
_start_gen
[
1
]
<<
'\t'
<<
_start_gen
[
2
]
<<
'\t'
<<
_n_feat
<<
std
::
endl
;
while
((
cur_feat_local
!=
_n_sis_select
)
&&
(
ii
<
_scores
.
size
()))
while
((
cur_feat_local
!=
_n_sis_select
)
&&
(
ii
<
_scores
.
size
()))
{
{
if
(
_is_valid
(
_phi
[
inds
[
ii
]]
->
value_ptr
(),
_n_samp
,
_cross_cor_max
,
scores_sel_all
,
_scores
[
inds
[
ii
]],
cur_feat
+
cur_feat_local
,
0
))
if
(
_is_valid
(
_phi
[
inds
[
ii
]]
->
value_ptr
(),
_n_samp
,
_cross_cor_max
,
scores_sel_all
,
_scores
[
inds
[
ii
]],
cur_feat
+
cur_feat_local
,
0
))
...
@@ -581,7 +579,7 @@ void FeatureSpace::sis(std::vector<double>& prop)
...
@@ -581,7 +579,7 @@ void FeatureSpace::sis(std::vector<double>& prop)
phi_sel
.
push_back
(
_phi
[
inds
[
ii
]]);
phi_sel
.
push_back
(
_phi
[
inds
[
ii
]]);
phi_sel
.
back
()
->
set_selected
(
true
);
phi_sel
.
back
()
->
set_selected
(
true
);
phi_sel
.
back
()
->
set_d_mat_ind
(
cur_feat
+
cur_feat_local
);
phi_sel
.
back
()
->
set_d_mat_ind
(
cur_feat
+
cur_feat_local
);
phi_sel
.
back
()
->
set_
standardized_
value
();
phi_sel
.
back
()
->
set_value
();
++
cur_feat_local
;
++
cur_feat_local
;
}
}
...
@@ -722,8 +720,6 @@ void FeatureSpace::sis(std::vector<double>& prop)
...
@@ -722,8 +720,6 @@ void FeatureSpace::sis(std::vector<double>& prop)
_phi_selected
[
inds
[
ii
]
+
node_value_arrs
::
N_SELECTED
-
_n_sis_select
]
->
set_value
();
_phi_selected
[
inds
[
ii
]
+
node_value_arrs
::
N_SELECTED
-
_n_sis_select
]
->
set_value
();
++
cur_feat
;
++
cur_feat
;
}
}
for
(
int
ff
=
0
;
ff
<
node_value_arrs
::
N_SELECTED
-
_n_sis_select
;
++
ff
)
_phi_selected
[
ff
]
->
set_value
();
}
}
else
else
{
{
...
@@ -739,14 +735,11 @@ void FeatureSpace::sis(std::vector<double>& prop)
...
@@ -739,14 +735,11 @@ void FeatureSpace::sis(std::vector<double>& prop)
_phi_selected
.
push_back
(
phi_sel
[
ind
]);
_phi_selected
.
push_back
(
phi_sel
[
ind
]);
_phi_selected
.
back
()
->
set_selected
(
true
);
_phi_selected
.
back
()
->
set_selected
(
true
);
_phi_selected
.
back
()
->
set_d_mat_ind
(
cur_feat
);
_phi_selected
.
back
()
->
set_d_mat_ind
(
cur_feat
);
_phi_selected
.
back
()
->
set_
standardized_
value
();
_phi_selected
.
back
()
->
set_value
();
++
cur_feat
;
++
cur_feat
;
++
cur_feat_local
;
++
cur_feat_local
;
}
}
for
(
auto
&
feat
:
_phi_selected
)
feat
->
set_value
();
}
}
if
(
cur_feat
!=
node_value_arrs
::
N_SELECTED
)
if
(
cur_feat
!=
node_value_arrs
::
N_SELECTED
)
...
...
This diff is collapsed.
Click to expand it.
src/utils/compare_features.cpp
+
19
−
35
View file @
ca70a8f6
#include
<utils/compare_features.hpp>
#include
<utils/compare_features.hpp>
std
::
vector
<
double
>
comp_feats
::
CORR_CHECK
;
std
::
vector
<
double
>
comp_feats
::
CORR_CHECK
;
bool
comp_feats
::
valid_feature_against_selected_max_corr_1
(
double
*
val_ptr
,
int
n_samp
,
double
cross_cor_max
,
std
::
vector
<
double
>&
scores_sel
,
double
cur_score
,
int
end_sel
,
int
start_sel
)
bool
comp_feats
::
valid_feature_against_selected_max_corr_1
(
double
*
val_ptr
,
int
n_samp
,
double
cross_cor_max
,
std
::
vector
<
double
>&
scores_sel
,
double
cur_score
,
int
end_sel
,
int
start_sel
)
{
{
double
base_val
=
util_funcs
::
r
(
val_ptr
,
val_ptr
,
n_samp
);
double
base_val
=
util_funcs
::
r
(
val_ptr
,
val_ptr
,
n_samp
);
if
(
std
::
any_of
(
scores_sel
.
begin
()
+
start_sel
,
scores_sel
.
begin
()
+
end_sel
,
[
cur_score
](
double
score
){
return
std
::
abs
(
score
-
cur_score
)
<
1e-5
;})
)
for
(
int
dd
=
start_sel
;
dd
<
end_sel
;
++
dd
)
{
{
double
alpha
=
1.0
/
util_funcs
::
stand_dev
(
val_ptr
,
n_samp
);
if
(
abs
(
cur_score
-
scores_sel
[
dd
])
>
1e-5
)
CORR_CHECK
.
resize
(
end_sel
-
start_sel
);
continue
;
dgemv_
(
'T'
,
if
((
base_val
-
std
::
abs
(
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
dd
),
val_ptr
,
n_samp
)))
<
1e-9
)
n_samp
,
return
false
;
end_sel
-
start_sel
,
alpha
,
node_value_arrs
::
get_d_matrix_ptr
(
start_sel
),
n_samp
,
val_ptr
,
1
,
0.0
,
comp_feats
::
CORR_CHECK
.
data
(),
1
);
return
(
base_val
-
std
::
abs
(
comp_feats
::
CORR_CHECK
[
idamax_
(
end_sel
-
start_sel
,
comp_feats
::
CORR_CHECK
.
data
(),
1
)
-
1
])
>
1e-9
);
}
}
return
true
;
return
true
;
}
}
...
@@ -43,26 +31,22 @@ bool comp_feats::valid_feature_against_selected_max_corr_1_feat_list(double* val
...
@@ -43,26 +31,22 @@ bool comp_feats::valid_feature_against_selected_max_corr_1_feat_list(double* val
return
true
;
return
true
;
}
}
bool
comp_feats
::
valid_feature_against_selected
(
double
*
val_ptr
,
int
n_samp
,
double
cross_cor_max
,
std
::
vector
<
double
>&
scores_sel
,
double
cur_score
,
int
end_sel
,
int
start_sel
)
bool
comp_feats
::
valid_feature_against_selected
(
double
*
val_ptr
,
int
n_samp
,
double
cross_cor_max
,
std
::
vector
<
double
>&
scores_sel
,
double
cur_score
,
int
end_sel
,
int
start_sel
)
{
{
double
base_val
=
util_funcs
::
r
(
val_ptr
,
val_ptr
,
n_samp
);
double
base_val
=
util_funcs
::
r
(
val_ptr
,
val_ptr
,
n_samp
);
double
alpha
=
1.0
/
util_funcs
::
stand_dev
(
val_ptr
,
n_samp
);
volatile
bool
is_valid
=
true
;
CORR_CHECK
.
resize
(
end_sel
-
start_sel
);
#pragma omp parallel for schedule(dynamic)
dgemv_
(
for
(
int
dd
=
start_sel
;
dd
<
end_sel
;
++
dd
)
'T'
,
{
n_samp
,
if
(
!
is_valid
)
end_sel
-
start_sel
,
continue
;
alpha
,
node_value_arrs
::
get_d_matrix_ptr
(
start_sel
),
if
((
base_val
-
std
::
abs
(
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
dd
),
val_ptr
,
n_samp
)))
<
(
1.0
-
cross_cor_max
+
1e-10
))
n_samp
,
is_valid
=
false
;
val_ptr
,
}
1
,
return
is_valid
;
0.0
,
comp_feats
::
CORR_CHECK
.
data
(),
1
);
return
(
base_val
-
std
::
abs
(
comp_feats
::
CORR_CHECK
[
idamax_
(
end_sel
-
start_sel
,
comp_feats
::
CORR_CHECK
.
data
(),
1
)])
<
(
1.0
-
cross_cor_max
+
1e-10
));
}
}
bool
comp_feats
::
valid_feature_against_selected_feat_list
(
double
*
val_ptr
,
int
n_samp
,
double
cross_cor_max
,
std
::
vector
<
node_ptr
>&
selected
,
std
::
vector
<
double
>&
scores_sel
,
double
cur_score
)
bool
comp_feats
::
valid_feature_against_selected_feat_list
(
double
*
val_ptr
,
int
n_samp
,
double
cross_cor_max
,
std
::
vector
<
node_ptr
>&
selected
,
std
::
vector
<
double
>&
scores_sel
,
double
cur_score
)
...
...
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