noshot 0.3.8__py3-none-any.whl → 0.3.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "44e9a29a-54f1-4757-b4e7-4f5e3370de5e",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import numpy as np\n",
12
+ "from sklearn.model_selection import train_test_split\n",
13
+ "from sklearn.decomposition import PCA\n",
14
+ "from sklearn.linear_model import LinearRegression\n",
15
+ "from sklearn.metrics import mean_squared_error\n",
16
+ "\n",
17
+ "# Load the dataset\n",
18
+ "data = pd.read_csv('/mnt/data/airfoil_self_noise.dat', sep='\\t', header=None)\n",
19
+ "\n",
20
+ "# Assuming the last column is the target variable\n",
21
+ "y = data.iloc[:, -1]\n",
22
+ "X = data.iloc[:, :-1]\n",
23
+ "\n",
24
+ "# Split into training and testing sets\n",
25
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
26
+ "\n",
27
+ "# Linear Regression on original dataset\n",
28
+ "lr = LinearRegression()\n",
29
+ "lr.fit(X_train, y_train)\n",
30
+ "y_pred = lr.predict(X_test)\n",
31
+ "mse_original = mean_squared_error(y_test, y_pred)\n",
32
+ "print(f'MSE on original dataset: {mse_original}')\n",
33
+ "\n",
34
+ "# Applying PCA (reducing to 2 principal components for simplicity)\n",
35
+ "pca = PCA(n_components=2)\n",
36
+ "X_train_pca = pca.fit_transform(X_train)\n",
37
+ "X_test_pca = pca.transform(X_test)\n",
38
+ "\n",
39
+ "# Linear Regression on PCA-reduced dataset\n",
40
+ "lr_pca = LinearRegression()\n",
41
+ "lr_pca.fit(X_train_pca, y_train)\n",
42
+ "y_pred_pca = lr_pca.predict(X_test_pca)\n",
43
+ "mse_pca = mean_squared_error(y_test, y_pred_pca)\n",
44
+ "print(f'MSE on PCA-reduced dataset: {mse_pca}')\n"
45
+ ]
46
+ }
47
+ ],
48
+ "metadata": {
49
+ "kernelspec": {
50
+ "display_name": "Python 3 (ipykernel)",
51
+ "language": "python",
52
+ "name": "python3"
53
+ },
54
+ "language_info": {
55
+ "codemirror_mode": {
56
+ "name": "ipython",
57
+ "version": 3
58
+ },
59
+ "file_extension": ".py",
60
+ "mimetype": "text/x-python",
61
+ "name": "python",
62
+ "nbconvert_exporter": "python",
63
+ "pygments_lexer": "ipython3",
64
+ "version": "3.12.4"
65
+ }
66
+ },
67
+ "nbformat": 4,
68
+ "nbformat_minor": 5
69
+ }