diff --git a/dev-0/out.tsv b/dev-0/out.tsv new file mode 100644 index 0000000..e281821 --- /dev/null +++ b/dev-0/out.tsv @@ -0,0 +1,1000 @@ +77497 +12145 +49614 +14193 +24411 +78674 +45093 +9430 +-8232 +13879 +25568 +82812 +6265 +1607 +35841 +24116 +63157 +94701 +36727 +6979 +337 +7878 +-12434 +58397 +-5237 +69304 +79360 +12212 +10599 +37149 +75842 +63474 +7021 +49996 +39603 +59278 +32929 +24936 +42897 +71335 +74766 +28805 +39435 +68445 +12450 +121629 +91643 +10226 +38932 +51131 +74873 +-7139 +95314 +39826 +11915 +-6563 +-4067 +25244 +71447 +20632 +62593 +-10320 +-344 +72884 +82842 +29113 +-6952 +87099 +33533 +2325 +20943 +33464 +18999 +19500 +167207 +44771 +63053 +42305 +67282 +16767 +47979 +20780 +45498 +16645 +18322 +19537 +56460 +41495 +40852 +23933 +41008 +32627 +55482 +45182 +4068 +3128 +64673 +60492 +36746 +30324 +7033 +5470 +10259 +20054 +6364 +25479 +26187 +42756 +63522 +19771 +76696 +-15197 +54630 +59806 +8861 +41008 +12329 +34162 +56171 +27048 +24445 +31076 +-24503 +30161 +66740 +75430 +-20041 +44084 +22035 +46793 +12405 +-7135 +46404 +37774 +-28656 +63357 +100303 +56617 +31658 +63102 +15140 +51568 +70111 +18495 +66592 +51821 +91174 +15247 +11204 +57995 +32223 +18086 +46356 +-38566 +74728 +-13449 +75608 +18116 +58647 +60617 +36703 +66976 +7236 +-3414 +2984 +-9927 +41958 +38329 +26197 +82098 +61066 +71233 +20161 +22631 +74849 +37396 +76676 +95796 +81944 +74766 +53480 +33431 +16967 +-13844 +21888 +5925 +81895 +37905 +11104 +23797 +-11598 +40050 +44205 +62637 +1486 +55027 +40921 +57898 +21523 +37643 +100693 +95797 +-5844 +-17461 +19332 +22015 +32782 +65197 +67899 +33135 +25912 +7328 +91585 +42633 +35026 +77323 +50575 +61749 +119885 +53626 +-14176 +33601 +26781 +-9416 +37432 +26964 +-1008 +40585 +39238 +54629 +6437 +44362 +25642 +46850 +-601 +4722 +72033 +50155 +13870 +61594 +37121 +24809 +21871 +48919 +37469 +14617 +13354 +43307 +30928 +12400 +54735 +24463 +49501 +74423 +12939 +86554 +32761 +82882 +33414 +21675 +68254 +7747 +20685 +14513 +73040 +27439 +-2651 +95796 +2796 +19904 +-12508 +24078 +18867 +17083 +69026 +15367 +18528 +149501 +19643 +24829 +121240 +62609 +13248 +15400 +74765 +30514 +78672 +8087 +33897 +56372 +27796 +72791 +38346 +-562 +27366 +38029 +43985 +30596 +28424 +53701 +23957 +11510 +3328 +37116 +14445 +35102 +6334 +52363 +39262 +9037 +4977 +-23171 +24784 +-21069 +67916 +89022 +2963 +26563 +47765 +26059 +45706 +49098 +24240 +17699 +57638 +76586 +17672 +44518 +60532 +30818 +29106 +64389 +4047 +35184 +-5748 +42366 +42046 +30104 +53542 +63368 +130186 +87527 +45259 +66521 +13125 +65014 +15299 +3969 +54433 +39615 +58558 +14698 +49056 +32647 +51881 +63897 +8428 +4874 +55213 +21177 +94715 +41749 +-765 +49069 +54470 +78190 +178853 +67916 +54928 +8490 +31248 +31735 +-23827 +70903 +81615 +42430 +24501 +47341 +76586 +37477 +-16990 +38905 +36645 +51057 +-3750 +28108 +19298 +-14898 +26363 +-1252 +50090 +71725 +48157 +24135 +7508 +65727 +21704 +70757 +41104 +34779 +52109 +37266 +87409 +61169 +53672 +26342 +-526 +19940 +80644 +81259 +45622 +7007 +19329 +237988 +99221 +120522 +112497 +11038 +44787 +47033 +43401 +66153 +67469 +78189 +58627 +48508 +51687 +-25461 +55525 +42983 +39667 +74722 +56049 +28352 +4308 +74765 +20309 +42834 +27969 +66033 +32305 +57483 +23411 +67916 +61067 +113115 +43986 +96180 +65561 +66008 +61961 +29316 +7037 +17940 +25134 +47551 +9275 +64975 +50958 +31107 +77858 +13682 +25049 +24554 +9163 +39675 +13522 +82097 +42307 +39834 +27917 +18144 +79841 +69671 +23429 +52722 +28555 +19776 +15403 +58539 +-27574 +45685 +23592 +20512 +18327 +25365 +52506 +47649 +32779 +26246 +44581 +48192 +78190 +24007 +19009 +37277 +63427 +41770 +76910 +666 +63975 +26538 +34556 +25312 +60806 +59405 +66773 +7921 +89609 +32532 +-30250 +106516 +72894 +20549 +196444 +49823 +18497 +47637 +35768 +-28065 +23637 +50552 +105210 +16593 +25662 +94309 +-12199 +93578 +71484 +68984 +58596 +28189 +95140 +13317 +79411 +12057 +69879 +2512 +65640 +41995 +75088 +68311 +27670 +-1243 +12953 +6031 +46413 +19646 +67561 +70967 +52478 +56966 +12974 +28553 +16901 +3016 +14768 +-13279 +2313 +54193 +136557 +84354 +1548 +40963 +41157 +-27369 +55813 +17921 +-5727 +2046 +73672 +36502 +92678 +66070 +82157 +56276 +49268 +91174 +30681 +63650 +-4806 +56002 +-21435 +58470 +72449 +14256 +7364 +36324 +63539 +18382 +-493 +24975 +74595 +14998 +46263 +63567 +68171 +127949 +51396 +2897 +27345 +70100 +44049 +63464 +14069 +34714 +13079 +-48786 +24905 +56201 +46700 +16358 +-1540 +56232 +42632 +41843 +26939 +21981 +54377 +42867 +201228 +14649 +-19747 +56747 +37830 +14030 +39848 +48761 +11476 +69661 +-2738 +132204 +90301 +-542 +26510 +-2460 +30161 +-950 +67969 +26420 +40118 +-6040 +21162 +23186 +34409 +21452 +49139 +32827 +58383 +55560 +56830 +21672 +26907 +42763 +62224 +23913 +55313 +90204 +87708 +39952 +51333 +1393 +44989 +25339 +33845 +39534 +16808 +13794 +9135 +88137 +49678 +32651 +8324 +87229 +25856 +34706 +30788 +80265 +30985 +44687 +-38862 +39522 +17316 +116358 +76078 +50752 +63763 +30510 +36176 +-9784 +11364 +11194 +7565 +53340 +48023 +-688 +-18443 +93954 +-2076 +70199 +-3639 +33013 +95217 +40511 +21470 +50327 +57550 +95796 +33653 +-15312 +14272 +-28642 +22471 +52344 +7638 +35886 +-12305 +59842 +129392 +46172 +58403 +-2229 +41413 +57640 +-2925 +-1983 +55910 +14231 +22922 +-2676 +27255 +80277 +102888 +15420 +2145 +82097 +-621 +28380 +20300 +1689 +26817 +22818 +91108 +62493 +-3171 +46677 +51572 +42910 +54941 +16908 +57651 +-30161 +44869 +75883 +3956 +67916 +42280 +-12634 +-41844 +29975 +12446 +12712 +23924 +108314 +26553 +45969 +29027 +32997 +-35701 +41281 +-24858 +36682 +33619 +35963 +54555 +8643 +-25347 +18223 +39709 +17830 +23247 +37196 +-60152 +60511 +49794 +4466 +71240 +59741 +26145 +13581 +58197 +7443 +-9232 +34873 +172279 +-15933 +19749 +79934 +61066 +17801 +-11515 +6104 +61761 +16344 +23933 +3470 +29377 +35022 +58315 +73744 +-6352 +60532 +75146 +6577 +39116 +27934 +13114 +6854 +79624 +57640 +36061 +30214 +3147 +36662 +23652 +67969 +45998 +-7684 +57638 +92167 +21365 +48035 +51093 +72702 +4111 +42796 +59688 +15700 +-9075 +46463 +20261 +37957 +65468 +38345 +4616 +37201 +32957 +65843 +21429 +23300 +30335 +33902 +28546 +55029 +63139 +58667 +11147 +49774 +21792 +-6577 +20426 +13358 +-10377 +41856 +22638 +-15044 +22154 +21202 +29285 +14920 +70268 +49004 +36057 +35922 +7662 +95797 +44541 +128351 +61409 +75415 +33440 +26269 +60220 +18593 +40439 +80349 +45663 +51070 +97188 +10742 +3333 +25940 +589 +26283 +37477 +-53002 +38277 +-16493 +58939 +81615 +49536 +27457 +78190 +-1524 +26332 +39334 +-15157 +16158 +45704 +91030 +59972 +115590 +92875 +60062 +20447 +-15438 +27018 +16312 +25897 +30027 +88707 +78190 +738 +29892 +71557 +78200 +95314 +35366 +14632 +15128 +59521 +42055 +30101 +56309 +13169 +38929 +65316 +80959 +61438 +54665 +-6900 +-16183 +27888 +86429 +40086 +72085 +64582 +-12624 +7387 +88887 +28664 +36747 +7987 +-5435 +32461 +63321 +68810 +21492 +20460 +20444 +3825 +61350 +40695 +82610 +67252 +21285 +21535 +71988 +74731 +5209 +54473 +74409 +47337 +39981 +48316 +36317 +167 +74766 +25020 +6748 +44725 +77789 +75620 +2737 +7458 +14490 +67120 +75751 +68428 +39096 +34101 +6382 +45316 +45732 +-28518 +17878 +71672 +74477 +41344 +118400 diff --git a/geval b/geval new file mode 100755 index 0000000..b68b316 Binary files /dev/null and b/geval differ diff --git a/script.py b/script.py new file mode 100644 index 0000000..2bd5fb1 --- /dev/null +++ b/script.py @@ -0,0 +1,34 @@ +from sklearn.linear_model import LinearRegression +import pandas as pd +import numpy as np + + +def get_model(): + df = pd.read_csv('./train/train.tsv', sep='\t', + names=["price", "mileage", "year", "brand", "engine_type", "engine_capacity"]) + X = df.loc[:, df.columns != 'price'] + y = df['price'] + + X = X.drop(["brand"], axis=1) + X = pd.get_dummies(X, columns= ["engine_type"], drop_first=True) + regr = LinearRegression() + return regr.fit(X, y) + + +def predict_and_write(path, model): + with open(f'{path}out.tsv', 'w') as out: + df_dev = pd.read_csv(f'{path}in.tsv', sep='\t', + names=["mileage", "year", "brand", "engine_type", "engine_capacity"]) + df_dev = df_dev.drop(["brand"], axis=1) + df_dev = pd.get_dummies(df_dev, columns= ["engine_type"], drop_first=True) + predictions = model.predict(df_dev).astype(int) + for prediction in predictions: + out.write(f"{prediction}\n") + +def main(): + model = get_model() + predict_and_write('./dev-0/', model) + predict_and_write('./test-A/', model) + +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..805a029 --- /dev/null +++ b/test-A/out.tsv @@ -0,0 +1,1000 @@ +24338 +23636 +12031 +-8466 +-5934 +20841 +40507 +19934 +118060 +47491 +-29400 +44459 +-7569 +31054 +-24708 +-7106 +44810 +66623 +35440 +15074 +60292 +17884 +-4466 +45296 +5512 +23519 +38354 +34714 +73998 +26121 +41602 +21888 +23913 +9703 +71084 +13765 +54219 +46452 +70729 +35286 +8809 +50416 +37213 +67971 +66905 +33229 +37063 +8839 +28005 +43568 +40768 +87297 +13717 +46397 +-4721 +30527 +66617 +33304 +72782 +95796 +21198 +79060 +63621 +26559 +61445 +69380 +-4746 +-1787 +43345 +78191 +49856 +94701 +28241 +76334 +47585 +19729 +22734 +16506 +84655 +31706 +15660 +45665 +64834 +44009 +39790 +76360 +84675 +16077 +34719 +46859 +13163 +58727 +75533 +47485 +18759 +75412 +20900 +7913 +63792 +40225 +74765 +56493 +7247 +26164 +33155 +68926 +54324 +4443 +43452 +19256 +26964 +-1081 +58698 +17473 +6234 +79371 +659 +74765 +-10555 +45105 +22711 +12020 +34413 +-2628 +13439 +16990 +29604 +2150 +61609 +44473 +23043 +15919 +35850 +7758 +111938 +75862 +29329 +45912 +52236 +31823 +35865 +29845 +43872 +-22222 +34198 +24004 +122036 +43360 +33646 +10924 +58680 +73369 +73874 +29852 +-7010 +117806 +45834 +28077 +41003 +24529 +21886 +18972 +56747 +-9651 +62635 +43266 +27158 +65702 +44593 +62723 +61323 +812 +25276 +55231 +59083 +15027 +34693 +60889 +82751 +62992 +45778 +51773 +25020 +96207 +53305 +71214 +36142 +39022 +94182 +23356 +26513 +10380 +3619 +17915 +15322 +10559 +56374 +44914 +11091 +41519 +96711 +27820 +20048 +57259 +77378 +65732 +20836 +8726 +36997 +18301 +25917 +-16995 +23288 +42642 +33126 +1395 +56347 +27731 +38597 +13843 +26416 +14305 +70816 +7949 +-7943 +5483 +-14002 +57488 +15254 +50445 +-32000 +1177 +53417 +61847 +43556 +6060 +46346 +23690 +59563 +52549 +-25492 +-914 +62854 +-10929 +20720 +29263 +51646 +120427 +44864 +38779 +20120 +41133 +70188 +57531 +59964 +72672 +19059 +38221 +78191 +90085 +27264 +85935 +69852 +1633 +57164 +30900 +28266 +44424 +11221 +66536 +26911 +8214 +39049 +71087 +-1252 +5378 +14293 +20038 +81443 +47532 +43352 +17807 +54166 +45615 +34033 +39302 +58381 +78191 +2555 +42995 +35034 +40053 +35177 +23758 +47450 +12738 +48487 +46381 +26801 +44427 +87240 +34137 +111578 +71477 +94455 +59843 +40783 +4103 +81519 +28908 +36455 +-6220 +56932 +51615 +13444 +64058 +24162 +-11697 +37899 +44622 +72249 +41108 +91774 +19084 +16666 +89543 +32757 +22099 +50238 +11581 +-38074 +4114 +53505 +69604 +58043 +34863 +26448 +-8552 +71093 +64004 +59263 +45548 +39558 +123451 +78189 +11801 +12682 +23770 +89602 +39837 +62201 +57185 +78503 +4026 +41396 +26295 +43834 +12380 +37636 +49057 +62440 +9836 +13521 +27138 +-7103 +38646 +65223 +36439 +33021 +56997 +56682 +130045 +27348 +23465 +24732 +44328 +56810 +61066 +-1443 +15037 +81615 +21559 +43141 +39319 +25381 +25186 +28759 +7047 +679 +557 +1291 +33115 +49960 +19093 +32671 +42889 +37265 +57953 +59560 +33177 +77337 +-6279 +46874 +50234 +20865 +-5045 +30952 +7319 +19817 +42602 +52465 +53270 +63319 +68019 +59456 +48347 +1434 +69964 +80157 +23539 +53710 +29661 +67916 +7625 +56401 +30379 +35688 +61206 +95022 +41640 +34892 +14653 +61066 +-5382 +7971 +31488 +31443 +91657 +61096 +25709 +95314 +71861 +23992 +-11226 +20645 +58357 +18266 +30781 +46017 +41359 +-26502 +22964 +-31675 +26270 +13847 +66370 +-10329 +25177 +99505 +26066 +20614 +3288 +23466 +15988 +34790 +4671 +40289 +53221 +-18605 +-35559 +46108 +10568 +76580 +35783 +56951 +-5383 +51368 +42873 +15440 +51349 +205 +75558 +125863 +81546 +8738 +93697 +38411 +52300 +46482 +44112 +-18178 +29641 +25451 +20370 +57087 +35440 +29735 +65332 +75730 +50526 +30766 +75194 +8169 +58053 +4318 +19059 +57302 +37749 +-51507 +51651 +68849 +-13340 +83837 +58070 +44021 +131163 +26281 +94701 +17798 +53878 +67497 +40325 +40257 +23580 +105587 +-13684 +7325 +-13404 +-5195 +35906 +17558 +48236 +-32845 +51111 +34132 +28165 +12439 +95160 +79773 +59645 +54649 +43377 +24880 +78191 +52040 +3497 +32556 +31614 +118301 +56876 +40983 +61646 +39895 +95141 +34547 +75685 +50715 +40439 +66487 +24362 +-21612 +29137 +-19144 +12243 +91201 +71416 +68838 +13875 +49983 +74078 +83498 +52782 +7703 +47307 +90688 +25104 +93122 +58461 +-3788 +85531 +11729 +6339 +48620 +38978 +-8148 +104065 +26480 +29515 +91701 +-8524 +124339 +4644 +80122 +52072 +173947 +-14134 +-2644 +22160 +31609 +49600 +29106 +10785 +513 +317 +40199 +11711 +31201 +33574 +58613 +5795 +59834 +51585 +54315 +91050 +-3596 +57071 +8859 +11979 +-10134 +20718 +59419 +29537 +24023 +94577 +10491 +42477 +16881 +-24941 +37137 +75419 +35956 +-9270 +64236 +32807 +57611 +52176 +55610 +33194 +54365 +33780 +89099 +30752 +60564 +41084 +33266 +112175 +24217 +25401 +23956 +-15263 +112893 +6015 +63975 +64960 +50504 +104751 +-14958 +81614 +84794 +8517 +83834 +897 +56353 +12390 +-67291 +2531 +16864 +40691 +144447 +40525 +-3869 +62373 +-12219 +-9878 +38969 +39104 +77336 +73150 +54255 +30978 +30880 +17632 +79891 +19055 +-10312 +43813 +1631 +82299 +37403 +4826 +14027 +23524 +5337 +24947 +34347 +-15733 +1977 +10024 +1715 +77497 +49516 +4927 +81615 +4567 +-34245 +44114 +63362 +76294 +68223 +53233 +3458 +32336 +23859 +89510 +33060 +26912 +54190 +74766 +1469 +11639 +27126 +81269 +90481 +15578 +95313 +-1410 +71159 +91294 +65060 +1028 +33347 +97726 +28169 +70042 +69698 +5978 +36109 +53918 +39210 +36849 +38472 +63791 +31729 +78190 +37862 +29998 +17602 +7337 +52139 +14434 +29705 +35996 +-1650 +36152 +9037 +75066 +64390 +57376 +27265 +85009 +9984 +55248 +70433 +75343 +-39110 +40858 +95797 +-555 +48385 +57068 +123708 +41219 +4630 +1880 +67916 +23401 +14414 +84348 +28732 +22013 +-1439 +64354 +57003 +121692 +47743 +14283 +35830 +44480 +50372 +64254 +-13481 +20432 +43559 +51501 +20817 +25945 +8494 +107342 +18104 +63157 +-3715 +76886 +23123 +30271 +57322 +3508 +45528 +-14220 +43068 +71413 +25166 +109760 +34535 +42980 +28614 +3077 +82097 +26040 +34896 +46813 +2004 +2598 +60398 +3479 +19227 +116044 +43510 +36795 +7078 +10024 +35612 +-32965 +45883 +68866 +12493 +67916 +41588 +47555 +10194 +16170 +21568 +22483 +63316 +27544 +-952 +22382 +33931 +24679 +28955 +44437 +19128 +47261 +38391 +96997 +19031 +35629 +95314 +-24376 +30145 +58471 +75146 +80916 +19165 +20407 +14021 +22502 +21824 +-15673 +22565 +36381 +64066 +30684 +66064 +33613 +22382 +60349 +3069 +5812 +32773 +16142 +-4649 +82570 +10272 +40738 +6542 +-20058 +-15040 +23524 +-9202 +27419 +94117 +42565 +27442 +4355 +67916 +5386 +67824 +13269 +30564 +29549 +19948 +27304 +61133 +91533 +21733 +70311 +98145 +21721 +76235 +34571 +1557 +-2278 +87474 +53534 +39148 +26992 +31276 +-21152 +11914 +12624 +27776 +8182 +-31691 +37212 +28997 +77269 +10490 +31905 +74416 +37558 +25803 +56089 +-24364 +4307 +12791 +64762 +32973 +7422 +40755 +-4393 +67916 +-23483 +36283 +44236 +-5894 +68952 +56243 +-63 +45750 +28248 +3669 +28636 +67186 +78670 +-5626 +58029 +7462 +-13764 +37140 +26895 +15112 +5410 +61066 +36564 +13118 +67670 +114735 +81587 +46838 +37891 +43357 +31632 +124958 +16897 +12041 +42452 +52092 +-37660 +43048 +36750 +-13866 +53593 +9431 +979 +26374 +4939 +15509 +81031 +83501 +23987 +12717 +68064 +66655 +30443 +150111 +2683 +72207 +58585 +47060 +87273