{"id":98,"date":"2025-09-24T23:09:00","date_gmt":"2025-09-24T21:09:00","guid":{"rendered":"http:\/\/python-ai.pl\/?p=98"},"modified":"2025-09-24T23:09:00","modified_gmt":"2025-09-24T21:09:00","slug":"%f0%9f%a4%96-machine-learning-predykcja-pensji","status":"publish","type":"post","link":"https:\/\/python-ai.pl\/?p=98","title":{"rendered":"\ud83e\udd16 Machine Learning &#8211; Predykcja Pensji"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">Przejdziemy do Machine Learning &#8211; nauczymy komputery przewidywa\u0107 pensje na podstawie wieku, do\u015bwiadczenia i innych cech. Poznamy Linear Regression i Random Forest.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Algorytmy ML:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Regresja liniowa<\/li>\n\n\n\n<li>Random Forest<\/li>\n\n\n\n<li>Przygotowanie danych<\/li>\n\n\n\n<li>Ewaluacja modeli<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Wyniki modeli Machine Learning:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"255\" src=\"http:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-4.png\" alt=\"\" class=\"wp-image-99\" srcset=\"https:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-4.png 814w, https:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-4-300x94.png 300w, https:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-4-768x241.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"460\" src=\"http:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-5.png\" alt=\"\" class=\"wp-image-100\" srcset=\"https:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-5.png 814w, https:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-5-300x170.png 300w, https:\/\/python-ai.pl\/wp-content\/uploads\/2025\/09\/image-5-768x434.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Kod Python &#8211; Machine Learning z scikit-learn:<\/strong><\/h4>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>from sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.metrics import r2_score, mean_squared_error\nimport numpy as np\n\n# Przygotowanie danych\nX = df[[&#39;wiek&#39;, &#39;doswiadczenie&#39;]]  # Features\ny = df[&#39;pensja&#39;]                   # Target\n\n# Podzia\u0142 na train\/test\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, random_state=42\n)\n\n# Linear Regression\nlr_model = LinearRegression()\nlr_model.fit(X_train, y_train)\nlr_pred = lr_model.predict(X_test)\nlr_r2 = r2_score(y_test, lr_pred)\nlr_rmse = np.sqrt(mean_squared_error(y_test, lr_pred))\n\nprint(f&quot;Linear Regression - R\u00b2: {lr_r2:.3f}, RMSE: {lr_rmse:.0f}&quot;)\n\n# Random Forest\nrf_model = RandomForestRegressor(n_estimators=100, random_state=42)\nrf_model.fit(X_train, y_train)\nrf_pred = rf_model.predict(X_test)\nrf_r2 = r2_score(y_test, rf_pred)\nrf_rmse = np.sqrt(mean_squared_error(y_test, rf_pred))\n\nprint(f&quot;Random Forest - R\u00b2: {rf_r2:.3f}, RMSE: {rf_rmse:.0f}&quot;)\n\n# Por\u00f3wnanie modeli\nmodels = [&#39;Linear Regression&#39;, &#39;Random Forest&#39;]\nr2_scores = [lr_r2, rf_r2]\nrmse_scores = [lr_rmse, rf_rmse]<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Przejdziemy do Machine Learning &#8211; nauczymy komputery przewidywa\u0107 pensje na podstawie wieku, do\u015bwiadczenia i innych cech. Poznamy Linear Regression i Random Forest. Algorytmy ML: Wyniki modeli Machine Learning: Kod Python &#8211; Machine Learning z scikit-learn:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28,4],"tags":[29,6],"class_list":["post-98","post","type-post","status-publish","format-standard","hentry","category-ai","category-kurs","tag-ai","tag-kurs"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/python-ai.pl\/index.php?rest_route=\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/python-ai.pl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/python-ai.pl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/python-ai.pl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/python-ai.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98"}],"version-history":[{"count":2,"href":"https:\/\/python-ai.pl\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/python-ai.pl\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions\/102"}],"wp:attachment":[{"href":"https:\/\/python-ai.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/python-ai.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/python-ai.pl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}