From c9fdecc24d7ff1890dbdcc042a1fa91cc3e86450 Mon Sep 17 00:00:00 2001 From: "sadurska@trui.pl" Date: Tue, 18 May 2021 23:37:37 +0200 Subject: [PATCH] Linear regression --- dev-0/out.tsv | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 68 ++++ test-A/out.tsv | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2068 insertions(+) create mode 100644 dev-0/out.tsv create mode 100644 main.py create mode 100644 test-A/out.tsv diff --git a/dev-0/out.tsv b/dev-0/out.tsv new file mode 100644 index 0000000..2c4259e --- /dev/null +++ b/dev-0/out.tsv @@ -0,0 +1,1000 @@ +77497.5981730828 +12145.183204738423 +49614.76081514172 +14193.95902630873 +24411.78743601404 +78674.57835342642 +45093.73150507081 +9430.708212094381 +-8232.724232892506 +13879.290525869466 +25568.833666703664 +82812.4330928959 +6265.50123735331 +1607.9813047451898 +35841.60286660958 +24116.198240671307 +63157.95586764719 +94701.38593358826 +36727.04524317663 +6979.06861732807 +337.07804201636463 +7878.1579946335405 +-12434.567880833521 +58397.04103187006 +-5237.598255680874 +69304.49228382763 +79360.40583256632 +12212.45166661311 +10599.93806515541 +37149.723260872066 +75842.46299406886 +63474.69214879628 +7021.114373803139 +49996.63426013943 +39603.70783125516 +59278.15555410832 +32929.06514436565 +24936.393412044272 +42897.59869460296 +71335.3275401555 +74766.09899844695 +28805.56662850175 +39435.01918189321 +68445.94667971879 +12450.99508823827 +121629.70963680092 +91643.02354403678 +10226.742795088328 +38932.81235374976 +51131.56853915192 +74873.52349285223 +-7139.231804189272 +95314.95404706337 +39826.31165486574 +11915.349490043707 +-6563.98340793699 +-4067.469607492909 +25244.510332305916 +71447.95779551286 +20632.409069417045 +62593.66720701568 +-10320.212989846244 +-344.2792952451855 +72884.06029582769 +82842.3732743049 +29113.83393068891 +-6952.213588139042 +87099.03240122087 +33533.54241297301 +2325.789221126586 +20943.488640376367 +33464.34632398095 +18999.369836922735 +19500.368104106747 +167207.74066234566 +44771.572681246325 +63053.5211901525 +42305.4043821767 +67282.6443134034 +16767.882196183316 +47979.072268079966 +20780.227181452326 +45498.59387625102 +16645.68920593802 +18322.17821686901 +19537.73549389653 +56460.287847667 +41495.40915032942 +40852.53248755075 +23933.213687033392 +41008.840385847725 +32627.61406225525 +55482.142645143904 +45182.1858373452 +4068.907650442794 +3128.549973658286 +64673.44611378666 +60492.24597202148 +36746.9398571467 +30324.029830867425 +7033.592367576435 +5470.230192289688 +10259.694229476154 +20054.190633448772 +6364.458330564201 +25479.181104391813 +26187.710714843124 +42756.5129827261 +63522.90319916885 +19771.14869630523 +76696.68599507771 +-15197.181422404014 +54630.822895575315 +59806.10515675135 +8861.112592361867 +41008.804150374606 +12329.86303073261 +34162.087016522884 +56171.463384402916 +27048.49012425728 +24445.261783044785 +31076.513184827752 +-24503.11612137407 +30161.675732122734 +66740.3306320887 +75430.08439093549 +-20041.02258642204 +44084.617848875 +22035.88318245206 +46793.10665704869 +12405.770104807802 +-7135.794924139045 +46404.24202188384 +37774.460237680934 +-28656.935140392743 +63357.41409700923 +100303.74964265246 +56617.33373849839 +31658.619698510505 +63102.61278089974 +15140.106751420535 +51568.75929453317 +70111.61566795222 +18495.38215504214 +66592.60880121123 +51821.29233985394 +91174.80120741948 +15247.67248571571 +11204.415333762765 +57995.90248046722 +32223.670045377687 +18086.73050112091 +46356.930220148526 +-38566.626455326565 +74728.3237921521 +-13449.95141999051 +75608.14048965741 +18116.461089547724 +58647.85869064182 +60617.2533646049 +36703.7039143024 +66976.00464350265 +7236.0235531665385 +-3414.963083180599 +2984.5312355831265 +-9927.231479551643 +41958.282703460194 +38329.36768847797 +26197.446837645024 +82098.1777638141 +61066.521455001086 +71233.57450914942 +20161.158015860245 +22631.10114006605 +74849.24564486742 +37396.366197512485 +76676.3954305267 +95796.0023933677 +81944.38450781163 +74766.09899844695 +53480.590404987335 +33431.70622828975 +16967.51242802851 +-13844.52271509543 +21888.147479982115 +5925.5010204659775 +81895.1638172241 +37905.05868534744 +11104.278149727732 +23797.162999307737 +-11598.044199549593 +40050.259476614185 +44205.15950421244 +62637.90717997961 +1486.2406712379307 +55027.682990621775 +40921.52380197402 +57898.31384017039 +21523.00979295466 +37643.84746509697 +100693.73685078509 +95797.17100262828 +-5844.719023390673 +-17461.989149500616 +19332.222580730915 +22015.54505042825 +32782.9889867194 +65197.891748772 +67899.65010665078 +33135.65921607427 +25912.419131561182 +7328.541950888 +91585.1988258902 +42633.008856166154 +35026.32349324133 +77323.2066352237 +50575.23367202282 +61749.1845662212 +119885.69280544389 +53626.66656263359 +-14176.522481850348 +33601.824107226916 +26781.75146823097 +-9416.617727338336 +37432.1175126899 +26964.010015799664 +-1008.1418822770938 +40585.543256049044 +39238.57014422957 +54629.02702813875 +6437.172682010569 +44362.01647224557 +25642.98240048904 +46850.80828294903 +-601.9871000163257 +4722.287621136755 +72033.92528945394 +50155.55147883389 +13870.694567391649 +61594.72809050139 +37121.49574653339 +24809.050041024573 +21871.517136191018 +48919.21581887454 +37469.01505186688 +14617.085107526742 +13354.591830532067 +43307.45151155256 +30928.238910277374 +12400.073027755134 +54735.288523380645 +24463.979577838443 +49501.44218325522 +74423.03621094208 +12939.972875662148 +86554.31994716916 +32761.077563072555 +82882.24336798489 +33414.814729861915 +21675.11481096316 +68254.45496531017 +7747.3428120194 +20685.090748717077 +14513.969468493015 +73040.2157083517 +27439.767476620153 +-2651.392394533381 +95796.73277415615 +2796.7632039384916 +19904.32519305963 +-12508.540546167642 +24078.669252791442 +18867.534276642837 +17083.023437658325 +69026.94758429937 +15367.638533780351 +18528.39585411083 +149501.13788695168 +19643.27675145492 +24829.843270933256 +121240.39670754131 +62609.67695891764 +13248.860948925838 +15400.278629471548 +74765.66076997388 +30514.45979594346 +78672.95470659714 +8087.792572214268 +33897.438916223124 +56372.64215307962 +27796.226988716982 +72791.84174317867 +38346.10344644822 +-562.9884219327942 +27366.056098816916 +38029.88379621226 +43985.992560652085 +30596.171337500215 +28424.771592265926 +53701.31080334354 +23957.2283148868 +11510.830293804407 +3328.875692700036 +37116.81881657336 +14445.595016979612 +35102.53944771644 +6334.878680455498 +52363.55269374978 +39262.61926747952 +9037.960895895027 +4977.738863040693 +-23171.426755388267 +24784.982706081122 +-21069.569049358368 +67916.52934096102 +89022.95147321653 +2963.6325914934278 +26563.310530740768 +47765.958682520315 +26059.278432696126 +45706.26635671966 +49098.30567559041 +24240.65137280058 +17699.784735898487 +57638.81510310527 +76586.30543523934 +17672.111546251923 +44518.83105548378 +60532.59124806244 +30818.965734441765 +29106.39711872395 +64389.360310161486 +4047.762017841451 +35184.62012004852 +-5748.43073085323 +42366.68736886978 +42046.304832514375 +30104.287442352623 +53542.85084199067 +63368.28796821181 +130186.12862707581 +87527.93166614976 +45259.980300738476 +66521.71371157095 +13125.237275213003 +65014.55357334949 +15299.063036676496 +3969.5353512298316 +54433.05695320945 +39615.20229434688 +58558.80534378253 +14698.128062300384 +49056.90833991766 +32647.786700275727 +51881.551789038815 +63897.852358009666 +8428.700149281882 +4874.117103990167 +55213.331658724695 +21177.318737881258 +94715.33097909857 +41749.369039214216 +-765.0551889427006 +49069.45486264024 +54470.3007118199 +78190.44559871685 +178853.47224482615 +67916.6754171187 +54928.92984214891 +8490.971250868402 +31248.516032451764 +31735.939004943706 +-23827.23586820904 +70903.76326355804 +81615.23042746074 +42430.99456567317 +24501.090635921806 +47341.64602338243 +76586.04926192947 +37477.59866942931 +-16990.991087737493 +38905.684543304145 +36645.381696513854 +51057.545449860394 +-3750.1295223636553 +28108.246734805405 +19298.07218493987 +-14898.624509315938 +26363.695633311756 +-1252.4033422358334 +50090.47568579856 +71725.44695686176 +48157.541532907635 +24135.644872622564 +7508.729236506857 +65727.02572653536 +21704.1779158758 +70757.92228332069 +41104.01139087323 +34779.75774887018 +52109.54995822441 +37266.489308910444 +87409.72655348666 +61169.40135660302 +53672.645321223885 +26342.514590453357 +-526.8060320103541 +19940.133979606442 +80644.7865014337 +81259.11077647936 +45622.790035347454 +7007.6190680461 +19329.051140095107 +237988.714565509 +99221.51760289911 +120522.88474944606 +112497.76644148491 +11038.166538095102 +44787.0275996346 +47033.066830517724 +43401.33552737441 +66153.03373031504 +67469.63036868349 +78189.86129408702 +58627.348030445166 +48508.85314841755 +51687.33123718668 +-25461.172177031636 +55525.65661203861 +42983.01150325872 +39667.04395745043 +74722.1511777984 +56049.0616131518 +28352.406812421978 +4308.080203025602 +74765.66076997388 +20309.305952614173 +42834.0934437979 +27969.80736135505 +66033.71810352616 +32305.377033025026 +57483.84348429646 +23411.851977226324 +67916.09111248795 +61067.10575963184 +113115.01721707266 +43986.003793789074 +96180.23513437621 +65561.55512735993 +66008.76192365307 +61961.50436930545 +29316.449283818714 +7037.134661807679 +17940.654343474656 +25134.56845807843 +47551.98642428871 +9275.30182418041 +64975.024123340845 +50958.78870118596 +31107.72927618958 +77858.63427153416 +13682.507951674052 +25049.01021449268 +24554.426713611 +9163.864415521733 +39675.90249012597 +13522.280477592722 +82097.59345918335 +42307.35705449432 +39834.989829795435 +27917.61521953158 +18144.06926953513 +79841.40458826441 +69671.08198299259 +23429.331419332884 +52722.02454262506 +28555.890793119557 +19776.777881813236 +15403.814843329601 +58539.71718283463 +-27574.2961342521 +45685.36771262996 +23592.351256899536 +20512.591744408943 +18327.542193535715 +25365.124450548552 +52506.89209483564 +47649.390964907594 +32779.552106670104 +26246.55168887507 +44581.79165432975 +48192.38429941051 +78190.44559871685 +24007.994245843962 +19009.024991593324 +37277.98377200216 +63427.36136134062 +41770.1622691229 +76910.70248979237 +666.7593451896682 +63975.47454951238 +26538.817551959306 +34556.07551649865 +25312.93230872508 +60806.67461698223 +59405.75976797659 +66773.52075082343 +7921.90536403656 +89609.51691261306 +32532.23119347263 +-30250.57941076439 +106516.64885392692 +72894.28608890157 +20549.852543092333 +196444.47567443177 +49823.18946571369 +18497.862131191418 +47637.86507671885 +35768.92475063447 +-28065.030743638054 +23637.624491690658 +50552.78847019095 +105210.69431712758 +16593.575817475095 +25662.982326443307 +94309.56178206485 +-12199.705179994926 +93578.81657525245 +71484.31732753478 +68984.83575354237 +58596.42178237997 +28189.59489680361 +95140.12044553459 +13317.683434540406 +79411.56025683228 +12057.262761571445 +69879.73166603874 +2512.5246494365856 +65640.97078732587 +41995.83609522041 +75088.40705856308 +68311.52400059998 +27670.323469089344 +-1243.31857773941 +12953.892345471308 +6031.957908139564 +46413.26569362357 +19646.925443770364 +67561.8513888456 +70967.2686597174 +52478.229939482175 +56966.245550483465 +12974.064983491786 +28553.303965571336 +16901.066993083805 +3016.550739386119 +14768.621446022764 +-13279.939909420907 +2313.674166146666 +54193.84567174781 +136557.1245355811 +84354.49940754194 +1548.7956081237644 +40963.25381492637 +41157.73283165507 +-27369.254093562253 +55813.6460412126 +17921.56900047697 +-5727.84608138632 +2046.4779668813571 +73672.99841923919 +36502.132534566335 +92678.37537042983 +66070.79063427728 +82157.37206382863 +56276.56244098395 +49268.449168180116 +91174.80120741948 +30681.974341291934 +63650.91301026009 +-4806.176167963073 +56002.638220299035 +-21435.516810796224 +58470.94687871169 +72449.9739613384 +14256.437095658854 +7364.806775581092 +36324.378568271175 +63539.67264457885 +18382.23830925487 +-493.4399302499369 +24975.91942857951 +74595.00583316758 +14998.232546454296 +46263.68736420106 +63567.17685957067 +68171.35165297054 +127949.71369451284 +51396.58710849006 +2897.9787967335433 +27345.88346079737 +70100.99669958092 +44049.36745407898 +63464.49157657288 +14069.66287874151 +34714.07834045682 +13079.28001693543 +-48786.24167997483 +24905.750345008448 +56201.02897028625 +46700.56923918333 +16358.346594112925 +-1540.0403687190264 +56232.07547950931 +42632.66865757294 +41843.80507953279 +26939.942680857144 +21981.410903915763 +54377.2199888872 +42867.530862538144 +201228.80648684595 +14649.37280052621 +-19747.636121910065 +56747.131314014085 +37830.05115051288 +14030.75756551791 +39848.183293535374 +48761.64519813657 +11476.395011034794 +69661.99113812298 +-2738.1210347292945 +132204.56447626278 +90301.45450211316 +-542.1951920241117 +26510.195891166106 +-2460.631873381324 +30161.675732122734 +-950.7762302141637 +67969.63422698807 +26420.127528792247 +40118.20102365967 +-6040.171034700237 +21162.28198055923 +23186.202555010095 +34409.999358852394 +21452.747054223903 +49139.72936039232 +32827.22895968333 +58383.34294044785 +55560.73373033572 +56830.92017179262 +21672.575537742116 +26907.654987857677 +42763.492157006636 +62224.987225759774 +23913.767055082135 +55313.92665963061 +90204.15496571641 +87708.26605439838 +39952.94118056074 +51333.3189338604 +1393.4094505235553 +44989.61662040092 +25339.628497347236 +33845.867366286926 +39534.29198851902 +16808.227472225204 +13794.166901428252 +9135.71399498824 +88137.19576051924 +49678.24987218715 +32651.5204448374 +8324.668268325739 +87229.41428136732 +25856.89166327007 +34706.91781206522 +30788.02463939879 +80265.09299950767 +30985.214530108497 +44687.82757192012 +-38862.09353763051 +39522.66487648152 +17316.625028735027 +116358.80954304244 +76078.26028142031 +50752.09956299234 +63763.84830160253 +30510.18307535909 +36176.83272042032 +-9784.612393729389 +11364.493592835963 +11194.011295319535 +7565.0842644507065 +53340.37613410875 +48023.312241043895 +-688.6237523620948 +-18443.86298236251 +93954.08444934618 +-2076.354151668027 +70199.01956974808 +-3639.169938554056 +33013.65039337054 +95217.95947838668 +40511.83187824674 +21470.81765113212 +50327.16466162726 +57550.55018106941 +95796.73277415615 +33653.6474604588 +-15312.435686150566 +14272.89123810269 +-28642.271986448206 +22471.976953608915 +52344.000647618435 +7638.0696361828595 +35886.85116340034 +-12305.436061600223 +59842.28754667379 +129392.41363662016 +46172.10808561463 +58403.04520618729 +-2229.723478217609 +41413.70275702607 +57640.860169311985 +-2925.955709404312 +-1983.8167338026688 +55910.65968132671 +14231.092657756992 +22922.17504659854 +-2676.9825287787244 +27255.254970914684 +80277.09731610678 +102888.76322202478 +15420.765262114815 +2145.912389253266 +82097.73953534104 +-621.0665590949357 +28380.53161930293 +20300.449780555442 +1689.2924487162381 +26817.908244500868 +22818.869171710685 +91108.36295630969 +62493.17762029078 +-3171.566029661335 +46677.2279103091 +51572.85361325927 +42910.64672341384 +54941.351981452666 +16908.717058950104 +57651.14518197533 +-30161.936689822003 +44869.42868081201 +75883.64012297802 +3956.9826711509377 +67916.09111248795 +42280.75552190747 +-12634.064569664188 +-41844.34434757009 +29975.254298435524 +12446.115380848758 +12712.704368554056 +23924.5355121037 +108314.1115990486 +26553.906349741854 +45969.82847937569 +29027.57743246667 +32997.121449374594 +-35701.688619991764 +41281.3328201985 +-24858.955041581765 +36682.1846783245 +33619.97168259602 +35963.29835318308 +54555.98894931562 +8643.972395919263 +-25347.441114710644 +18223.40247776918 +39709.08631016966 +17830.034569681622 +23247.693463652395 +37196.99352431856 +-60152.05716952495 +60511.652998184785 +49794.9287431417 +4466.046453632414 +71240.09857690893 +59741.69254576787 +26145.254695821553 +13581.979132148437 +58197.772118782625 +7443.04982809443 +-9232.294280755334 +34873.909953888506 +172279.22683178447 +-15933.702159807086 +19749.923263176344 +79934.74910489284 +61066.521455001086 +17801.90976280067 +-11515.762481627986 +6104.322687984444 +61761.45023410022 +16344.83591549471 +23933.213687033392 +3470.7889642277732 +29377.756204108708 +35022.53421050031 +58315.22517891042 +73744.50640821457 +-6352.495988014154 +60532.59124806244 +75146.07782811392 +6577.335387214087 +39116.45590734575 +27934.50764556788 +13114.899846258573 +6854.876114238054 +79624.43334097788 +57640.860169311985 +36061.051452275366 +30214.48846583534 +3147.2377370195463 +36662.73804637324 +23652.55583483074 +67969.63422698807 +45998.418672012165 +-7684.0783271398395 +57638.81510310527 +92167.98880775552 +21365.839681413025 +48035.427296022885 +51093.727839782834 +72702.72242874559 +4111.448622757569 +42796.858258767985 +59688.15380598605 +15700.136125113815 +-9075.130249585956 +46463.44799560215 +20261.13710784912 +37957.420969527215 +65468.03177544009 +38345.63537093159 +4616.3949187016115 +37201.20042017009 +32957.96866440587 +65843.52506516222 +21429.746369021945 +23300.25002405513 +30335.258490772918 +33902.787708434276 +28546.78041496873 +55029.72651319858 +63139.89045763109 +58667.69330648705 +11147.439713931642 +49774.69210036378 +21792.397489916533 +-6577.563226410188 +20426.76531162765 +13358.754716649652 +-10377.136355409399 +41856.71470797248 +22638.700906234793 +-15044.700666962191 +22154.26550105959 +21202.627256601118 +29285.21878624335 +14920.866433621384 +70268.59492429532 +49004.42165976763 +36057.182369005866 +35922.95307714213 +7662.757563014515 +95797.31707878597 +44541.81998166628 +128351.86278500501 +61409.048193941824 +75415.98839436285 +33440.62917195819 +26269.811617489904 +60220.266294749454 +18593.78145967517 +40439.46709840186 +80349.05721674301 +45663.37298171315 +51070.012907532044 +97188.55314747896 +10742.577342752367 +3333.7238509217277 +25940.750906205736 +589.6110873380676 +26283.273270426318 +37477.59866942931 +-53002.583406844176 +38277.84127674997 +-16493.146639036015 +58939.67298375908 +81615.23042746074 +49536.5341485301 +27457.947088893503 +78190.44559871685 +-1524.608408949338 +26332.603374084458 +39334.955470276065 +-15157.410722848028 +16158.540635911748 +45704.149973533116 +91030.80268701259 +59972.35395241901 +115590.46308208723 +92875.58003916405 +60062.07508212328 +20447.083384577185 +-15438.06857504975 +27018.734811638482 +16312.917965273373 +25897.236939311028 +30027.71462945547 +88707.1489486508 +78190.44559871685 +738.3160986639559 +29892.99718103651 +71557.85156323761 +78200.47474632412 +95314.95404706337 +35366.87866761722 +14632.19873238448 +15128.298952198587 +59521.905010320246 +42055.62545007281 +30101.063260694966 +56309.26725965366 +13169.61159542203 +38929.061479077674 +65316.827147779055 +80959.78374068532 +61438.883610930294 +54665.763353782706 +-6900.61822867766 +-16183.392208673991 +27888.76440658141 +86429.87718912028 +40086.796869046986 +72085.63187454082 +64582.37838612497 +-12624.119597306475 +7387.897182078101 +88887.16852991562 +28664.73176573403 +36747.21788119711 +7987.047642107122 +-5435.62865355704 +32461.365266588517 +63321.1053692922 +68810.63478901517 +21492.74863395281 +20460.131413388997 +20444.259040287696 +3825.887668794021 +61350.7355505107 +40695.93444643356 +82610.26369071286 +67252.09449980408 +21285.899363815784 +21535.12484793458 +71988.65132722538 +74731.41292168666 +5209.768539200537 +54473.65210367367 +74409.82622448448 +47337.929883903824 +39981.06598744169 +48316.1499227928 +36317.04699129891 +167.39236630033702 +74766.09899844695 +25020.15940154344 +6748.733221187256 +44725.47433656268 +77789.0068042418 +75620.43374694604 +2737.577507317066 +7458.941371398978 +14490.455581830814 +67120.70643410273 +75751.70414680801 +68428.76134401746 +39096.65687270183 +34101.9676959198 +6382.50321093481 +45316.09423292242 +45732.27854332607 +-28518.19337334484 +17878.51429630071 +71672.83467439376 +74477.8227409618 +41344.15426534321 +118400.96835520677 diff --git a/main.py b/main.py new file mode 100644 index 0000000..ee31532 --- /dev/null +++ b/main.py @@ -0,0 +1,68 @@ +import pandas as pd +import numpy as np +from sklearn.linear_model import LinearRegression +from sklearn.metrics import mean_squared_error + +names = ['price', 'mileage', 'year', 'brand', 'engineType', 'engineCapacity'] +x_names = ['mileage', 'year', 'brand', 'engineType', 'engineCapacity'] +names_without_brand = ['mileage', 'year', 'engineType', 'engineCapacity'] + + +def main(): + train_x, train_y = get_train_data() + + model = LinearRegression() + model.fit(train_x, train_y) + + dev_x, dev_y = get_dev_data() + + predicted_dev_y = model.predict(dev_x) + save_csv(predicted_dev_y, 'dev-0/out.tsv') + + test_x = get_test_data() + + predicted_test_y = model.predict(test_x) + save_csv(predicted_test_y, 'test-A/out.tsv') + + print(RMSE(dev_y, predicted_dev_y)) + + +def get_train_data(): + raw_data = pd.read_csv('train/train.tsv', sep='\t', names=names) + x = raw_data[names_without_brand] + x = pd.get_dummies(x, columns=['engineType']) + y = raw_data['price'] + + return x, y + + +def get_dev_data(): + dev_raw_data = pd.read_csv('dev-0/in.tsv', sep='\t', names=x_names) + x = dev_raw_data[names_without_brand] + x = pd.get_dummies(x, columns=['engineType']) + + with open('dev-0/expected.tsv', 'r') as file: + y = [float(line.strip('\n')) for line in file.readlines()] + + return x, y + + +def get_test_data(): + test_raw_data = pd.read_csv('test-A/in.tsv', sep='\t', names=x_names) + x = test_raw_data[names_without_brand] + x = pd.get_dummies(x, columns=['engineType']) + + return x + + +def save_csv(data, path): + df = pd.DataFrame(data) + df.to_csv(path, sep='\t', index=False, header=False) + + +def RMSE(dev_y, predicted_dev_y): + return np.sqrt(mean_squared_error(dev_y, predicted_dev_y)) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/test-A/out.tsv b/test-A/out.tsv new file mode 100644 index 0000000..1a98752 --- /dev/null +++ b/test-A/out.tsv @@ -0,0 +1,1000 @@ +24338.076058211736 +23636.277893733233 +12031.8488286715 +-8466.05789163988 +-5934.44015309494 +20841.27885231655 +40507.345264752395 +19934.26178730931 +118060.46094445419 +47491.467941477895 +-29400.509392365813 +44459.507296470925 +-7569.840319186449 +31054.11681625154 +-24708.09540592879 +-7106.944111189805 +44810.98337077722 +66623.67784153484 +35440.53733832855 +15074.367045550607 +60292.6310745934 +17884.299315531738 +-4466.078810459934 +45296.353263992816 +5512.117142422125 +23519.752941452898 +38354.055615308695 +34714.31187605858 +73998.21138132736 +26121.916198036633 +41602.25516400952 +21888.147479982115 +23913.041049012914 +9703.660883947276 +71084.7872983329 +13765.936680366285 +54219.8068658486 +46452.1897361977 +70729.12417746149 +35286.45630473178 +8809.809180140495 +50416.88579133153 +37213.67657519877 +67971.28970534448 +66905.29557328578 +33229.62913898565 +37063.72968374845 +8839.404873947613 +28005.808397167362 +43568.66273180209 +40768.218929287046 +87297.86171785649 +13717.289663862437 +46397.73226157855 +-4721.322729761712 +30527.539425218478 +66617.65113611799 +33304.84423190821 +72782.15668163914 +95796.0023933677 +21198.11196778994 +79060.30134841241 +63621.441605421714 +26559.14764462132 +61445.96039580647 +69380.19990753382 +-4746.55438094493 +-1787.9527110476047 +43345.63812651485 +78191.0299033476 +49856.62288203556 +94701.38593358826 +28241.787038628012 +76334.49839598686 +47585.0837681042 +19729.750625155866 +22734.20645680558 +16506.979856332764 +84655.32989776414 +31706.256138071418 +15660.775859540328 +45665.65707798954 +64834.51996248867 +44009.707492903806 +39790.85527101252 +76360.87976869475 +84675.50253578462 +16077.846683992073 +34719.23983480781 +46859.25805365853 +13163.635574751534 +58727.217025283724 +75533.05734462664 +47485.83536515478 +18759.677852650173 +75412.18668999057 +20900.711233115755 +7913.5916076870635 +63792.120501522906 +40225.5414497219 +74765.66076997388 +56493.18128557876 +7247.518016257323 +26164.70132777281 +33155.563664898276 +68926.47836470511 +54324.340740335174 +4443.534202645533 +43452.05797899421 +19256.39255740121 +26964.010015799664 +-1081.4518232764676 +58698.45935012959 +17473.86343855597 +6234.89842537418 +79371.42513869796 +659.1595790209249 +74765.80684613157 +-10555.338458002545 +45105.22596816253 +22711.791692147963 +12020.001962888986 +34413.11145533621 +-2628.956104164012 +13439.797671424225 +16990.486019793898 +29604.381062434986 +2150.862250530161 +61609.16766775772 +44473.24448456243 +23043.99548063334 +15919.080052990466 +35850.58829729725 +7758.578091522679 +111938.86237660702 +75862.63563209027 +29329.353345026262 +45912.56827611197 +52236.80007580854 +31823.122554823756 +35865.977457311004 +29845.456081886776 +43872.59789115656 +-22222.25262697134 +34198.8899983326 +24004.696720351465 +122036.53670471534 +43360.99025133345 +33646.252468858846 +10924.109884252772 +58680.93913983926 +73369.81552603934 +73874.7946157474 +29852.16706697084 +-7010.511996401474 +117806.43839358538 +45834.986164506525 +28077.258444295265 +41003.59909096733 +24529.429906380363 +21886.92836977262 +18972.21802462265 +56747.87687925622 +-9651.93540199846 +62635.090891818516 +43266.05487712845 +27158.69695447851 +65702.5088482853 +44593.28611742053 +62723.73361275997 +61323.22176116053 +812.5621608756483 +25276.74991880264 +55231.11339595541 +59083.676537380554 +15027.083359404467 +34693.109080636874 +60889.667725265026 +82751.65128304902 +62992.67691917904 +45778.63113656454 +51773.28969014622 +25020.779993431643 +96207.3149494296 +53305.66343439091 +71214.98045233265 +36142.740612589754 +39022.46276925318 +94182.73730831873 +23356.240633418784 +26513.74724259507 +10380.876535776071 +3619.493975554593 +17915.24041057378 +15322.521967054345 +10559.592789114453 +56374.14541910216 +44914.28924566414 +11091.084685988724 +41519.408024978824 +96711.67432416044 +27820.29432365857 +20048.625611193478 +57259.7444637334 +77378.71557512973 +65732.5352106113 +20836.431352587417 +8726.210519067943 +36997.43221097998 +18301.06273936946 +25917.409577331506 +-16995.775224237703 +23288.03873969335 +42642.7055404 +33126.58893478289 +1395.9758171830326 +56347.105127932504 +27731.50778046716 +38597.910485700704 +13843.210668430664 +26416.508367025293 +14305.433453191072 +70816.76987204887 +7949.98138033133 +-7943.323970223777 +5483.423656030558 +-14002.406936861575 +57488.64726098161 +15254.928477893583 +50445.01059821248 +-32000.677014362067 +1177.864973817952 +53417.39651053492 +61847.27666688152 +43556.84885220975 +6060.489304589108 +46346.92601524852 +23690.859238632955 +59563.596884317696 +52549.12502912246 +-25492.47380317934 +-914.218799892813 +62854.708486463875 +-10929.591945056804 +20720.264224878512 +29263.93241021596 +51646.98596114572 +120427.81726895273 +44864.07657006942 +38779.09062450938 +20120.708834649064 +41133.27905174252 +70188.225268499 +57531.61038784683 +59964.71349504776 +72672.48116197903 +19059.47573953867 +38221.252721930854 +78191.0299033476 +90085.81572451908 +27264.66870930791 +85935.10311490577 +69852.6672315821 +1633.369623992592 +57164.38894888479 +30900.06731465552 +28266.474965459667 +44424.66819069255 +11221.77168362122 +66536.27769794501 +26911.817873976193 +8214.039895056747 +39049.317280985415 +71087.34741318505 +-1252.4033422358334 +5378.104785870761 +14293.67228068877 +20038.18088154774 +81443.99118602369 +47532.702100704424 +43352.31207640376 +17807.013221842237 +54166.83663443662 +45615.63786683697 +34033.19619457703 +39302.25674914569 +58381.425011266954 +78191.0299033476 +2555.1506309388205 +42995.12655823864 +35034.6492654793 +40053.43076728657 +35177.40862504486 +23758.286716436036 +47450.089403609745 +12738.267696142197 +48487.329542427324 +46381.058785055764 +26801.92410625145 +44427.0373217538 +87240.56617661938 +34137.652663181536 +111578.39571884926 +71477.43589203898 +94455.27352113184 +59843.634144632146 +40783.8115555197 +4103.446346624754 +81519.11231572926 +28908.053739363328 +36455.06556590367 +-6220.584355498664 +56932.87944872212 +51615.83925827965 +13444.312960235402 +64058.59166960046 +24162.663043438457 +-11697.790102139115 +37899.81739046797 +44622.136930371635 +72249.1952653164 +41108.344962105155 +91774.74825922865 +19084.689850160852 +16666.47086876165 +89543.89073315449 +32757.68046800047 +22099.25684050098 +50238.79012988135 +11581.773489949293 +-38074.38472687546 +4114.885502807796 +53505.02702066861 +69604.33776358329 +58043.04339985922 +34863.726032767445 +26448.488804265857 +-8552.559320622124 +71093.23495666403 +64004.186795167625 +59263.941669642925 +45548.70870115422 +39558.65115526039 +123451.71171026025 +78189.71521792933 +11801.292836200446 +12682.18836606294 +23770.09517415054 +89602.90550084319 +39837.80611795653 +62201.37443221826 +57185.890409315936 +78503.09734106995 +4026.510971060954 +41396.96699905582 +26295.120136209764 +43834.964082943276 +12380.366874738596 +37636.89500371739 +49057.96039954852 +62440.58257953543 +9836.50516978465 +13521.461218087003 +27138.884279306978 +-7103.049414266832 +38646.20793060213 +65223.03804465383 +36439.05581400171 +33021.60256223101 +56997.78676721081 +56682.150818231516 +130045.16536621843 +27348.69974895846 +23465.410070814192 +24732.05863983929 +44328.471043526195 +56810.870626019314 +61066.667531158775 +-1443.3400647342205 +15037.540104936808 +81615.23042746074 +21559.1921828771 +43141.202715884894 +39319.51306365058 +25381.860208519734 +25186.956843351014 +28759.5126572242 +7047.966533456929 +679.332217041403 +557.5915835350752 +1291.7616545092314 +33115.21838885732 +49960.87182697561 +19093.253852745518 +32671.43690954894 +42889.55467490293 +37265.07232579682 +57953.0318927411 +59560.004174564034 +33177.08290087618 +77337.14254723024 +-6279.078413060866 +46874.17084673699 +50234.627243762836 +20865.614376456477 +-5045.868152235635 +30952.280631568283 +7319.534079135396 +19817.84962174762 +42602.885165415704 +52465.388878433034 +53270.82764242496 +63319.88510913029 +68019.98860402126 +59456.56009595841 +48347.7522493368 +1434.8925779471174 +69964.49554094113 +80157.65146483295 +23539.995579375885 +53710.368200965226 +29661.850936360657 +67916.09111248795 +7625.899043024518 +56401.85738460813 +30379.485114202835 +35688.5023877481 +61206.61700835265 +95022.94780792855 +41640.40919950791 +34892.467804755084 +14653.424165513366 +61066.521455001086 +-5382.881032381207 +7971.293233586475 +31488.4762059208 +31443.929635692388 +91657.94287129026 +61096.1026487397 +25709.981433472596 +95314.36974243354 +71861.84320102632 +23992.698997761123 +-11226.27974093426 +20645.988101618364 +58357.26059152186 +18266.397068378516 +30781.43674656283 +46017.918011053465 +41359.438011176884 +-26502.387177063152 +22964.94532935787 +-31675.15859730821 +26270.19430778362 +13847.773195276037 +66370.90402940102 +-10329.297754342668 +25177.73002228141 +99505.59903180413 +26066.27516027447 +20614.72237297427 +3288.5304166590795 +23466.317465612665 +15988.125554287806 +34790.606006419286 +4671.065326512791 +40289.831601756625 +53221.39373207092 +-18605.83068331424 +-35559.39716539066 +46108.588385831565 +10568.270964043215 +76580.7959511634 +35783.48565866891 +56951.58239653893 +-5383.233435072005 +51368.51819511969 +42873.27501098625 +15440.623905512504 +51349.6977651529 +205.5419460684061 +75558.26284763776 +125863.80975762848 +81546.92530421726 +8738.183200781234 +93697.38851790689 +38411.53715851717 +52300.73327967618 +46482.128301692195 +44112.62208634801 +-18178.565704694018 +29641.416852410883 +25451.05629750993 +20370.41028368473 +57087.32652554009 +35440.59004541952 +29735.56231416203 +65332.93181237858 +75730.02112738043 +50526.77955905534 +30766.15300072916 +75194.43878984079 +8169.561533057131 +58053.19126499258 +4318.663286354393 +19059.51414760761 +57302.63783874083 +37749.57834670227 +-51507.21645223163 +51651.93581791036 +68849.30533577688 +-13340.284516875632 +83837.74018501304 +58070.698202545755 +44021.20468841493 +131163.07515968196 +26281.926672468893 +94701.38593358826 +17798.01506587863 +53878.47360188514 +67497.35636849236 +40325.41044455953 +40257.097812453285 +23580.19105498586 +105587.70169555955 +-13684.534091403708 +7325.744682869874 +-13404.49683109019 +-5195.583004930988 +35906.943325240165 +17558.05489240866 +48236.77732306998 +-32845.46685913019 +51111.08418964222 +34132.14577892423 +28165.985378733836 +12439.136206567287 +95160.57110760454 +79773.52001612633 +59645.319804357365 +54649.19966615923 +43377.99921425246 +24880.443759476766 +78191.0299033476 +52040.00146654248 +3497.9407765287906 +32556.595880367793 +31614.379725546576 +118301.32453178708 +56876.02457777504 +40983.42645294685 +61646.19207924884 +39895.8601465486 +95141.51975058205 +34547.71133619174 +75685.12262473721 +50715.27642785944 +40439.46709840186 +66487.89198613167 +24362.76398504339 +-21612.663274244405 +29137.608596157283 +-19144.23726206366 +12243.84086332377 +91201.85512244236 +71416.35541737825 +68838.75959589612 +13875.610365398228 +49983.49350348953 +74078.55326803308 +83498.07659221254 +52782.46419106331 +7703.823423245922 +47307.85078006424 +90688.39211303741 +25104.953230990097 +93122.77920730878 +58461.71982666664 +-3788.403121985495 +85531.78684364352 +11729.644877627492 +6339.393969265744 +48620.28480614163 +38978.70552193653 +-8148.571443974972 +104065.31813955959 +26480.92097800877 +29515.774778714404 +91701.71203631628 +-8524.208111366257 +124339.54002698418 +4644.687626784667 +80122.19665070064 +52072.020970345475 +173947.75320159737 +-14134.87761932239 +-2644.2370189065114 +22160.84527392406 +31609.389279777184 +49600.06981512718 +29106.39711872395 +10785.728601425886 +513.1382839027792 +317.63141006603837 +40199.50692493282 +11711.57170649711 +31201.56518550776 +33574.966097774915 +58613.42856063694 +5795.422598833218 +59834.22996363323 +51585.49137952458 +54315.043765378185 +91050.66629927792 +-3596.845196282491 +57071.04628414847 +8859.597045248374 +11979.036094957963 +-10134.46633492224 +20718.917626920156 +59419.06185752433 +29537.02582549583 +24023.952637643553 +94577.43508628011 +10491.425818205811 +42477.25726666208 +16881.212843957357 +-24941.344594313763 +37137.14890923444 +75419.99439860787 +35956.7498640893 +-9270.875136136077 +64236.687331050634 +32807.05632166192 +57611.068095130846 +52176.110758029856 +55610.31872858014 +33194.55187072512 +54365.70182317309 +33780.834163414314 +89099.56504626852 +30752.33693971671 +60564.61075186543 +41084.16688878182 +33266.078024511226 +112175.30586949829 +24217.00116352737 +25401.680443848483 +23956.848219900392 +-15263.435407302342 +112893.88308366667 +6015.6543533895165 +63975.03829679545 +64960.50239769369 +50504.379329390824 +104751.63028548285 +-14958.414338862523 +81614.93827514537 +84794.10224752873 +8517.342870224267 +83834.07018030155 +897.7731545334682 +56353.14281403739 +12390.813148013316 +-67291.0012622131 +2531.4663152387366 +16864.81739129685 +40691.27413765434 +144447.39167282358 +40525.02534198668 +-3869.201308022253 +62373.12257787865 +-12219.877818015404 +-9878.496409552172 +38969.998034287244 +39104.609041562304 +77336.85039491486 +73150.34346499201 +54255.21116618253 +30978.36520851031 +30880.830246461555 +17632.492276280187 +79891.82391954679 +19055.724864865653 +-10312.445720375516 +43813.19373226166 +1631.9048174386844 +82299.63490695879 +37403.887291627936 +4826.8077910505235 +14027.378019724041 +23524.329092151485 +5337.759509829804 +24947.068615629338 +34347.46570846997 +-15733.763184573501 +1977.5958725130185 +10024.718199066818 +1715.1181239476427 +77497.5981730828 +49516.361510509625 +4927.035251882859 +81615.66865593381 +4567.258411899209 +-34245.005716149695 +44114.531014329754 +63362.36444572639 +76294.1531199459 +68223.12345749792 +53233.507093457505 +3458.010608223267 +32336.082338850014 +23859.55501632113 +89510.62335388642 +33060.4342667209 +26912.49400404375 +54190.79855519906 +74766.09899844695 +1469.5049132676795 +11639.20692665223 +27126.716517237015 +81269.95751608629 +90481.40751292929 +15578.59911141824 +95313.6393616451 +-1410.5945548620075 +71159.96836633887 +91294.32133023255 +65060.95213510562 +1028.8923553861678 +33347.1209792858 +97726.03002336808 +28169.422258784063 +70042.93516663741 +69698.5861979844 +5978.419168358669 +36109.37451082934 +53918.81887792703 +39210.69232586026 +36849.24758073315 +38472.006966074 +63791.55948435888 +31729.514788150787 +78190.44559871685 +37862.28840258811 +29998.863816505298 +17602.915457260795 +7337.239145960659 +52139.14974017348 +14434.100553888828 +29705.976638800465 +35996.6644549435 +-1650.0123210558668 +36152.21446003392 +9037.960895895027 +75066.18392342702 +64390.38284326531 +57376.58063104004 +27265.50299526658 +85009.24486824498 +9984.69233952649 +55248.89345675893 +70433.65660771634 +75343.74264431652 +-39110.75123552047 +40858.251770479605 +95797.17100262828 +-555.8381990706548 +48385.67236869689 +57068.80774123501 +123708.8142312672 +41219.6303298641 +4630.7200504709035 +1880.5815739054233 +67916.09111248795 +23401.827204340138 +14414.653921936639 +84348.5144285271 +28732.581256768666 +22013.430407718755 +-1439.445367812179 +64354.63868181594 +57003.87943117041 +121692.19224759843 +47743.27498073038 +14283.509107430466 +35830.25439866446 +44480.94048011489 +50372.6458183676 +64254.31991309766 +-13481.816398214549 +20432.000526135787 +43559.25855080411 +51501.098264453 +20817.58512075059 +25945.22778694704 +8494.40665113274 +107342.98909309786 +18104.086850980297 +63157.79919958208 +-3715.7935734027997 +76886.87715233397 +23123.543131550774 +30271.569499846548 +57322.81047676038 +3508.317952107638 +45528.110526200384 +-14220.083460214548 +43068.837936040014 +71413.12200354785 +25166.856151078828 +109760.50688608177 +34535.90287847817 +42980.83219288662 +28614.44144504983 +3077.068653448485 +82097.59345918335 +26040.84921148792 +34896.63069087453 +46813.5926311994 +2004.918733395636 +2598.494904467836 +60398.36195619963 +3479.7278663748875 +19227.516130799428 +116044.6657254314 +43510.8963829251 +36795.620740279555 +7078.532732957043 +10024.718199066818 +35612.49828859884 +-32965.45430511236 +45883.949749954045 +68866.26381088793 +12493.415799395181 +67916.38326480333 +41588.780071595684 +47555.46854101587 +10194.455102088861 +16170.621357615106 +21568.904312453233 +22483.946573658846 +63316.09582638834 +27544.41994946357 +-952.9194499701262 +22382.11038897559 +33931.425609871745 +24679.260876772925 +28955.537483070977 +44437.78810071014 +19128.710236598738 +47261.532540895045 +38391.36452049669 +96997.28114817757 +19031.657529923134 +35629.6288340576 +95314.36974243354 +-24376.63041792903 +30145.665980220772 +58471.13625482377 +75146.07782811392 +80916.20436222013 +19165.6186325904 +20407.213265495375 +14021.69260341674 +22502.8555616308 +21824.240792373195 +-15673.245270512067 +22565.421731652692 +36381.3541881023 +64066.159373267554 +30684.384039886296 +66064.66054988 +33613.80236087926 +22382.730980863795 +60349.76429009624 +3069.363473098725 +5812.170372691937 +32773.69021990243 +16142.153880795464 +-4649.861119763926 +82570.20083884243 +10272.035563159734 +40738.79525020905 +6542.551160924137 +-20058.346288070083 +-15040.537780842744 +23524.2426166106 +-9202.60467501916 +27419.594838598743 +94117.22737916 +42565.101103268564 +27442.583764781244 +4355.895978469402 +67916.09111248795 +5386.056954731233 +67824.2840754101 +13269.654178835452 +30564.34240702819 +29549.14088047482 +19948.459751843475 +27304.459775995463 +61133.322756219655 +91533.46642580163 +21733.201855362393 +70311.74164152052 +98145.71777132992 +21721.278092426248 +76235.10489608813 +34571.778012641706 +1557.193702235818 +-2278.373325811699 +87474.12935962714 +53534.588441425934 +39148.1201773677 +26992.134822681546 +31276.74625351373 +-21152.72701041773 +11914.002892086282 +12624.211042298935 +27776.054350695573 +8182.75499679707 +-31691.894355278462 +37212.9357221527 +28997.95819422789 +77269.3132907264 +10490.770303500816 +31905.91144895181 +74416.2531133825 +37558.64162420388 +25803.352923488244 +56089.11530562583 +-24364.371540699154 +4307.575412830338 +12791.758402390406 +64762.54665160086 +32973.30511732958 +7422.444986853749 +40755.68674863875 +-4393.281827394851 +67916.6754171187 +-23483.751708702184 +36283.826324466616 +44236.23323976807 +-5894.094877053052 +68952.56550733745 +56243.92234529182 +-63.62144304253161 +45750.40091550257 +28248.829627536237 +3669.9918502094224 +28636.501544672996 +67186.44070504326 +78670.42951456178 +-5626.278085899539 +58029.12393005099 +7462.731663051993 +-13764.037352049723 +37140.58578928467 +26895.863660254516 +15112.721403516829 +5410.2809577398 +61066.521455001086 +36564.79998875316 +13118.675676091574 +67670.1503347233 +114735.06747342087 +81587.73058718629 +46838.02747227717 +37891.45321016107 +43357.99626527447 +31632.10486399848 +124958.20736229513 +16897.94860192854 +12041.766822936945 +42452.24561245367 +52092.19360836502 +-37660.84418076649 +43048.665298019536 +36750.37081884779 +-13866.252104764804 +53593.6528635649 +9431.328803983517 +979.0842985035852 +26374.464090335183 +4939.620969549753 +15509.551805307157 +81031.65617766231 +83501.91338190623 +23987.474776875228 +12717.016649359837 +68064.24424888007 +66655.67481423821 +30443.767355347984 +150111.36523079686 +2683.9689345574006 +72207.87422412075 +58585.333199076355 +47060.57104551047 +87273.66156634595