From afc0105d5e583c39a835a147bc857417e15b4eb8 Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Sat, 25 Apr 2026 16:25:54 +0100 Subject: [PATCH] PART 1F --- Q1.ipynb | 872 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 871 insertions(+), 1 deletion(-) diff --git a/Q1.ipynb b/Q1.ipynb index 6d4510a..ea73877 100644 --- a/Q1.ipynb +++ b/Q1.ipynb @@ -2058,13 +2058,883 @@ ], "id": "eaefa3aed2214793" }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "## Part F", + "id": "3c89e2f8ae31de3b" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-25T15:14:41.668654900Z", + "start_time": "2026-04-25T15:14:41.650113100Z" + } + }, + "cell_type": "code", + "source": "features_to_test = ['Reviews', 'Size in bytes', 'Numeric Installs']", + "id": "ab09192a122e6e8f", + "outputs": [], + "execution_count": 404 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-25T15:15:26.186132400Z", + "start_time": "2026-04-25T15:15:26.176807100Z" + } + }, + "cell_type": "code", + "source": [ + "for feature in features_to_test:\n", + " X_single = df_encoded[[feature]]" + ], + "id": "3f65e25b63cc8e93", + "outputs": [], + "execution_count": 407 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-25T15:15:37.813266600Z", + "start_time": "2026-04-25T15:15:37.797080500Z" + } + }, + "cell_type": "code", + "source": "X_train_s, X_test_s, y_train_s, y_test_s = train_test_split(X_single, y, test_size=0.3, random_state=101)", + "id": "213bcc196f94054d", + "outputs": [], + "execution_count": 408 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-25T15:15:59.633576900Z", + "start_time": "2026-04-25T15:15:59.612227200Z" + } + }, + "cell_type": "code", + "source": [ + "simple_model = LinearRegression()\n", + "simple_model.fit(X_train_s, y_train_s)" + ], + "id": "75e6c5289568ef2f", + "outputs": [ + { + "data": { + "text/plain": [ + "LinearRegression()" + ], + "text/html": [ + "
LinearRegression()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ] + }, + "execution_count": 409, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 409 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-25T15:16:10.648492700Z", + "start_time": "2026-04-25T15:16:10.630533500Z" + } + }, + "cell_type": "code", + "source": [ + "y_pred_s = simple_model.predict(X_test_s)\n", + "rmse = np.sqrt(mean_squared_error(y_test_s, y_pred_s))" + ], + "id": "983db24d45054c97", + "outputs": [], + "execution_count": 410 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-25T15:16:25.585898300Z", + "start_time": "2026-04-25T15:16:25.549110800Z" + } + }, + "cell_type": "code", + "source": "print(f\"RMSE using ONLY '{feature}': {rmse}\")", + "id": "4cb7c407238e67c1", + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "RMSE using ONLY 'Numeric Installs': 0.4179032096419041\n" + ] + } + ], + "execution_count": 411 + }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": "", - "id": "8e3d435421cb39d" + "id": "79c525159dd03465" } ], "metadata": {