我在這裏發佈是因爲我無法在其他地方找到任何解決方案。基本上我們在學校學習使用python進行線性迴歸,教授希望我們根據csv表來估計三明治中每種成分的價格以及每種三明治的固定利潤。到目前爲止,我們只是混淆了一個X變量和一個Y變量,所以我很困惑我應該在這裏做什麼?謝謝。這裏是表格:使用線性迴歸估算價格
tomato,lettuce,cheese,pickles,palmetto,burger,corn,ham,price
0.05,1,0.05,0,0.05,0.2,0.05,0,18.4
0.05,0,0.05,0.05,0,0.2,0.05,0.05,16.15
0.05,1,0.05,0,0.05,0.4,0,0,22.15
0.05,1,0.05,0,0.05,0.2,0.05,0.05,19.4
0.05,1,0,0,0,0.2,0.05,0.05,18.4
0,0,0.05,0,0,0,0.05,0.05,11.75
0.05,1,0,0,0,0.2,0,0.05,18.15
0.05,1,0.05,0.05,0.05,0.2,0.05,0,18.65
0,0,0.05,0,0,0.2,0.05,0.05,15.75
0.05,1,0.05,0,0.05,0,0.05,0.05,15.4
0.05,1,0,0,0,0.2,0,0,17.15
0.05,1,0,0,0.05,0.2,0.05,0.05,18.9
0,1,0.05,0,0,0.2,0.05,0.05,18.75
你在做原始python或統計軟件包嗎? –
我可以使用numpy –
如果可以,我建議使用熊貓。它幾乎將numpy數組包裝成可行的數據框。 從那裏,你只需要應用多個線性迴歸。如果你已經編寫了一個迴歸工具,那麼你肯定可以擴展它來適應多個變量。 當我第一次開始學習Python(開發一個應用的計量經濟學模型)時,我做了這樣的事情,既然這是一個重要的學習經歷,我不能真正分享代碼,但我可以建議你想要的軟件包是:Sci-kit Learn/OLS統計模型;用於處理數據的大熊貓。 –