Commit faec4141 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Add more executable tests, and split gitlab tests

see if this works
parent b43a3e04
......@@ -4,7 +4,7 @@ stages:
- build
- test
build-intel:
build.intel:
stage: build
script:
- module load intel impi/2018.4 mkl cmake anaconda/3/2019.03 mpi4py git
......@@ -18,14 +18,10 @@ build-intel:
- make
- make install
- cd ../
- pytest tests
- cd tests/exec_test/
- mpiexec -n 2 ../../bin/sisso++
- python check_model.py
tags:
- docker
build-gnu:
build.gnu:
stage: build
script:
- module load gcc impi/2018.4 intel mkl cmake anaconda/3/2019.03 mpi4py git
......@@ -38,10 +34,58 @@ build-gnu:
- make
- make install
- cd ../
tags:
- docker
test.intel:
stage: test
dependencies:
- build.intel
tags:
- docker
script:
- pytest tests
- cd tests/exec_test/
- ../../bin/sisso++
- cd tests/exec_test/classification
- ../../../bin/sisso++
- python check_model.py
- cd tests/exec_test/default
- ../../../bin/sisso++
- python ../check_model.py
- cd tests/exec_test/gen_proj
- ../../../bin/sisso++
- python ../check_model.py
- cd tests/exec_test/log_reg
- ../../../bin/sisso++
- python ../check_model.py
- cd tests/exec_test/max_corr
- ../../../bin/sisso++
- python ../check_model.py
artifacts:
when: always
test.gnu:
stage: test
dependencies:
- build.gnu
tags:
- docker
script:
- pytest tests
- cd tests/exec_test/classification
- ../../../bin/sisso++
- python check_model.py
- cd tests/exec_test/default
- ../../../bin/sisso++
- python ../check_model.py
- cd tests/exec_test/gen_proj
- ../../../bin/sisso++
- python ../check_model.py
- cd tests/exec_test/log_reg
- ../../../bin/sisso++
- python ../check_model.py
- cd tests/exec_test/max_corr
- ../../../bin/sisso++
- python ../check_model.py
artifacts:
when: always
......@@ -95,13 +95,39 @@ FeatureSpace::FeatureSpace(
_n_rung_generate(0)
{
_n_samp = _phi_0[0]->n_samp();
if(project_type.compare("regression") == 0)
{
_project = project_funcs::project_r2;
_project_no_omp = project_funcs::project_r2_no_omp;
}
else if(project_type.compare("classification") == 0)
{
_project = project_funcs::project_classify;
_project_no_omp = project_funcs::project_classify_no_omp;
}
else if(project_type.compare("log_regression") == 0)
{
if(_task_sizes.size() > 1)
throw std::logic_error("Log Regression can not be done using multiple tasks.");
_project = project_funcs::project_log_r2;
_project_no_omp = project_funcs::project_log_r2_no_omp;
}
else
throw std::logic_error("Wrong projection type passed to FeatureSpace constructor.");
if(_cross_cor_max < 0.99999)
{
_is_valid = comp_feats::valid_feature_against_selected;
_is_valid_feat_list = comp_feats::valid_feature_against_selected_feat_list;
}
else
{
_is_valid = comp_feats::valid_feature_against_selected_max_corr_1;
_is_valid_feat_list = comp_feats::valid_feature_against_selected_max_corr_1_feat_list;
}
std::vector<node_ptr> phi_temp = str2node::phi_from_file(feature_file, _phi_0);
_n_feat = phi_temp.size();
......
from cpp_sisso import ModelClassifier
from pathlib import Path
import numpy as np
model = ModelClassifier(
str("models/train_dim_2_model_0.dat"), str("models/test_dim_2_model_0.dat")
)
assert model.percent_error < 1e-7
assert model.percent_test_error < 1e-7
index,prop,A,B,C,D,E,F,G,H,I,J
0,1.0,0.01,-0.01,10.0,10.0,-0.49282517909827384,0.17302597769416206,0.598942935224295,-0.2987544751968252,-0.5812549090102688,-0.11065649421055634
1,1.0,-1.8944281037421362,-1.3199613439800735,0.9557138968762431,0.4781172014274879,0.7775861911003294,0.6553697167785566,0.17491417142796584,-0.2884988775306041,-0.04531653614948916,-0.6065861937524113
2,1.0,-1.4746015071142384,-1.2261496452343335,0.33014029248479626,-0.38950549868991224,0.13893526582480842,-0.8718692821675553,0.3747246204870105,0.1641859118951301,0.29356070144371693,0.28560894022002103
3,1.0,-1.3021341433673468,-1.8262126241881185,-0.71381302228685,0.9687695850076805,0.6831481792028635,0.7991250925387956,0.30947917352650367,0.7280520310034677,0.7254955809948858,-0.6765763028042482
4,1.0,-1.7393863226933401,-1.583498665054882,-0.06778341709581581,0.22998854989132322,0.5824275980446467,0.2619471491848253,-0.31573435079735024,0.6117812214426803,-0.18705821696723812,0.8717643476903345
5,1.0,-1.5666089663239755,-1.058618149021826,-0.21280098230276434,0.9154597761466068,-0.2634655525918126,-0.6661264959880135,-0.19502899649000716,-0.23717005768011568,-0.9333588585968833,-0.19726273171241027
6,1.0,-1.5534087615389538,-1.2520923128583763,0.9725857879017872,-0.8725028871856755,0.7291109108144516,0.26524478721086564,-0.7269009736244325,0.2486261701079393,0.8090043968802652,-0.27849406478047856
7,1.0,-1.5462532513644658,-1.8123888845081852,0.4316458762210631,-0.5952232732793832,0.9535570697581124,-0.22291521912156265,0.25767093907617356,0.7289278790983178,-0.5797830554176866,-0.17996031942809454
8,1.0,-1.1273555452403516,-1.6926149744472814,0.8270911990526928,0.20878148291075949,-0.5733171873615286,-0.004887589213519616,0.3419187160346375,-0.2929016713562016,-0.34531700628784034,0.7669205476300731
9,1.0,-1.3536783481588408,-1.381410564729617,0.023965203621815423,-0.8054125694184839,0.8068101397184948,-0.8065762631278186,-0.3927997785617203,-0.4638193637740795,0.16095248005356044,-0.5534197471316085
10,1.0,-1.1785315188879562,-1.2770582929850374,0.916015229666356,0.027594664515699696,-0.8295070079776354,-0.7000636893272012,-0.7156014565887143,-0.4397991651435269,-0.4872412204948866,0.24527926705612058
11,1.0,-1.1754704976687549,-1.0561328124666542,0.4045577188977567,0.17599736106236108,0.22738373082247842,0.7742546525779774,-0.6160809969176364,-0.948639007451084,0.9540764333752245,-0.49710200117233927
12,1.0,-1.6727791503394291,-1.8619023988358836,0.9067088448860641,-0.5927370303736976,0.8852298038909494,0.8220692972419072,0.20436748556299245,0.24610324883504986,-0.079476866422163,-0.24400699558343364
13,1.0,-1.9632616543888368,-1.316804580896929,-0.2845703941884137,-0.19868606157423807,-0.1688976095411121,-0.9293925911269099,0.26589905967191263,-0.8287276425847814,-0.42745309747416815,-0.7383680916088831
14,1.0,-1.7949776980848098,-1.1394821735708154,0.011556817105956574,0.49940831475722924,0.25316342477447806,0.017645446880421023,0.40173516709526447,-0.6502876172985015,-0.262217482830833,-0.5101021201305884
15,1.0,-1.079571205362615,-1.9324595507799076,-0.5201611742812009,-0.3924784593473962,0.14749583956586831,0.7808796064740751,-0.28104468779917324,-0.14803690813578552,-0.2088104722240931,0.2789619297181276
16,1.0,-1.5255514503750653,-1.7245520919673556,0.562803219191695,0.3236760616369958,0.49073713641037187,-0.9547619269949603,0.028603504036769145,-0.2462952196505066,-0.29773629359773923,-0.6324738309576534
17,1.0,-1.2914230950731502,-1.950696152621199,0.8596694610541045,0.4857728192540889,0.26888359882500934,0.253553321699552,-0.04574308756939516,0.6679340327824896,0.3085919639199468,0.7710843014640274
18,1.0,-1.234047871210012,-1.6817351928784738,-0.11887110046241278,0.15900093776813162,0.29854288417560015,-0.20382920533253834,-0.6379456952513525,0.6580496908109092,0.9495295891340081,-0.577812553880056
19,1.0,-1.1351305002955077,-1.3119036669604036,0.7403741109304496,0.558782660077505,-0.0960521263545826,0.5291198173605371,0.37219060477014443,0.6886564662536832,-0.8194331653155049,-0.12814415930810963
20,1.0,-0.01,0.01,-10.0,-10.0,0.7852373497328908,-0.38721773049540054,-0.9424092188994484,0.16080657729767522,-0.7239699836619722,-0.4526501344158229
21,1.0,1.1507658618080976,1.726050539272399,-0.9229073425132097,0.46575138421963236,-0.81727500527083,-0.18247264092662796,0.8875260706203563,0.11159288397848788,0.3864350788801618,-0.44001721122127235
22,1.0,1.9038976822470102,1.7188075931659075,0.2803397954645097,0.379365407838544,0.6348430081926235,0.37175391878083874,-0.6116533053698634,0.7325679278741848,0.85803611350317,-0.5779734417084115
23,1.0,1.777519764523806,1.2869705037057755,0.22285089894507704,-0.4240570888282873,-0.27619426781835954,0.6169416676806943,-0.696779972923147,0.23612770730498034,0.7607058897805274,0.34004139732032956
24,1.0,1.6531432749387367,1.162828102113115,-0.3395011973829445,0.8985295913658116,-0.8815382282315818,0.09072882666430049,-0.8583958707809345,0.9072723315158959,0.16053173561906742,0.6789118117688409
25,1.0,1.309551805582044,1.3682775573764787,-0.4445767545785626,-0.7887117451257197,0.2466257730701833,-0.6634740188183126,-0.4463555520604636,0.7503127731346337,-0.9895952297013597,-0.1501201098407059
26,1.0,1.4492443117189315,1.4032886458116898,-0.38867957733440184,-0.7081934507919516,0.8503100848003078,-0.7672563385316118,0.37050931732919423,0.38735492101575075,0.5331603211649865,0.14939021245513073
27,1.0,1.613625013917531,1.054483144145669,-0.35964468015596895,0.6825554041477278,-0.5319540093654402,0.9341016895908625,-0.7360028401883201,-0.2996029145405299,0.3511255963558182,-0.1878428846692788
28,1.0,1.0243392720597995,1.9105960212113278,-0.24940915747071712,-0.13707002438664384,-0.707128531134104,0.9449320492342947,0.43123336605298723,0.44954399095926245,0.9129019322800267,0.7739461096382698
29,1.0,1.9944467859460666,1.6720498444130638,0.9353026424804634,0.8337209665238072,0.25416795671734294,-0.007922712021390721,-0.11477629537676681,-0.2760428960022421,-0.8130984031254187,0.3419220522124746
30,1.0,1.4011033028792645,1.109011516195995,0.4257167722550872,0.5441748037327634,0.492863854358204,-0.04758979171716571,-0.7438407906336721,0.5252894890604114,0.8296117155449363,0.01519322184552152
31,1.0,1.9499509062547116,1.0572741079996884,0.12665368551441047,0.469705238170149,0.8744362482730081,-0.7595711754681347,0.31023073561926484,-0.8034208437448502,-0.4624310824864766,-0.40716588675912946
32,1.0,1.472646250429945,1.1891364327906537,-0.7313930180310388,0.46110222460300854,-0.8845283918853222,-0.41989394484079834,0.6475182143890668,0.6881263264084854,0.7546563716916033,0.1168819230678162
33,1.0,1.4590167720750702,1.1702436403729433,-0.5274334249471311,-0.5987746978086463,0.11319779160167642,-0.50528865259863,0.11757211428893855,0.590400320594326,-0.15515938676912566,0.3548279774131968
34,1.0,1.3204274424304074,1.198019529303835,-0.8186266224051648,-0.0290085645105993,0.9523159683784683,0.8174957842139241,0.18222455484504252,-0.013773043646529981,-0.2627319529358798,-0.8595305628086736
35,1.0,1.8813823797628926,1.0367008183967852,0.3052186880166259,-0.06088564766002724,-0.38790344660551357,-0.10806404273546488,-0.9629804050096822,-0.42428960420351114,-0.2534422930772855,0.30963736841129674
36,1.0,1.9986688782460984,1.3690925712861786,0.5431284474003899,0.5913724730408367,-0.8353670866934573,0.19831525342250655,-0.18143473978380187,0.6364291057549478,0.42062864699233105,0.9901223646646209
37,1.0,1.504558184990442,1.190949743496727,-0.6532636073327616,0.35935945086837595,0.30131719114182043,0.6495817943565889,0.9422689556330865,0.8846598944893771,-0.4731712393443981,0.039635066570717026
38,1.0,1.008333615471538,1.981506300008274,-0.8123524571767606,0.2197661015909831,-0.6502106779028902,0.4236216902915564,-0.5886509927579104,0.061487886019890414,-0.2377374740160869,0.6412843473808252
39,1.0,1.6017918572461922,1.1250859962714062,-0.8298193869407411,-0.3451046875738015,0.48516607054511907,-0.2588397274480556,-0.9206152083268813,0.27549821587142675,-0.629075534110342,-0.6425278879606868
40,0.0,0.01,0.01,10.0,-10.0,0.04151985651136059,0.2330346162909498,-0.49723324619118703,-0.023544587617094992,-0.41854083777000306,-0.5502339327925116
41,0.0,-1.0914757437035456,1.704187017012845,-0.4803164747027948,-0.7537847103406319,-0.6132342356169982,0.16795557366247427,0.45563663131504173,-0.3802276359532064,0.48021383007368956,-0.45367492988510794
42,0.0,-1.9425392252914977,1.5931139414465358,0.31009805091338705,-0.835007082906627,0.40758014085085303,0.5569242475965532,-0.38861660463934644,0.6021510475141199,-0.9843221980987535,-0.9963328889833365
43,0.0,-1.403024210449149,1.0504137974303827,-0.8984564534469641,-0.7970299242453491,0.47491891024478017,0.48019322053841695,-0.7508561635586863,-0.043960372032017636,-0.24265139180566164,-0.10923906105400616
44,0.0,-1.45810616907354,1.084683264970634,0.5713295229340183,-0.6773798263796229,0.09839698468883196,-0.9615991701040352,-0.7539225919221575,0.3614358912575588,-0.6380304554939824,0.40434902484390767
45,0.0,-1.6042143290163837,1.5773097324751753,0.40243320555526796,-0.06801187450077983,-0.3730896611520318,0.23970878487105018,0.41645110664336094,-0.5059916627143299,-0.8866903480674095,0.3036452361644302
46,0.0,-1.5486866135010242,1.3288318457670756,-0.17492524550976607,0.05033039145153584,-0.38867679574193215,-0.7230760497855304,0.6460761077249644,-0.0010558990958802195,0.4919287207437726,-0.647995101369186
47,0.0,-1.8920756792534963,1.7657625846115277,0.28941076121752496,0.4856651089687205,0.33868477386080054,0.3743195814396485,-0.10547901462716669,0.004520417892417861,0.2228622619759395,0.23538363683763985
48,0.0,-1.5144292231365304,1.6984040931515498,-0.19904456301740736,-0.8558041127811826,0.9475720005649064,0.6549395628101518,0.802084131057488,0.010033694468233323,0.44976636625057376,0.11997413461843287
49,0.0,-1.334691441718412,1.8012484689328736,-0.34672956898995055,-0.614828863660672,0.5781503720015266,-0.6973564899083871,-0.27249617742754695,-0.3266795053631859,0.40318590749462313,0.6598349869723568
50,0.0,-1.392160865916832,1.96030807097305,-0.4709187754332349,-0.16596517376787534,-0.11837327580213919,-0.8046715422993092,-0.27309628387497664,0.9646762900347077,-0.2407860162851745,0.7810927507182175
51,0.0,-1.1081877449652693,1.1321805921252017,-0.5463150777240524,-0.26339780806113056,0.0734161121606478,-0.5615845135833513,-0.003812545601593831,-0.06790170865979794,-0.7973376248924131,-0.5024942886762793
52,0.0,-1.1273342237834545,1.222900933909083,-0.23961815168048672,0.2812826831120643,-0.12225333824316409,-0.4163409124224706,-0.3029448237633121,0.9506971678575753,0.08477434826975472,0.24564363747814055
53,0.0,-1.5450458531844702,1.4646555655585867,0.6724652616073976,0.9636771128762993,-0.7328669447410141,0.26987900702231227,-0.7341217639847928,-0.1847500436486904,0.49478360423045675,-0.5634696889084065
54,0.0,-1.6972898977881243,1.9342793806461098,0.916674666213795,0.7441006696135166,-0.5363256808793411,0.7453493138967058,-0.6084949711216283,-0.036147807131094334,0.7300972119817077,-0.9860206879212554
55,0.0,-1.467166856883277,1.9195073363935855,-0.04001237513761069,0.2482575243891476,-0.795936343325832,-0.755933622220192,0.6649430625674231,-0.5608250699419657,-0.987328335835364,0.009181823833889657
56,0.0,-1.507858084142104,1.11065681931139,-0.7565527152681395,-0.43396597947565385,-0.9258208007633866,0.6212043805382641,-0.7253554358023508,-0.08719504527829058,0.5000400077995837,-0.3510240708674768
57,0.0,-1.793339477832935,1.6461561157023556,0.5936703687181848,0.7412541556633099,-0.835056311664806,-0.12828334096535055,0.7957690701135833,0.3380628722493768,0.9616102822792876,-0.5197559610490992
58,0.0,-1.685623286883061,1.7913664511633125,-0.9177920046292005,-0.2248076520670288,0.7511725309540487,0.7449254977655742,0.05482138754018062,-0.26814612271904337,-0.373795753322288,-0.0236199006955784
59,0.0,-1.7032511687316396,1.561738983983668,0.937331444475048,-0.18914659666867584,0.7267575281390293,0.571196020214809,0.1504784966595285,0.7163709047538911,0.6459479363917942,-0.09651249984138066
60,0.0,-0.01,-0.01,-10.0,10.0,0.3037482340767377,0.0946840691842421,0.8466519087621067,0.5057109910970319,-0.6648466204250763,-0.7229347856701709
61,0.0,1.517475034607442,-1.5797683396912157,-0.31385345647165575,-0.6706416904370422,0.33748118903604074,-0.6950596675808771,0.38251266476664836,-0.7540512945658595,-0.5409128937716641,-0.15273659248128935
62,0.0,1.3672941639996612,-1.5494260699524456,0.7462797650357975,0.3206679093982656,0.0757122783161257,0.5570890283268028,-0.31445996245727414,-0.09117939535299069,-0.7125726183527377,-0.8625237702649187
63,0.0,1.8755185956540283,-1.0124502444775816,0.9616342423045714,0.9990251718017698,0.4285764726207524,0.7902542298430564,-0.16273214801418256,0.05710841557502144,0.09962536752119067,-0.4177957372666703
64,0.0,1.8407338686869008,-1.5868070635995237,-0.29373799492321306,-0.6546037139247634,-0.15830470325220958,-0.45061718235930015,0.10621728605636549,-0.25016507950845557,-0.5988943508598357,-0.8603824760047425
65,0.0,1.4799923864034554,-1.6886196544558572,0.6613747096357248,0.3354136960485343,0.29540846912662677,-0.3407250803665458,0.6119612274582391,0.5332770226092296,-0.960254363897463,0.9132513378340925
66,0.0,1.0735581028251975,-1.060524245309374,-0.7902813350132356,0.37259465524782054,-0.9400757902613452,0.9721066172153674,-0.24687488719815498,-0.5015445240130325,-0.13494761193218818,0.1300908069763218
67,0.0,1.6376974303400835,-1.649460990932646,-0.6005900469726237,0.28162130970935295,0.8362440030881721,0.5625055617944303,-0.24424824400159317,0.2742731104136069,0.9882291644128922,-0.9034928924297636
68,0.0,1.9226795203724978,-1.5881079200154482,0.23039784446724942,0.458000795025685,0.16053436480789807,0.10676023110363286,0.08437633629048147,-0.4102570968096315,-0.3889759130323822,0.23368493276044622
69,0.0,1.428218106951723,-1.758329763791654,0.12289411290053698,-0.19374642536783515,0.6024111339994527,-0.8956945110997676,0.34728022344428666,0.045175117581032875,-0.2326617713895407,-0.3146487851555211
70,0.0,1.426028756973607,-1.1608245105048438,0.9060271622161762,0.7364181822252924,-0.04128485443820251,0.30852412684049657,0.3692055404974064,0.33319303146616197,0.9854449773409701,-0.253876502721057
71,0.0,1.7300201940414208,-1.8094742195380222,-0.6776614683334685,0.07388223501889013,-0.6821472673109052,0.02412639199219635,0.8489462496789089,-0.5162539947354388,0.2026274256350431,-0.8974772498432042
72,0.0,1.1160580867858627,-1.0562234913753827,0.4924315133007724,-0.737330353527688,0.5948943274413478,0.8054360371547522,-0.9127166792458934,-0.39019932233826227,-0.7358052031844453,-0.058032643451690014
73,0.0,1.5287830677917298,-1.5282207370489649,-0.8638215305852943,-0.9871259051181829,-0.6981909166452223,-0.17859271120363984,-0.9024979934000754,0.7774480505476058,0.03349780154212989,0.5698021932461961
74,0.0,1.6960209130376898,-1.6879132950675153,-0.9196790361121787,-0.08379502301562369,0.49207875063490536,-0.10278600265499382,0.1680009845018644,-0.9849109111206711,-0.9010178860550528,0.6398135602683432
75,0.0,1.8229209542705762,-1.7992151616780458,0.10745593717114521,-0.8547117567503333,0.3449692462697873,0.5190929861298248,0.41023065780507606,-0.9121646126915404,0.0339436116875278,-0.3066433169799614
76,0.0,1.153822450324946,-1.9125109596392957,-0.8084861601829396,-0.010443047871684152,-0.7062967902838859,0.8221182617361114,0.16332743077240175,0.25278629136411546,-0.501338527911191,-0.28349201031842997
77,0.0,1.1952162783159461,-1.4347201247937995,-0.8144168383678148,-0.029402316469989476,-0.8414282024081439,-0.004586605289200518,-0.6064347305419278,0.7142773164379119,-0.4448189769242301,-0.7536984563026647
78,0.0,1.9935896172064345,-1.5249947828194232,-0.8776374613798481,0.4144055355504066,-0.033655814948979845,0.6246920435596353,-0.8324026588913145,-0.7230280627324008,-0.8670990346040541,-0.18563237806149768
79,0.0,1.623519204932399,-1.5204567735605674,0.9778286856360292,-0.5750238094139197,-0.4026176094620355,0.6319679592519518,-0.42650442043409664,0.4805794604963276,0.6863380782764676,-0.7938128517078891
80,1.0,-1.9061964810894976,-1.2890845064683893,10.0,10.0,0.10110213628450881,-0.416199695149021,-0.49485098716478193,-0.5686984484832116,-0.18478238247187462,-0.5522304988566058
81,1.0,-1.1233456870613596,-1.4319272868794908,-0.20267104500415667,-0.13891416360392483,-0.9371567107968573,-0.11679010938437773,-0.0942374319418513,-0.8967611185539714,-0.18342332063686673,0.4586246330654187
82,1.0,-1.8593800902098794,-1.2014277824817987,-0.6994029020523282,0.8016069079080759,0.618074329335756,-0.17256870875707642,-0.07569344530437294,0.48881526808669196,-0.6122253862675848,0.5154748580158188
83,1.0,-1.4459305927616168,-1.507381441431149,-0.14646706623716144,0.7737171788723411,0.4987969849603513,-0.01586272159205504,0.48716282764946706,-0.0020169225903672316,-0.4803954556572778,0.14066039485631854
84,1.0,-1.5068337349461003,-1.3960574872196596,0.9352733360226106,-0.6584023257750704,0.2540286154963187,-0.2079493637863219,0.49423396418171595,0.3425440151560937,-0.2790717466048003,0.6817667819203079
85,1.0,1.2945952163736183,1.2595474551517882,-10.0,-10.0,-0.7729483005820612,-0.7555910808571309,-0.7956918977844933,0.1406538353922091,-0.16048348692278092,0.46092093570445214
86,1.0,1.0468940151290935,1.4889992490615644,-0.10280602307649511,-0.2322567217543967,0.9824873120780633,0.22063948796997224,0.46610825105829923,-0.32823900060322386,0.9556882858690123,0.9840121424736405
87,1.0,1.5883047440360363,1.7022605521341374,-0.40090994887229314,-0.8872400296917884,-0.7963665539711986,-0.18901134135900155,-0.9842642698324229,0.22853934832310796,0.6960450376429215,-0.7349411665560721
88,1.0,1.0700121628460502,1.818456986404958,-0.9066754218923723,0.6435018002723063,0.29644429045149967,-0.21233982252142947,-0.6249473476636442,-0.07650553418511508,0.6900069458740186,0.6031788656970374
89,1.0,1.478188533919311,1.1810797217515985,-0.7778783717821762,0.15870040018507803,0.7700838694175804,0.31820158149436617,-0.577373286340777,0.2079154087822559,0.16989820716894366,-0.13471834974110908
90,0.0,-1.3979253633769553,1.8903759983708976,10.0,-10.0,-0.3815436230444891,-0.15060860491731232,0.9402009350589582,-0.26012695659385154,0.011178432296194751,-0.5526461887962022
91,0.0,-1.3418191928050067,1.3777038429060606,-0.2738961073464674,0.9218628887177005,0.1833297141250405,0.7949957967753243,0.4703407862424096,0.5871591279939063,0.6560651905340187,0.7103783594351551
92,0.0,-1.0853574965532813,1.2568456448317546,-0.09343868466017535,0.8673637319098968,0.5019793353377939,0.9291335314667162,0.8530385462334946,0.23164737184209572,-0.9213639337894683,0.9955206665909002
93,0.0,-1.5078347061732043,1.755372973469426,-0.35304762896340125,0.6869964596284959,0.12650715249211952,-0.5841575512334931,0.6780119845973502,0.1301840756737609,-0.5413658827498185,0.804095414322346
94,0.0,-1.6723266529177478,1.9139884218475265,-0.055989266428471796,0.08397268885628328,0.49540687896065805,-0.5318515111518416,-0.6829875503825202,-0.7627193412374218,0.044183568378214355,0.5694928604351057
95,0.0,1.5219674737320155,-1.8127243158447541,-10.0,10.0,-0.5924273489245648,-0.24521529180917545,0.45028680560933676,-0.6172008060217697,-0.07832380637663072,-0.13840019966409445
96,0.0,1.3427761908932137,-1.0426461453585447,-0.8405236108806917,-0.5797680617663143,0.20708806522492362,-0.30689024242517027,-0.7073198325932093,0.06720948720809505,-0.21904144161504235,0.6516183145928414
97,0.0,1.729966706858185,-1.2614818535634313,-0.07134725891047888,-0.5716479318807921,0.002484974059520084,0.4103461232511616,0.29425426224880424,0.6980183692479018,0.6525532678930528,-0.9606212198157282
98,0.0,1.6367960859950461,-1.4048311726687266,0.13335534338270483,0.7851836236372127,0.10649410652264102,0.45700338475494173,-0.31447076807019614,-0.053371126918829725,0.8614734514136297,-0.7701671581075855
99,0.0,1.2253193252857404,-1.3983212310825488,0.7518196805414694,0.8434776597312679,0.880714646905367,0.20665859661747032,-0.8505399954222603,0.7702440358432017,-0.790477429383416,-0.21937326040566685
{
"desc_dim": 2,
"n_sis_select": 1,
"max_rung": 1,
"n_residual": 1,
"data_file": "data.csv",
"property_key": "prop",
"leave_out_frac": 0.2,
"n_models_store": 1,
"calc_type": "classification",
"leave_out_inds": [80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 ,96 ,97, 98 , 99],
"opset": ["add", "sub", "abs_diff", "mult", "div", "inv", "abs", "exp", "log", "sin", "cos", "sq", "cb", "six_pow", "sqrt", "cbrt", "neg_exp"],
"fix_intercept": false
}
{
"desc_dim": 2,
"n_sis_select": 1,
"max_rung": 2,
"n_residual": 1,
"data_file": "../data.csv",
"property_key": "Prop",
"task_key": "Task",
"leave_out_frac": 0.05,
"n_models_store": 1,
"leave_out_inds": [0, 1, 2, 60, 61],
"opset": ["add", "sub", "abs_diff", "mult", "div", "inv", "abs", "exp", "log", "sin", "cos", "sq", "cb", "six_pow", "sqrt", "cbrt", "neg_exp"],
"fix_intercept": false
}
{
"desc_dim": 2,
"n_sis_select": 1,
"max_rung": 2,
"n_residual": 1,
"data_file": "../data.csv",
"property_key": "Prop",
"task_key": "Task",
"leave_out_frac": 0.05,
"n_models_store": 1,
"n_rung_generate": 1,
"leave_out_inds": [0, 1, 2, 60, 61],
"opset": ["add", "sub", "abs_diff", "mult", "div", "inv", "abs", "exp", "log", "sin", "cos", "sq", "cb", "six_pow", "sqrt", "cbrt", "neg_exp"],
"fix_intercept": false
}
Sample,Prop,A,B,C,D
1,0.042644585721321,49.8070975337169,307.029288124149,127.290160977898,119.363921090366
2,0.051286552544473,207.151687934325,385.803129282962,232.077642053051,152.451146796233
3,0.115456483870835,259.115243485315,350.89565982664,126.112015312861,194.269240170231
4,15.1980039696031,341.392794952748,2.50119646241174,370.843032180154,11.5134267982876
5,0.030828548720774,123.642359657426,107.674457089161,278.481606674966,277.417740655869
6,0.113310081828946,434.902594566398,405.870579391739,241.257457440821,213.210004173378
7,0.071973103667228,393.51387804721,243.422246542275,98.6921352953811,38.4646528894646
8,0.079124869408332,454.177123336891,312.18007412968,365.093447826501,93.4027537695288
9,0.084392098447046,262.904172099227,476.075762264071,95.6336322308505,269.096484900607
10,0.044467510536784,447.85350715457,423.476173355266,422.140647530134,105.30966798588
11,0.032607637392685,156.982834162006,216.937871068582,436.272542198989,438.578448993111
12,0.026590761658031,30.4947043445939,353.866638985695,131.530432627816,103.578990316735
13,0.882677326292512,324.183123925377,379.786690798287,93.7301886485703,440.061356079183
14,2.92863264703151,253.756388912426,191.488748047164,69.2744710777569,166.908183251839
15,0.041178758470398,433.425208331938,422.012179205648,138.480233516687,94.7864081755759
16,0.02951523999224,364.325349150667,478.127595998362,85.6428392655327,93.6000841896524
17,0.103881442342912,286.280745819571,226.720331942159,138.891298487121,78.0909759774124
18,0.079447386532567,184.446053206631,428.401650931551,356.108594859543,238.138089889099
19,0.490048714715941,437.097165477292,89.4506321427452,357.249495038998,21.2823078127849
20,0.315083955685341,464.689646103278,357.8239998639,166.719192215288,470.323737680847
21,0.336628829642389,453.229393345602,121.062956838254,368.072231287668,33.8834258163608
22,0.596250795257965,329.206703754852,336.263700827181,259.138467352137,407.462821099063
23,0.024008996387738,429.499336054639,451.30307811156,253.003258066353,11.9533585885846
24,0.702221733754583,293.874006420616,221.692047223248,42.2106293777491,277.645795523081
25,0.807995736802549,276.103314658051,161.778514482533,426.942506234502,208.868975590116
26,0.002730384017923,83.1768893799547,13.0356263432169,197.449738789384,355.96703006125
27,0.034760234337076,239.859835781859,226.950754683377,422.533852762138,472.823756482285
28,0.103325140788876,142.348449069038,308.188608196991,19.8589904106916,445.782867882951
29,0.069515399570576,325.065695936087,341.202112577236,280.094904922382,126.698479235295
30,0.026792086484689,105.496640506796,431.709809945209,201.067642207524,125.346044992663
31,0.06968520346432,278.288015848546,340.463606947326,62.5783439753465,135.763786890355
32,0.033814657993073,314.022680967248,366.997527539967,146.288622368974,52.3761667809278
33,0.036437360543752,182.544295340408,74.6987790052084,111.509818170011,241.023451399827
34,0.007278291999309,161.331981931619,108.016457758383,331.063276457351,498.833301187792
35,0.063162819962502,489.309265600451,424.263298255808,159.148021054163,150.645927662812
36,0.084687250049346,268.778111170417,12.2088368874704,283.50778492837,126.160505819305
37,0.193238168342884,356.429298308577,16.8790201937628,79.0256508718712,105.78215423975
38,0.002398998011824,18.700576586924,54.7261653842681,148.691281396519,365.033771980965
39,0.153459585676185,294.597161844894,103.910596069842,345.840575142828,208.072222213417
40,0.008244336063986,284.63690286644,15.4716735442082,102.064258484033,407.319217444755
41,0.038860594113166,242.474343916146,489.029235376506,398.649900719263,182.88700899363
42,0.068119481955482,288.653567920823,104.182871116269,70.369683070715,260.771564816744
43,0.645977325788857,285.468431709879,261.088369157819,493.106944180385,321.625679649568
44,0.056318139669975,180.087855188098,72.886342824395,103.167691072242,204.56315967502
45,4.03890609225025,198.253697705946,243.375043815026,348.789155694472,222.634358725914
46,0.050956703375414,66.8423643063199,65.3676810191975,496.070776260521,158.342895817271
47,7.71218334170515,395.439636236816,230.35515336685,64.9645947685536,211.908463158588
48,0.0214328895491,176.169330689589,464.950315259736,452.14257500201,81.9464407280035
49,2.6815357030127,431.955781915035,308.66349882149,253.874224338872,343.837415858124
50,0.750972167059506,224.327882299282,147.30201835669,243.603529830416,103.105383948355
51,0.01828936588316,249.505131204334,114.794245180025,129.495085479016,408.195718175082
52,0.323325638910123,159.141681749234,106.854744390776,18.9019889656962,51.4307457794658
53,0.033770961308791,413.581373474192,154.408120689668,446.571947766101,435.968644308603
54,0.318264739192304,346.575691958707,59.8626851714252,255.289629539941,132.392312946497
55,0.543889052259968,202.50018301682,224.87814578565,179.824036025239,168.045578982369
56,0.014813028268087,317.664906479146,95.6823941971786,410.391814113528,449.004998805183
57,3.57717288413323,275.990345747377,445.847337469333,364.60493511239,475.71306458261
58,0.129900583191695,9.14924177359304,119.375334020565,113.361398805488,62.8300931374718
59,0.03708937574487,185.837293865833,447.695352621602,145.051135814477,160.694140439915
60,0.014921382861101,8.28959490938569,378.093007577705,419.707558105521,40.4024046726325
61,0.387351324110643,407.707347482472,350.199800459508,105.74924661113,253.972219444862
62,0.101466855479979,267.424013298673,386.705098956208,106.841281052243,212.004932409899
63,1.32736567001172,352.225865613491,171.568875244562,466.911865424454,130.806654602562
64,0.028663161770634,200.509116400279,185.054151659821,169.780882949394,426.355265958408
65,0.066319972191657,393.903835973502,34.1090298843032,395.993284870997,201.465690562591
66,0.225228846252684,416.977891536474,469.286103651892,451.235879905236,329.368398152194
67,0.193954759220393,161.654732137163,117.19778787807,386.605589800927,191.350615565409
68,0.096588543650903,207.153853909472,281.333900278231,463.836665364427,431.036779599936
69,0.045009258705634,363.180221118644,60.3413214970106,282.709764209504,263.181135410842
70,0.148522003805379,337.475883356403,345.712927332466,287.038267897121,198.123437087294
71,0.233773563579686,417.561141951304,416.699554349938,87.471372642944,284.442500963842
72,0.07632953740424,353.462065059428,230.244117781226,205.862394545593,418.718162036753
73,0.018751232608648,211.936255629827,38.9153036995522,335.407375291207,269.160151304954
74,0.11436186782933,232.953194819263,75.6969339038158,145.359684234586,179.190191924589
75,0.059780123967251,69.2355001498863,279.298667202486,382.963222385851,434.84703056805
76,0.039466512803061,423.250211589563,470.623951042526,385.799699148574,127.024253733708
77,0.012044591018025,208.006274730239,51.9283654736177,256.955959532126,347.239249164622
78,0.02529290143529,104.714857532854,304.9501964971,31.8389612251596,37.8811131918349
79,0.004302255370929,177.067793973296,28.3724394563165,331.479931132225,461.564224843564
80,0.074133627013002,158.134705180115,315.976143027337,278.395310237464,484.311241814557
81,0.160836802038602,410.048253861679,191.235924936736,470.978702738376,322.209828240428
82,2.01269810172184,405.219860759387,382.357826642821,340.408900681332,340.037356281025
83,0.086463232833669,465.637225155392,273.935550533945,471.461401666282,69.4129300775254
84,0.09652399673283,484.793856217189,217.858512463092,317.765365776244,30.5574828436997
85,25.7254804725824,82.523989196792,270.839083225059,174.362686576973,263.842713219115
86,3123.2782662272,106.094612132738,332.523075165983,43.7520305984393,333.205085763281
87,0.024585156837383,445.981783633524,66.2298255679999,373.905334245721,377.150351563984
88,0.018205881117995,117.196993636293,487.277963654347,133.617747939771,85.6568366996931
89,0.188996142204433,479.415773481536,87.8379455379654,429.859856289863,204.165337443809
90,0.030687409853583,324.976847605473,470.960628473335,126.942577378075,106.983488589713
91,0.084751033512141,234.705200183164,155.730168172949,303.535045799807,16.2640518096776
92,0.019959943675665,342.417666791063,8.85018592692246,287.691069761052,283.171709994183
93,0.017102517653105,162.236891091598,81.3657842047582,456.824872475328,318.421521204707
94,0.070128975496401,23.8513212365969,333.533751731515,196.322141219655,479.082443413362
95,0.006819280465836,151.095020172981,37.8615330871062,227.034115691539,362.755341229094
96,0.009406739334267,32.3147853544107,113.549008148151,57.9053526795503,348.470092929769
97,0.026975504059684,53.4863829718894,186.176691450922,56.7764485836142,371.957528066938
98,711.780196017338,7.36908228123383,488.268102038773,252.670421142526,486.698386703915
99,2.82416953708447,183.480683022873,368.758162863328,2.80315566798772,340.166678214112
100,0.3850029324009,482.322626243789,100.05861510573,495.618985557607,17.9764839910466
{
"desc_dim": 2,
"n_sis_select": 1,
"max_rung": 1,
"n_residual": 1,
"data_file": "data.csv",
"property_key": "Prop",
"leave_out_frac": 0.05,
"n_models_store": 1,
"calc_type": "log_regression",
"leave_out_inds": [0, 1, 2, 60, 61],
"opset": ["add", "sub", "abs_diff", "mult", "div", "inv", "abs", "exp", "log", "sin", "cos", "sq", "cb", "six_pow", "sqrt", "cbrt", "neg_exp"],
"fix_intercept": false
}
{
"desc_dim": 2,
"n_sis_select": 1,
"max_rung": 2,
"n_residual": 1,
"data_file": "../data.csv",
"property_key": "Prop",
"task_key": "Task",
"leave_out_frac": 0.05,
"n_models_store": 1,
"max_feat_cross_correlation": 0.9,
"leave_out_inds": [0, 1, 2, 60, 61],
"opset": ["add", "sub", "abs_diff", "mult", "div", "inv", "abs", "exp", "log", "sin", "cos", "sq", "cb", "six_pow", "sqrt", "cbrt", "neg_exp"],
"fix_intercept": false
}
This diff is collapsed.
import shutil
import numpy as np
from cpp_sisso import (
FeatureNode,
FeatureSpace,
Unit,
initialize_values_arr,
SISSORegressor,
)
import pathlib
parent = pathlib.Path(__file__).parent.absolute()
def test_gen_feature_space_from_file():
initialize_values_arr(90, 10, 10)
phi_0 = [
FeatureNode(
ff,
f"feat_{ff}",
np.random.random(90) * 1e2 - 50,
np.random.random(10) * 1e2 - 50,
Unit(),
)
for ff in range(10)
]
prop = np.power(phi_0[0].value + phi_0[1].value, 2.0)
feat_space = FeatureSpace(f"{parent}/phi.txt", phi_0, [90], "regression", 1, 1.0)
feat_space.sis(prop)
assert feat_space.phi_selected[0].postfix_expr == "1|0|add|sq"
if __name__ == "__main__":
test_gen_feature_space_from_file()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment