Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
cpp_sisso
Commits
b0162a2b
Commit
b0162a2b
authored
Jun 27, 2020
by
Thomas Purcell
Browse files
Bug Fix
There were errors with temp_storage_reg and setting selected feature values
parent
5ee786af
Changes
27
Hide whitespace changes
Inline
Side-by-side
src/descriptor_identifier/SISSORegressor.cpp
View file @
b0162a2b
...
...
@@ -56,7 +56,7 @@ void SISSORegressor::least_squares(std::vector<int>& inds, double* coeffs, int s
std
::
copy_n
(
_b
.
get
(),
n_dim
,
coeffs
);
else
{
std
::
string
err_msg
=
"least_squares failed, "
+
std
::
to_string
(
info
);
std
::
string
err_msg
=
"least_squares failed, "
+
std
::
to_string
(
info
)
+
", on rank: "
+
std
::
to_string
(
_mpi_comm
->
rank
())
;
for
(
auto
&
ind
:
inds
)
err_msg
+=
", "
+
std
::
to_string
(
ind
)
+
": "
+
std
::
to_string
(
node_value_arrs
::
get_d_matrix_ptr
(
ind
)[
0
]);
throw
std
::
logic_error
(
err_msg
);
...
...
src/feature_creation/feature_space/FeatureSpace.cpp
View file @
b0162a2b
...
...
@@ -146,12 +146,12 @@ void FeatureSpace::generate_feature_space(std::vector<double>& prop)
_n_feat
=
_phi
.
size
();
int
feat_ind
=
_phi
.
size
();
for
(
auto
feat_1
=
_phi
.
begin
()
+
_mpi_comm
->
rank
();
feat_1
<
_phi
.
end
();
feat_1
+=
_mpi_comm
->
size
())
for
(
auto
feat_1
=
_phi
.
begin
()
+
_mpi_comm
->
rank
()
+
_start_gen
.
back
()
;
feat_1
<
_phi
.
end
();
feat_1
+=
_mpi_comm
->
size
())
generate_new_feats
(
feat_1
,
next_phi
,
feat_ind
,
l_bound
,
u_bound
);
_mpi_comm
->
barrier
();
_start_gen
.
push_back
(
_phi
.
size
());
if
((
nn
<
_max_phi
)
||
(
_mpi_comm
->
size
()
==
1
))
if
((
nn
<
_max_phi
)
||
(
nn
<=
_n_rung_store
)
||
(
_mpi_comm
->
size
()
==
1
))
{
std
::
vector
<
std
::
vector
<
node_ptr
>>
next_phi_gathered
;
mpi
::
all_gather
(
*
_mpi_comm
,
next_phi
,
next_phi_gathered
);
...
...
@@ -168,9 +168,10 @@ void FeatureSpace::generate_feature_space(std::vector<double>& prop)
}
}
node_value_arrs
::
clear_temp_reg
();
if
(
nn
<
_max_phi
)
{
std
::
fill_n
(
node_value_arrs
::
TEMP_STORAGE_REG
.
data
(),
node_value_arrs
::
TEMP_STORAGE_REG
.
size
(),
-
1
);
//
std::fill_n(node_value_arrs::TEMP_STORAGE_REG.data(), node_value_arrs::TEMP_STORAGE_REG.size(), -1);
// Remove identical features
_scores
.
resize
(
_phi
.
size
());
...
...
@@ -181,14 +182,13 @@ void FeatureSpace::generate_feature_space(std::vector<double>& prop)
std
::
vector
<
int
>
del_inds
;
_mpi_comm
->
barrier
();
for
(
int
sc
=
0
;
sc
<
_scores
.
size
()
-
1
;
++
sc
)
{
if
(
_scores
[
inds
[
sc
]]
-
_scores
[
inds
[
sc
+
1
]]
<
1e-10
)
{
if
(
1.0
-
std
::
abs
(
util_funcs
::
r
(
_phi
[
_start_gen
.
back
()
+
inds
[
sc
]]
->
value_ptr
(),
_phi
[
_start_gen
.
back
()
+
inds
[
sc
+
1
]]
->
value_ptr
(),
_n_samp
))
<
1e-13
)
if
(
_scores
[
inds
[
sc
+
1
]]
-
_scores
[
inds
[
sc
]]
<
1e-10
)
if
(
std
::
abs
(
util_funcs
::
r
(
_phi
[
_start_gen
.
back
()
+
inds
[
sc
]]
->
value_ptr
(),
_phi
[
_start_gen
.
back
()
+
inds
[
sc
]]
->
value_ptr
(),
_n_samp
)
-
util_funcs
::
r
(
_phi
[
_start_gen
.
back
()
+
inds
[
sc
]]
->
value_ptr
(),
_phi
[
_start_gen
.
back
()
+
inds
[
sc
+
1
]]
->
value_ptr
(),
_n_samp
))
<
1e-13
)
del_inds
.
push_back
(
-
1
*
(
inds
[
sc
]
+
_start_gen
.
back
()));
}
}
inds
=
util_funcs
::
argsort
(
del_inds
);
for
(
int
ii
=
0
;
ii
<
inds
.
size
();
++
ii
)
...
...
@@ -327,6 +327,7 @@ void FeatureSpace::generate_feature_space(std::vector<double>& prop)
}
}
}
_n_feat
=
_phi
.
size
();
}
...
...
@@ -344,8 +345,8 @@ void FeatureSpace::project_generated(double* prop, int size, std::vector<node_pt
for
(
auto
feat
=
_phi
.
begin
()
+
_start_gen
.
back
()
+
_mpi_comm
->
rank
();
feat
<
_phi
.
end
();
feat
+=
_mpi_comm
->
size
())
{
std
::
fill_n
(
node_value_arrs
::
TEMP_STORAGE_REG
.
data
(),
node_value_arrs
::
TEMP_STORAGE_REG
.
size
(),
-
1
);
std
::
fill_n
(
node_value_arrs
::
TEMP_STORAGE_TEST_REG
.
data
(),
node_value_arrs
::
TEMP_STORAGE_TEST_REG
.
size
(),
-
1
);
node_value_arrs
::
clear_temp_reg
(
);
node_value_arrs
::
clear_temp_test_reg
(
);
int
feat_ind
=
_phi
.
size
();
std
::
vector
<
node_ptr
>
generated_phi
;
...
...
@@ -407,7 +408,7 @@ bool FeatureSpace::valid_score_against_past(double* val_ptr, double cur_score, s
if
(
*
std
::
min_element
(
scores_comp
.
begin
(),
scores_comp
.
end
())
<
1e-10
)
{
int
dd
=
std
::
min_element
(
scores_comp
.
begin
(),
scores_comp
.
end
())
-
scores_comp
.
begin
();
if
(
1.0
-
std
::
abs
(
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
dd
),
val_ptr
,
_n_samp
))
<
1e-1
3
)
if
(
std
::
abs
(
util_funcs
::
r
(
val_ptr
,
val_ptr
,
_n_samp
)
-
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
dd
),
val_ptr
,
_n_samp
))
<
1e-1
0
)
return
false
;
}
return
true
;
...
...
@@ -420,14 +421,25 @@ bool FeatureSpace::valid_score_against_current(int end_check, double* val_ptr, d
if
(
*
std
::
min_element
(
scores_comp
.
begin
(),
scores_comp
.
begin
()
+
end_check
)
<
1e-10
)
{
int
dd
=
std
::
min_element
(
scores_comp
.
begin
(),
scores_comp
.
begin
()
+
end_check
)
-
scores_comp
.
begin
();
if
(
1.0
-
std
::
abs
(
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
node_value_arrs
::
N_SELECTED
-
_n_sis_select
+
dd
),
val_ptr
,
_n_samp
))
<
1e-1
3
)
if
(
std
::
abs
(
util_funcs
::
r
(
val_ptr
,
val_ptr
,
_n_samp
)
-
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
node_value_arrs
::
N_SELECTED
-
_n_sis_select
+
dd
),
val_ptr
,
_n_samp
))
<
1e-1
0
)
return
false
;
else
{
std
::
vector
<
double
>
test
(
_n_samp
);
std
::
transform
(
val_ptr
,
val_ptr
+
_n_samp
,
node_value_arrs
::
get_d_matrix_ptr
(
node_value_arrs
::
N_SELECTED
-
_n_sis_select
+
dd
),
test
.
data
(),
std
::
minus
<
double
>
());
std
::
cout
<<
std
::
setw
(
24
)
<<
std
::
setprecision
(
20
)
<<
*
std
::
min_element
(
test
.
begin
(),
test
.
end
())
<<
'\t'
<<
*
std
::
max_element
(
test
.
begin
(),
test
.
end
())
<<
std
::
endl
;
std
::
cout
<<
std
::
setw
(
24
)
<<
std
::
setprecision
(
20
)
<<
*
val_ptr
<<
*
node_value_arrs
::
get_d_matrix_ptr
(
node_value_arrs
::
N_SELECTED
-
_n_sis_select
+
dd
)
<<
std
::
endl
;
std
::
cout
<<
std
::
setw
(
24
)
<<
std
::
setprecision
(
20
)
<<
std
::
abs
(
util_funcs
::
r
(
val_ptr
,
val_ptr
,
_n_samp
)
-
util_funcs
::
r
(
node_value_arrs
::
get_d_matrix_ptr
(
node_value_arrs
::
N_SELECTED
-
_n_sis_select
+
dd
),
val_ptr
,
_n_samp
))
<<
std
::
endl
;
}
}
return
true
;
}
void
FeatureSpace
::
sis
(
std
::
vector
<
double
>&
prop
)
{
// std::fill_n(node_value_arrs::TEMP_STORAGE_REG.data(), node_value_arrs::TEMP_STORAGE_REG.size(), -1);
// std::fill_n(node_value_arrs::TEMP_STORAGE_TEST_REG.data(), node_value_arrs::TEMP_STORAGE_TEST_REG.size(), -1);
std
::
vector
<
double
>
scores_comp
(
std
::
max
(
node_value_arrs
::
N_SELECTED
,
_n_sis_select
),
1.0
);
std
::
vector
<
double
>
scores_sel
(
_n_sis_select
,
0.0
);
...
...
@@ -481,7 +493,7 @@ void FeatureSpace::sis(std::vector<double>& prop)
phi_sel
.
resize
(
cur_feat_local
);
scores_sel
.
resize
(
cur_feat_local
);
project_generated
(
prop
.
data
(),
prop
.
size
(),
phi_sel
,
scores_sel
,
scores_comp
);
std
::
fill_n
(
node_value_arrs
::
TEMP_STORAGE_TEST_REG
.
data
(),
node_value_arrs
::
TEMP_STORAGE_TEST_REG
.
size
(),
-
1
);
//
std::fill_n(node_value_arrs::TEMP_STORAGE_TEST_REG.data(), node_value_arrs::TEMP_STORAGE_TEST_REG.size(), -1);
}
...
...
@@ -534,10 +546,15 @@ void FeatureSpace::sis(std::vector<double>& prop)
if
(
std
::
none_of
(
inds
.
begin
(),
inds
.
end
(),
[
&
compare_ind
](
int
i1
){
return
i1
==
compare_ind
;}))
{
scores_sel
.
erase
(
scores_sel
.
begin
()
+
ii
);
phi_sel
.
back
()
->
selected
()
=
false
;
phi_sel
.
back
()
->
set_dmat_ind
(
-
1
);
phi_sel
[
ii
]
->
selected
()
=
false
;
phi_sel
[
ii
]
->
set_dmat_ind
(
-
1
);
phi_sel
.
erase
(
phi_sel
.
begin
()
+
ii
);
}
else
{
phi_sel
[
ii
]
->
selected
()
=
false
;
phi_sel
[
ii
]
->
set_dmat_ind
(
-
1
);
}
}
for
(
auto
&
feat
:
phi_sel
)
feat
->
selected
()
=
false
;
...
...
@@ -560,6 +577,7 @@ void FeatureSpace::sis(std::vector<double>& prop)
_mpi_comm
->
recv
(
rr
,
_mpi_comm
->
cantorTagGen
(
rr
,
0
,
2
,
1
),
&
sent_phi
[
rr
*
_n_sis_select
],
_n_sis_select
);
}
// std::fill_n(node_value_arrs::TEMP_STORAGE_REG.data(), node_value_arrs::TEMP_STORAGE_REG.size(), -1);
if
(
inds
.
size
()
==
unique_scores
)
{
inds
=
util_funcs
::
argsort
(
sent_scores
);
...
...
@@ -600,20 +618,6 @@ void FeatureSpace::sis(std::vector<double>& prop)
++
cur_feat_local
;
++
cur_feat
;
}
else
{
sent_phi
[
inds
[
ii
]]
->
selected
()
=
false
;
sent_phi
[
inds
[
ii
]]
->
set_dmat_ind
(
-
1
);
}
++
ii
;
}
while
(
ii
<
sent_phi
.
size
())
{
if
(
sent_phi
[
inds
[
ii
]])
{
sent_phi
[
inds
[
ii
]]
->
selected
()
=
false
;
sent_phi
[
inds
[
ii
]]
->
set_dmat_ind
(
-
1
);
}
++
ii
;
}
}
...
...
@@ -626,19 +630,14 @@ void FeatureSpace::sis(std::vector<double>& prop)
_mpi_comm
->
send
(
0
,
_mpi_comm
->
cantorTagGen
(
_mpi_comm
->
rank
(),
0
,
2
,
0
),
scores_sel
.
data
(),
_n_sis_select
);
_mpi_comm
->
send
(
0
,
_mpi_comm
->
cantorTagGen
(
_mpi_comm
->
rank
(),
0
,
2
,
1
),
phi_sel
.
data
(),
_n_sis_select
);
_phi_selected
.
resize
(
node_value_arrs
::
N_SELECTED
);
for
(
auto
&
feat
:
phi_sel
)
{
if
(
feat
)
{
feat
->
selected
()
=
false
;
feat
->
set_dmat_ind
(
-
1
);
}
}
}
mpi
::
broadcast
(
*
_mpi_comm
,
&
_phi_selected
[
_phi_selected
.
size
()
-
_n_sis_select
],
_n_sis_select
,
0
);
for
(
int
ii
=
_phi_selected
.
size
()
-
_n_sis_select
;
ii
<
_phi_selected
.
size
();
++
ii
)
std
::
vector
<
int
>
rungs
(
_n_sis_select
,
0
);
std
::
transform
(
_phi_selected
.
end
()
-
_n_sis_select
,
_phi_selected
.
end
(),
rungs
.
begin
(),
[](
node_ptr
feat
){
return
feat
->
rung
();});
inds
=
util_funcs
::
argsort
(
rungs
);
for
(
int
ii
=
0
;
ii
<
inds
.
size
();
++
ii
)
{
_phi_selected
[
i
i
]
->
set_value
();
_phi_selected
[
i
nds
[
ii
]
+
node_value_arrs
::
N_SELECTED
-
_n_sis_select
]
->
set_value
();
++
cur_feat
;
}
}
...
...
src/feature_creation/node/FeatureNode.hpp
View file @
b0162a2b
...
...
@@ -117,7 +117,7 @@ public:
/**
* @brief Accessor function to the value of the feature
*/
inline
double
*
value_ptr
(
int
offset
=
0
){
return
_selected
?
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
)
:
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
);}
inline
double
*
value_ptr
(
int
offset
=
0
){
return
_selected
?
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
)
:
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
);}
/**
* @brief Accessor function to the value of the feature's test set
...
...
src/feature_creation/node/Node.hpp
View file @
b0162a2b
...
...
@@ -151,7 +151,7 @@ public:
/**
* @brief Accessor function to the test value of the feature
*/
virtual
double
*
test_value_ptr
(
int
offset
=
0
)
=
0
;
virtual
double
*
test_value_ptr
(
int
offset
=
-
1
)
=
0
;
/**
* @brief Check if the feature contains NaN
...
...
src/feature_creation/node/operator_nodes/OperatorNode.hpp
View file @
b0162a2b
...
...
@@ -98,12 +98,12 @@ public:
return
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
);
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
if
((
rung
()
>
node_value_arrs
::
N_RUNGS_STORED
)
&&
(
node_value_arrs
::
temp_storage_reg
(
_arr_ind
,
offset
)
!=
_
arr
_ind
))
if
((
rung
()
>
node_value_arrs
::
N_RUNGS_STORED
)
&&
(
node_value_arrs
::
temp_storage_reg
(
_arr_ind
,
offset
)
!=
_
feat
_ind
))
{
set_value
(
offset
);
node_value_arrs
::
temp_storage_reg
(
_arr_ind
,
offset
)
=
_
arr
_ind
;
node_value_arrs
::
temp_storage_reg
(
_arr_ind
,
offset
)
=
_
feat
_ind
;
}
return
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
);
return
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
);
}
/**
...
...
@@ -117,10 +117,10 @@ public:
double
*
test_value_ptr
(
int
offset
=-
1
)
{
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
if
((
rung
()
>
node_value_arrs
::
N_RUNGS_STORED
)
&&
(
node_value_arrs
::
temp_storage_test_reg
(
_arr_ind
,
offset
)
!=
_
arr
_ind
))
if
((
rung
()
>
node_value_arrs
::
N_RUNGS_STORED
)
&&
(
node_value_arrs
::
temp_storage_test_reg
(
_arr_ind
,
offset
)
!=
_
feat
_ind
))
{
set_test_value
(
offset
);
node_value_arrs
::
temp_storage_test_reg
(
_arr_ind
,
offset
)
=
_
arr
_ind
;
//
node_value_arrs::temp_storage_test_reg(_arr_ind, offset) = _
feat
_ind;
}
return
node_value_arrs
::
get_test_value_ptr
(
_arr_ind
,
offset
);
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/absolute_difference.hpp
View file @
b0162a2b
...
...
@@ -30,7 +30,7 @@ public:
allowed_op_funcs
::
abs_diff
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
abs_diff
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
abs_diff
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/absolute_value.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
abs
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
abs
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
abs
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/add.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
add
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
add
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
add
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/cos.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
cos
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
cos
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
cos
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/cube.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
cb
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
cb
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
cb
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/cube_root.cpp
View file @
b0162a2b
...
...
@@ -6,7 +6,7 @@ CbrtNode::CbrtNode()
CbrtNode
::
CbrtNode
(
std
::
array
<
node_ptr
,
1
>
feats
,
int
feat_ind
,
double
l_bound
,
double
u_bound
)
:
OperatorNode
(
feats
,
feat_ind
)
{
if
((
feats
[
0
]
->
type
()
==
NODE_TYPE
::
CB
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
SQ
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
INV
))
if
((
feats
[
0
]
->
type
()
==
NODE_TYPE
::
CB
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
SQ
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
SIX_POW
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
INV
))
throw
InvalidFeatureException
();
set_value
();
...
...
@@ -19,7 +19,7 @@ CbrtNode::CbrtNode(std::array<node_ptr, 1> feats, int feat_ind, double l_bound,
CbrtNode
::
CbrtNode
(
node_ptr
feat
,
int
feat_ind
,
double
l_bound
,
double
u_bound
)
:
OperatorNode
({
feat
},
feat_ind
)
{
if
((
feat
->
type
()
==
NODE_TYPE
::
CB
)
||
(
feat
->
type
()
==
NODE_TYPE
::
SQ
)
||
(
feat
->
type
()
==
NODE_TYPE
::
INV
))
if
((
feat
->
type
()
==
NODE_TYPE
::
CB
)
||
(
feat
->
type
()
==
NODE_TYPE
::
SQ
)
||
(
feat
->
type
()
==
NODE_TYPE
::
SIX_POW
)
||
(
feat
->
type
()
==
NODE_TYPE
::
INV
))
throw
InvalidFeatureException
();
set_value
();
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/cube_root.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
cbrt
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
cbrt
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
cbrt
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/divide.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
div
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
div
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
div
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/exponential.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
exp
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
exp
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
exp
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/inverse.hpp
View file @
b0162a2b
...
...
@@ -30,7 +30,7 @@ public:
allowed_op_funcs
::
inv
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
inv
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
inv
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/log.hpp
View file @
b0162a2b
...
...
@@ -29,7 +29,7 @@ public:
allowed_op_funcs
::
log
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
log
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
log
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/multiply.hpp
View file @
b0162a2b
...
...
@@ -30,7 +30,7 @@ public:
allowed_op_funcs
::
mult
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
mult
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
mult
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
_feats
[
1
]
->
value_ptr
(
offset
+
1
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/negative_exponential.hpp
View file @
b0162a2b
...
...
@@ -30,7 +30,7 @@ public:
allowed_op_funcs
::
neg_exp
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
neg_exp
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
neg_exp
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
};
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/sin.hpp
View file @
b0162a2b
...
...
@@ -30,7 +30,7 @@ public:
allowed_op_funcs
::
sin
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_d_matrix_ptr
(
_d_mat_ind
));
offset
=
(
offset
==
-
1
)
?
rung
()
:
offset
;
allowed_op_funcs
::
sin
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
offset
));
allowed_op_funcs
::
sin
(
_n_samp
,
_feats
[
0
]
->
value_ptr
(
offset
+
2
),
node_value_arrs
::
get_value_ptr
(
_arr_ind
,
_feat_ind
,
offset
));
}
inline
void
set_test_value
(
int
offset
=
-
1
)
...
...
src/feature_creation/node/operator_nodes/allowed_operator_nodes/sixth_power.cpp
View file @
b0162a2b
...
...
@@ -6,7 +6,7 @@ SixPowNode::SixPowNode()
SixPowNode
::
SixPowNode
(
std
::
array
<
node_ptr
,
1
>
feats
,
int
feat_ind
,
double
l_bound
,
double
u_bound
)
:
OperatorNode
(
feats
,
feat_ind
)
{
if
((
feats
[
0
]
->
type
()
==
NODE_TYPE
::
CBRT
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
SQRT
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
INV
))
if
((
feats
[
0
]
->
type
()
==
NODE_TYPE
::
CBRT
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
SQRT
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
SQ
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
CB
)
||
(
feats
[
0
]
->
type
()
==
NODE_TYPE
::
INV
))
throw
InvalidFeatureException
();
set_value
();
...
...
@@ -19,7 +19,7 @@ SixPowNode::SixPowNode(std::array<node_ptr, 1> feats, int feat_ind, double l_bou
SixPowNode
::
SixPowNode
(
node_ptr
feat
,
int
feat_ind
,
double
l_bound
,
double
u_bound
)
:
OperatorNode
({
feat
},
feat_ind
)
{
if
((
feat
->
type
()
==
NODE_TYPE
::
CBRT
)
||
(
feat
->
type
()
==
NODE_TYPE
::
SQRT
)
||
(
feat
->
type
()
==
NODE_TYPE
::
INV
))
if
((
feat
->
type
()
==
NODE_TYPE
::
CBRT
)
||
(
feat
->
type
()
==
NODE_TYPE
::
SQRT
)
||
(
feat
->
type
()
==
NODE_TYPE
::
SQ
)
||
(
feat
->
type
()
==
NODE_TYPE
::
CB
)
||
(
feat
->
type
()
==
NODE_TYPE
::
INV
))
throw
InvalidFeatureException
();
set_value
();
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment