Skip to content

Commit 52673c4

Browse files
Created using Colab
1 parent 6c04228 commit 52673c4

File tree

1 file changed

+83
-3
lines changed

1 file changed

+83
-3
lines changed

Tugas_EDA_week_8.ipynb

+83-3
Original file line numberDiff line numberDiff line change
@@ -3944,12 +3944,12 @@
39443944
"model.fit(X_train, y_train)"
39453945
],
39463946
"metadata": {
3947-
"id": "X3N9d8Q06j92",
3948-
"outputId": "d7ea9be2-112f-4928-cc61-cf9caa9ebec5",
39493947
"colab": {
39503948
"base_uri": "https://localhost:8080/",
39513949
"height": 80
3952-
}
3950+
},
3951+
"id": "X3N9d8Q06j92",
3952+
"outputId": "d7ea9be2-112f-4928-cc61-cf9caa9ebec5"
39533953
},
39543954
"execution_count": 34,
39553955
"outputs": [
@@ -4371,6 +4371,86 @@
43714371
"execution_count": 34
43724372
}
43734373
]
4374+
},
4375+
{
4376+
"cell_type": "markdown",
4377+
"source": [
4378+
"### **3. Evaluasi Model**\n",
4379+
"\n"
4380+
],
4381+
"metadata": {
4382+
"id": "YTlTotho7cvw"
4383+
}
4384+
},
4385+
{
4386+
"cell_type": "markdown",
4387+
"source": [
4388+
"**Lakukan prediksi pada data testing:**\n"
4389+
],
4390+
"metadata": {
4391+
"id": "5xBqbCvU7kGy"
4392+
}
4393+
},
4394+
{
4395+
"source": [
4396+
"y_pred = model.predict(X_test)"
4397+
],
4398+
"cell_type": "code",
4399+
"metadata": {
4400+
"id": "C6Amb2vh7ifF"
4401+
},
4402+
"execution_count": 35,
4403+
"outputs": []
4404+
},
4405+
{
4406+
"cell_type": "markdown",
4407+
"source": [
4408+
"**Hitung metrik evaluasi:**\n"
4409+
],
4410+
"metadata": {
4411+
"id": "nCU0Wit-7oAC"
4412+
}
4413+
},
4414+
{
4415+
"source": [
4416+
"mse = mean_squared_error(y_test, y_pred)\n",
4417+
"r2 = r2_score(y_test, y_pred)\n",
4418+
"\n",
4419+
"print(f\"Mean Squared Error (MSE): {mse}\")\n",
4420+
"print(f\"R-squared (R2): {r2}\")"
4421+
],
4422+
"cell_type": "code",
4423+
"metadata": {
4424+
"id": "bElQJX_27p17",
4425+
"outputId": "d98974f1-e7c0-4e8d-c053-e523b9de2e08",
4426+
"colab": {
4427+
"base_uri": "https://localhost:8080/"
4428+
}
4429+
},
4430+
"execution_count": 36,
4431+
"outputs": [
4432+
{
4433+
"output_type": "stream",
4434+
"name": "stdout",
4435+
"text": [
4436+
"Mean Squared Error (MSE): 3560172.059583262\n",
4437+
"R-squared (R2): 0.7515297801671946\n"
4438+
]
4439+
}
4440+
]
4441+
},
4442+
{
4443+
"cell_type": "markdown",
4444+
"source": [
4445+
"**Alasan Memilih Linear Regression:**\n",
4446+
"\n",
4447+
"* **Sederhana dan mudah diinterpretasi**: Linear Regression adalah algoritma yang relatif sederhana dan mudah dipahami, cocok untuk implementasi awal.\n",
4448+
"* **Data memiliki hubungan linear**: Dari EDA, terlihat bahwa beberapa fitur memiliki korelasi linear dengan harga, sehingga Linear Regression bisa menjadi pilihan yang baik.\n",
4449+
"* **Performa yang cukup baik untuk data ini**: Linear Regression seringkali memberikan performa yang cukup baik untuk kasus prediksi harga, terutama jika data memiliki hubungan linear."
4450+
],
4451+
"metadata": {
4452+
"id": "bD78h31s7z3O"
4453+
}
43744454
}
43754455
]
43764456
}

0 commit comments

Comments
 (0)