mieszkania5/model_regresji_liniowej.ipynb

58 KiB
Raw Blame History

import pandas as pd

Wczytanie datasetów

train_dataset = pd.read_csv("./train.tsv", sep = "\t", header=None)
test_dataset = pd.read_csv("./in.tsv", sep = "\t", header=None)

Data exploration

train_dataset.head(1)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
0 309000.0 do zamieszkania 390 zł spółdzielcze własnościowe 7113 https://www.otodom.pl/oferta/niezalezny-uklad-... 2 NaN 43.44 wtórny 4.0 blok NaN NaN Niezależny Układ W Nowoczesnym Wydaniu 1 NaN gazowe plastikowe NaN NaN NaN cegła Polecamy na sprzedaż dwupokojowe mieszkanie p... NaN telewizja kablowa, internet, meble, piwnica, g...
train_dataset[4].value_counts()
4
7000    42
6750    42
7100    37
7500    29
7800    20
        ..
9674     1
7565     1
8352     1
7511     1
5077     1
Name: count, Length: 1452, dtype: int64
pd.set_option("display.max_columns", None)
train_dataset.describe()
0 4 7 10 12 13 16 19 20 24
count 2.547000e+03 2547.000000 0.0 2316.000000 0.0 0.0 0.0 1768.000000 0.0 0.0
mean 4.210372e+05 7201.618767 NaN 5.015112 NaN NaN NaN 2011.436086 NaN NaN
std 2.663796e+05 1737.605837 NaN 2.797598 NaN NaN NaN 610.162290 NaN NaN
min 4.500000e+04 36.000000 NaN 1.000000 NaN NaN NaN 50.000000 NaN NaN
25% 2.990000e+05 6200.000000 NaN 4.000000 NaN NaN NaN 1976.000000 NaN NaN
50% 3.590000e+05 7000.000000 NaN 4.000000 NaN NaN NaN 2011.000000 NaN NaN
75% 4.570000e+05 7868.000000 NaN 5.000000 NaN NaN NaN 2019.000000 NaN NaN
max 6.000000e+06 23005.000000 NaN 21.000000 NaN NaN NaN 20120.000000 NaN NaN
train_dataset[3].value_counts()
3
pełna własność               1515
spółdzielcze własnościowe     158
spółdzielcze wł. z KW         131
udział                         15
Name: count, dtype: int64

Odfiltrowanie wartości liczbowych

filtered= train_dataset[[0,8,15,2]]
filtered.head(1)
0 8 15 2
0 309000.0 43.44 1 390 zł
filtered[15].value_counts()
15
1           569
parter      452
2           419
4           357
3           321
5           117
6            51
7            42
8            32
10           29
> 10         24
9            21
suterena      5
poddasze      3
Name: count, dtype: int64

Zamiana wsyztskich wartości na wartosći liczbowe, odfiltrowanie wartości trudnych do zamiany oraz usunięcie brakujących wartości

filtered[15] = filtered[15].replace({"parter": 0})
string = ["> 10", "suterena", "poddasze"]
filtered = filtered[~filtered[15].isin(string)]
filtered = filtered[~filtered[15].isna()]
C:\Users\s433445\AppData\Local\temp\ipykernel_7796\2098381410.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  filtered[15] = filtered[15].replace({"parter": 0})
filtered
0 8 15 2
0 309000.0 43.44 1 390 zł
1 314900.0 42.60 1 NaN
2 249000.0 44.30 2 300 zł
3 419000.0 88 1 490 zł
4 499000.0 77 7 850 zł
... ... ... ... ...
2541 383680.0 70.40 0 NaN
2542 507600.0 94 3 1 zł
2543 342400.0 53.50 4 NaN
2544 335000.0 55.25 4 280 zł
2545 260000.0 62 2 NaN

2410 rows × 4 columns

filtered[15].value_counts()
15
1     569
0     452
2     419
4     357
3     321
5     117
6      51
7      42
8      32
10     29
9      21
Name: count, dtype: int64
filtered[15] = filtered[15].apply(int)
filtered[8].value_counts()
8
38       59
48       40
50       35
53       28
43       26
         ..
33.79     1
42.60     1
47.82     1
53.09     1
55.25     1
Name: count, Length: 1084, dtype: int64
import numpy as np

def check_value(number):
    try:
        return float(number)
    except:
        return str(np.nan)
filtered
0 8 15 2
0 309000.0 43.44 1 390 zł
1 314900.0 42.60 1 NaN
2 249000.0 44.30 2 300 zł
3 419000.0 88.00 1 490 zł
4 499000.0 77.00 7 850 zł
... ... ... ... ...
2541 383680.0 70.40 0 NaN
2542 507600.0 94.00 3 1 zł
2543 342400.0 53.50 4 NaN
2544 335000.0 55.25 4 280 zł
2545 260000.0 62.00 2 NaN

2410 rows × 4 columns

filtered[8] = filtered[8].apply(check_value)
filtered = filtered[~filtered[8].isna()]
filtered = filtered[[0, 15, 8]]

Model

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
X = filtered.drop(0,axis=1)
y = filtered[[0]]

scaler = StandardScaler()
trans_data = scaler.fit_transform(X)

X_train, X_test, y_train, y_test = train_test_split(trans_data,y, test_size=0.33)
reg = LinearRegression()
reg.fit(X_train, y_train)
results = reg.predict(X_test)
import pickle

Zapis jako pkl

pickle.dump(reg, open("model.pkl", "wb"))
results
array([[ 593653.27660188],
       [ 347445.92747813],
       [ 405167.78785587],
       [ 536368.93860499],
       [ 285944.97361261],
       [ 424034.91112136],
       [ 272900.72398813],
       [ 475401.99674084],
       [ 314256.66427135],
       [ 499602.00468798],
       [ 319442.70363808],
       [ 345408.47997727],
       [ 324469.23238515],
       [ 443182.15703217],
       [ 250637.45215307],
       [ 209585.7569203 ],
       [ 270014.46501481],
       [ 347445.92747813],
       [ 200395.07888311],
       [ 341165.63081938],
       [ 358551.3301064 ],
       [ 335193.80097933],
       [ 614485.48015284],
       [ 426332.58063066],
       [ 683415.56543175],
       [ 568532.08996689],
       [ 269911.64274191],
       [ 330600.57284487],
       [ 340303.25136243],
       [ 203970.63870921],
       [ 443440.26815648],
       [ 343360.47805578],
       [1329699.64270264],
       [ 620229.65392608],
       [ 312930.52914428],
       [ 314256.66427135],
       [ 539430.38706659],
       [ 327534.90261501],
       [ 445735.82678165],
       [ 593552.5652131 ],
       [ 200904.96847936],
       [ 390845.64791458],
       [ 309151.43565651],
       [ 319541.30414273],
       [ 483778.54013134],
       [ 406679.66689186],
       [ 295877.4190811 ],
       [ 256561.03718286],
       [ 524622.47993419],
       [ 269861.28704753],
       [1478921.21612892],
       [ 350791.7203533 ],
       [ 479690.97982487],
       [ 550662.73437289],
       [ 289240.41079339],
       [ 672183.21812545],
       [ 655845.64220431],
       [ 538408.49698997],
       [ 354085.04664996],
       [ 656867.53228093],
       [1157759.4853077 ],
       [ 383569.69446848],
       [ 432510.05501651],
       [ 381147.19116528],
       [ 256561.03718286],
       [ 308387.6567042 ],
       [ 352934.10101118],
       [ 232562.45201327],
       [ 537896.4965096 ],
       [ 467438.85332607],
       [ 837615.42279484],
       [ 204992.52878583],
       [ 418853.09352288],
       [ 388803.97864547],
       [ 732128.26991297],
       [ 963910.65682254],
       [ 108998.18810747],
       [ 387528.19921279],
       [ 287196.63064015],
       [ 202443.0808046 ],
       [ 276045.09408575],
       [ 329040.44899862],
       [ 448619.97487084],
       [ 163632.36673436],
       [ 623091.79049426],
       [ 924084.38532806],
       [ 259674.95222298],
       [ 357253.53915271],
       [ 571597.76019675],
       [ 243287.02060745],
       [ 374508.07199344],
       [ 757196.98996944],
       [ 334171.91090272],
       [ 345839.66970574],
       [ 361741.83413015],
       [ 169886.43010385],
       [ 212419.5493151 ],
       [1100061.74733508],
       [ 809023.60949078],
       [ 465213.55103217],
       [ 409739.00446933],
       [ 375733.49573174],
       [ 668097.7687031 ],
       [ 992837.17023455],
       [ 824341.40621943],
       [ 791662.0326089 ],
       [ 405526.61036896],
       [ 262692.37764257],
       [ 609354.01824874],
       [ 652779.97197445],
       [ 249668.02865497],
       [ 420207.57282333],
       [ 612520.39986737],
       [ 336263.93586621],
       [ 435523.25866785],
       [ 336060.40220454],
       [ 599756.2728882 ],
       [ 308129.54557989],
       [ 304558.20752204],
       [ 426078.6912746 ],
       [ 316810.33402083],
       [ 328451.8595346 ],
       [ 427124.70375635],
       [ 998452.28844564],
       [ 700777.14231363],
       [ 249924.02889515],
       [ 281323.40130476],
       [ 349104.65182902],
       [ 737283.8542222 ],
       [ 108232.29827104],
       [ 638484.06532243],
       [ 630825.1669581 ],
       [ 256561.03718286],
       [ 652882.79424735],
       [ 274942.39325724],
       [ 415741.28936689],
       [ 348594.76223277],
       [ 339710.44013016],
       [ 262692.37764257],
       [ 396462.8770098 ],
       [ 336217.80194008],
       [ 208563.86684368],
       [ 431617.22050204],
       [ 429039.42834743],
       [ 641344.09100648],
       [ 194394.90486968],
       [ 451709.76750583],
       [ 236650.01231974],
       [ 422452.77575411],
       [ 475553.063824  ],
       [ 262692.37764257],
       [1148566.69638638],
       [ 512342.00926201],
       [ 294573.29547504],
       [ 306089.9871949 ],
       [ 279336.30949828],
       [ 355872.82656301],
       [ 348467.81755474],
       [ 496284.55598619],
       [ 431849.0983371 ],
       [ 317832.22409745],
       [ 685969.23518123],
       [ 293424.46072039],
       [ 334432.13291115],
       [ 747752.42257619],
       [ 268226.68510176],
       [ 366851.28451325],
       [ 448619.97487084],
       [ 499602.00468798],
       [ 353675.86844248],
       [ 336390.88054424],
       [ 341830.80926704],
       [ 501645.78484122],
       [ 298175.08859039],
       [ 116276.25243771],
       [ 379103.41101204],
       [ 228888.29168252],
       [ 635420.5059767 ],
       [ 330213.4061584 ],
       [ 348467.81755474],
       [ 286126.49575328],
       [ 385893.59726703],
       [ 195806.07251689],
       [ 505733.34514769],
       [ 479178.97934449],
       [ 518318.06087031],
       [ 379871.4117326 ],
       [ 319493.05933247],
       [ 192046.879666  ],
       [1035724.89019064],
       [ 539940.27666284],
       [ 297203.55420816],
       [ 351785.26625653],
       [ 336929.11431387],
       [ 316810.33402083],
       [ 390847.75879871],
       [ 640628.55686444],
       [ 512114.35319521],
       [ 937233.56810956],
       [ 312470.99524242],
       [ 426078.6912746 ],
       [ 294855.52900448],
       [ 387784.19945298],
       [ 390388.22489685],
       [ 367768.24143284],
       [ 409483.00422915],
       [ 247880.24874192],
       [ 229625.83734557],
       [ 287732.75352566],
       [ 231693.73990394],
       [1115379.54406373],
       [ 169582.1850534 ],
       [ 689800.79524752],
       [ 448033.49629095],
       [ 258604.8173361 ],
       [ 292811.74885124],
       [ 302768.31672486],
       [ 362457.3682722 ],
       [ 447527.82846296],
       [ 230291.01579323],
       [ 531259.48822189],
       [ 295877.4190811 ],
       [ 341828.69838291],
       [ 247880.24874192],
       [ 404478.48700308],
       [ 341830.80926704],
       [1492963.23342489],
       [ 463095.29277941],
       [ 202948.74863259],
       [ 257582.92725948],
       [ 403305.5298433 ],
       [ 499602.00468798],
       [ 625207.93786289],
       [ 449385.86470727],
       [ 370424.73345522],
       [ 651171.60331795],
       [ 369505.6656515 ],
       [ 534325.15845175],
       [ 442420.48896399],
       [ 310173.32573313],
       [ 688139.9600125 ],
       [ 305577.98671453],
       [ 325745.01181783],
       [ 369912.73297485],
       [ 475553.063824  ],
       [ 311195.21580974],
       [ 402005.62800549],
       [ 293424.46072039],
       [ 471979.61488203],
       [1004581.51802122],
       [ 791841.44386544],
       [ 312217.10588636],
       [ 691074.46379607],
       [ 511320.1191854 ],
       [ 257582.92725948],
       [ 476625.30959501],
       [ 529370.99692007],
       [ 241499.2406944 ],
       [ 258604.8173361 ],
       [ 567000.31029403],
       [ 915226.2965147 ],
       [ 692096.35387269],
       [ 425056.80119798],
       [ 527355.56094021],
       [ 533303.26837513],
       [ 206778.19781476],
       [ 346502.73726928],
       [ 464627.07245228],
       [ 294855.52900448],
       [ 344128.47877634],
       [ 433737.58963892],
       [ 607848.47186513],
       [ 217244.65528462],
       [ 186609.06182733],
       [ 423932.08884846],
       [ 550559.91209999],
       [ 286583.91877101],
       [ 374328.6607369 ],
       [ 330213.4061584 ],
       [ 250816.86340962],
       [ 323576.39787069],
       [ 334760.50036673],
       [ 264736.15779581],
       [ 377317.74198311],
       [ 174127.16837761],
       [ 351533.4877846 ],
       [ 363785.61428339],
       [ 786046.91439781],
       [ 505733.34514769],
       [ 448543.3858872 ],
       [ 346143.91475619],
       [ 266465.13847797],
       [1011549.00464863],
       [ 355104.82584245],
       [ 620334.5870831 ],
       [ 270856.94383489],
       [ 161997.76478859],
       [ 212651.42715015],
       [ 297409.19875396],
       [ 298457.32211984],
       [ 479690.97982487],
       [ 571188.58198928],
       [ 255539.14710624],
       [ 453648.61450204],
       [ 618573.04045931],
       [ 370424.73345522],
       [ 284439.427229  ],
       [ 396972.76660604],
       [ 286174.74056354],
       [1070448.04395441],
       [ 223371.77397608],
       [ 315788.44394421],
       [ 366085.39467681],
       [ 415303.76698603],
       [ 502667.67491784],
       [ 306597.76590702],
       [ 733456.51592417],
       [ 769963.22783273],
       [ 192379.46888983],
       [ 281686.44558609],
       [ 731412.73577093],
       [ 703586.8123033 ],
       [ 418496.38189392],
       [ 204581.23969423],
       [ 260648.59748933],
       [ 560367.52377458],
       [ 170269.37502206],
       [ 373488.29280095],
       [ 745734.87571221],
       [ 326513.01253839],
       [ 512342.00926201],
       [ 289496.41103358],
       [ 341828.69838291],
       [ 409739.00446933],
       [ 343542.00019645],
       [ 541113.23382262],
       [ 386635.36469833],
       [ 771751.00774578],
       [ 384208.63962688],
       [ 318090.33522176],
       [ 394421.20774069],
       [ 347445.92747813],
       [ 371444.51264772],
       [ 110223.61184576],
       [ 282730.34718372],
       [ 218778.54584161],
       [ 444462.1582331 ],
       [ 290439.60124243],
       [ 266263.71570042],
       [ 298505.5669301 ],
       [ 281607.74571832],
       [ 380891.19092509],
       [ 141677.561718  ],
       [ 351660.43246263],
       [ 258604.8173361 ],
       [ 386812.66507075],
       [ 411603.37336603],
       [ 255539.14710624],
       [ 373155.70357712],
       [ 275351.57146471],
       [ 450077.27644419],
       [ 361231.94453391],
       [ 338331.83842458],
       [ 553730.51548687],
       [ 419441.68298689],
       [ 549310.36595657],
       [ 220564.21487054],
       [ 524213.30172672],
       [ 342850.58845953],
       [ 279537.73227583],
       [ 245711.63479478],
       [ 493732.99712083],
       [ 281684.33470197],
       [ 288218.52071677],
       [ 646142.96368675],
       [ 450075.16556006],
       [ 348467.81755474],
       [ 335193.80097933],
       [ 653801.86205107],
       [ 421203.22961069],
       [ 486839.98859294],
       [ 743666.97315385],
       [1687753.14123477],
       [ 372466.40272433],
       [ 740627.53621325],
       [ 424034.91112136],
       [ 318420.81356146],
       [ 177928.27338639],
       [ 470754.19114374],
       [ 255539.14710624],
       [ 432641.22146279],
       [ 370424.73345522],
       [ 318854.11417407],
       [ 348623.10640616],
       [ 791662.0326089 ],
       [ 915226.2965147 ],
       [ 379998.35641063],
       [ 108998.18810747],
       [ 283111.18121781],
       [ 233098.57489877],
       [ 348467.81755474],
       [ 292428.80393303],
       [ 345863.79211087],
       [1648436.75933653],
       [ 331108.35155699],
       [ 380889.08004096],
       [ 403664.35235639],
       [1031131.66205617],
       [1244558.92618062],
       [ 271036.35509143],
       [ 694628.01210117],
       [ 486583.98835276],
       [ 486610.22164201],
       [ 311604.39401722],
       [ 647648.51007036],
       [ 344892.25772864],
       [ 286174.74056354],
       [ 158017.24852327],
       [ 170269.37502206],
       [ 330600.57284487],
       [ 354082.93576583],
       [ 915226.2965147 ],
       [ 333585.43232283],
       [ 385613.47462171],
       [ 436289.14850428],
       [ 380125.30108866],
       [ 118930.63357596],
       [ 370422.6225711 ],
       [ 305324.09735847],
       [ 454287.55966044],
       [ 449055.38636757],
       [1110784.20504514],
       [ 218546.66800656],
       [ 233584.34208989],
       [ 906545.50807375],
       [ 391178.23713841],
       [1062021.14486953],
       [ 616273.26006589],
       [ 312980.88483867],
       [ 231081.02803479],
       [ 212651.42715015],
       [ 231540.56193665],
       [ 272900.72398813],
       [ 479944.86918093],
       [ 292306.08102325],
       [ 474710.58500393],
       [ 341500.33092734],
       [ 351533.4877846 ],
       [ 365829.39443663],
       [ 361741.83413015],
       [ 260318.11914963],
       [ 255287.36863431],
       [ 605296.91299977],
       [ 363785.61428339],
       [ 483518.3181229 ],
       [ 538918.38658622],
       [ 289851.01177841],
       [ 233584.34208989],
       [ 731412.73577093],
       [ 196055.7401047 ],
       [ 294599.52876429],
       [ 278314.41942167],
       [ 461307.51286636],
       [ 380816.71282557],
       [ 258604.8173361 ],
       [ 329066.68228787],
       [ 521915.63221742],
       [ 379026.8220284 ],
       [ 222325.76149433],
       [ 448033.49629095],
       [ 631847.05703472],
       [ 492916.75159001],
       [ 369400.73249448],
       [ 232818.45225346],
       [ 815154.94995049],
       [ 842466.76205362],
       [ 142699.45179462],
       [ 415612.23380473],
       [ 932229.0508835 ],
       [ 231540.56193665],
       [ 539430.38706659],
       [ 377317.74198311],
       [ 362124.77904837],
       [ 339710.44013016],
       [ 279207.25393613],
       [ 456714.28473189],
       [ 303024.31696505],
       [ 195112.54989585],
       [ 403664.35235639],
       [ 260902.48684539],
       [ 322659.4409511 ],
       [ 308129.54557989],
       [ 377317.74198311],
       [ 623166.26859378],
       [ 349441.4628211 ],
       [ 563938.86183243],
       [ 381578.38089375],
       [ 534325.15845175],
       [ 208999.27834041],
       [ 205323.00712553],
       [ 292306.08102325],
       [ 374328.6607369 ],
       [ 551938.51380557],
       [ 508282.79312892],
       [ 374125.12707523],
       [ 424034.91112136],
       [ 294522.93978065],
       [ 426231.86924189],
       [ 345660.2584492 ],
       [ 530753.8203939 ],
       [ 388547.97840529],
       [ 368124.9530618 ],
       [ 609277.4292651 ],
       [ 328810.68204769],
       [ 455186.72682728],
       [ 445659.23779801],
       [ 315788.44394421],
       [ 180431.58744148],
       [ 311882.40577841],
       [ 305580.09759866],
       [ 269835.05375827],
       [ 250945.91897177],
       [ 234352.34281045],
       [ 532281.37829851],
       [ 301365.59261415],
       [ 731412.73577093],
       [ 335550.51260829],
       [ 397484.76708642],
       [ 387834.55514737],
       [ 335193.80097933],
       [ 234297.76534781],
       [ 162610.47665774],
       [ 298046.03302824],
       [ 449055.38636757],
       [ 350995.25401497],
       [ 273664.50294043],
       [ 262692.37764257],
       [ 373333.00394954],
       [ 605450.09096706],
       [ 416378.12364116],
       [ 511348.46335878],
       [ 108232.29827104],
       [ 325491.12246177],
       [ 368892.95378236],
       [ 164094.01152034],
       [ 439022.22951031],
       [ 837615.42279484],
       [ 245074.8005205 ],
       [ 232562.45201327],
       [ 538918.38658622],
       [ 694628.01210117],
       [ 298457.32211984],
       [ 319620.0040105 ],
       [ 269835.05375827],
       [ 388193.37766045],
       [ 755411.32094052],
       [ 196311.74034489],
       [ 437030.91593558],
       [ 329550.33859486],
       [ 358170.4960723 ],
       [ 321915.56263567],
       [ 264014.29100138],
       [ 403101.99618163],
       [ 456714.28473189],
       [ 234043.87599175],
       [ 333915.91066253],
       [ 293271.2827531 ],
       [ 604019.02268297],
       [ 414257.75450428],
       [ 283520.35942528],
       [ 682651.78647944],
       [ 319212.93668715],
       [ 349669.11888791],
       [ 338229.01615168],
       [ 255539.14710624],
       [ 224724.1423924 ],
       [ 838355.07934202],
       [ 787578.69407068],
       [ 475553.063824  ],
       [ 341828.69838291],
       [ 885612.59313402],
       [ 291028.19070644],
       [ 306601.98767528],
       [ 329066.68228787],
       [ 347445.92747813],
       [ 332690.48692424],
       [ 367818.59712723],
       [ 296899.30915772],
       [ 319366.11465444],
       [ 331209.06294576],
       [ 160006.45121387],
       [ 578494.99049289],
       [ 331106.24067286],
       [ 325491.12246177],
       [ 270064.8207092 ],
       [ 307930.23368647],
       [ 371444.51264772],
       [ 260648.59748933],
       [ 427787.77131988],
       [ 367615.06346555],
       [ 302514.4273688 ],
       [ 310429.32597331],
       [ 448545.49677132],
       [ 299067.92310486],
       [ 424034.91112136],
       [ 348467.81755474],
       [ 620794.12098496],
       [ 225822.62145267],
       [ 302258.42712862],
       [ 274686.39301705],
       [ 339710.44013016],
       [ 289393.58876068],
       [ 167461.81591652],
       [ 341325.14143904],
       [ 641805.73579247],
       [ 210607.64699692],
       [ 294676.11774794],
       [ 837615.42279484],
       [ 332128.13074948],
       [ 309409.54678082],
       [ 426205.63595263],
       [ 378591.41053167],
       [ 465213.55103217],
       [ 196412.45173366],
       [ 503919.33194538],
       [ 353933.9795668 ],
       [ 261670.48756595],
       [ 262692.37764257],
       [ 430164.14069695],
       [ 517985.47164648],
       [ 350559.84251824],
       [ 349003.94044025],
       [ 362354.5459993 ],
       [ 200904.96847936],
       [ 179103.34143029],
       [ 912928.6270054 ],
       [ 302232.19383936],
       [ 365829.39443663],
       [ 277725.82995765],
       [ 487349.87818919],
       [ 455186.72682728],
       [ 531259.48822189],
       [1997172.63515345],
       [ 542008.1792212 ],
       [ 250945.91897177],
       [ 370422.6225711 ],
       [ 740093.52421187],
       [ 304556.09663791],
       [ 325235.12222159],
       [ 274942.39325724],
       [ 117908.74349934],
       [ 488802.95799428],
       [ 209561.63451517],
       [ 121508.42573058],
       [ 356642.93816769],
       [ 298943.08931095],
       [ 235628.12224313],
       [ 445989.71613772],
       [ 445989.71613772],
       [ 535347.04852837],
       [ 193246.07011503],
       [ 286966.86368922],
       [ 373488.29280095],
       [ 383033.57158297],
       [ 203382.0492452 ],
       [ 212038.71528101],
       [ 320742.60547589],
       [ 765877.77841038],
       [ 161028.34129049],
       [ 344128.47877634],
       [ 423932.08884846],
       [ 354341.04689014],
       [ 261563.4435248 ],
       [ 400624.91541579],
       [ 456714.28473189],
       [ 225925.44372557],
       [ 267285.60577704],
       [ 476883.42071932],
       [ 461565.62399067],
       [ 347395.57178374],
       [ 240221.35037759],
       [ 387657.25477495],
       [ 442726.84489856],
       [ 529727.70854903],
       [ 833785.97361268],
       [1609505.43324064],
       [ 391103.7590389 ],
       [ 476117.53088289],
       [ 339710.44013016],
       [ 404708.25395401],
       [ 255156.20218803],
       [ 312217.10588636],
       [ 477393.31031557],
       [ 339710.44013016],
       [ 407695.2243161 ],
       [ 379103.41101204],
       [ 358170.4960723 ],
       [ 340325.26288343],
       [ 343616.47829596],
       [ 209894.223739  ],
       [ 350203.13088928],
       [ 292811.74885124],
       [ 373258.52585002],
       [ 255539.14710624],
       [ 454670.50457866],
       [ 344997.19088567],
       [ 212421.66019923],
       [ 224800.73137605],
       [ 390845.64791458],
       [ 398351.36831162],
       [ 620284.23138872],
       [ 652193.49339457],
       [ 241549.59638879],
       [ 329578.68276825],
       [ 657095.18834773],
       [ 579307.01425546],
       [ 438588.9288977 ],
       [ 543005.94689269],
       [ 345914.14780526],
       [ 273922.61406474],
       [ 335193.80097933],
       [ 288218.52071677],
       [ 117908.74349934],
       [ 572361.53914906],
       [ 541419.58975719],
       [ 280865.97828702],
       [ 289750.30038964],
       [ 264736.15779581],
       [ 655845.64220431],
       [ 263198.04547057],
       [ 569553.98004351],
       [ 291284.19094663],
       [ 119952.52365258],
       [ 787578.69407068],
       [ 682651.78647944],
       [1686731.25115815],
       [ 200904.96847936],
       [ 183059.73529048],
       [ 431949.80972587],
       [ 400445.50415925],
       [ 158960.43873212],
       [ 176400.71548177],
       [ 601721.35317367],
       [ 273922.61406474],
       [ 524876.36929025],
       [ 372311.11387292],
       [ 854543.69906412],
       [ 745708.64242296],
       [ 332128.13074948],
       [ 245227.97848779],
       [ 270014.46501481],
       [ 292811.74885124],
       [ 548185.65360705],
       [ 990793.39008132],
       [ 475553.063824  ],
       [ 305223.3859697 ],
       [ 346424.03740151],
       [ 654823.75212769],
       [ 206931.37578204],
       [ 661486.99370465],
       [ 250945.91897177],
       [ 258604.8173361 ],
       [ 316810.33402083],
       [ 661235.21523272],
       [ 259626.70741272],
       [ 671673.3285292 ],
       [ 356715.30538308],
       [ 472032.08146054],
       [ 717116.8291189 ],
       [ 303030.64961743],
       [ 358680.38566855],
       [ 361897.12298157],
       [ 258604.8173361 ],
       [ 345918.36957351],
       [ 300470.64721557],
       [ 508028.90377286],
       [ 383674.6276255 ],
       [ 426689.29225962],
       [ 712519.37921618],
       [ 511348.46335878],
       [ 345150.36885295],
       [2265236.1887889 ],
       [ 354341.04689014],
       [ 272082.36757318],
       [ 294855.52900448],
       [ 268176.32940738],
       [ 363785.61428339],
       [ 324957.1104604 ],
       [ 241243.24045421],
       [ 369300.0211057 ],
       [ 469555.0006947 ],
       [ 406167.66641148],
       [ 467180.74220176],
       [ 188245.77465722],
       [ 258604.8173361 ]])
from sklearn.metrics import r2_score
r2_score(y_test, results)
0.5878080999086976