|
28 | 28 | }, |
29 | 29 | { |
30 | 30 | "cell_type": "code", |
31 | | - "execution_count": 1, |
| 31 | + "execution_count": null, |
32 | 32 | "metadata": { |
33 | 33 | "ExecuteTime": { |
34 | 34 | "end_time": "2024-04-25T13:28:24.303873023Z", |
|
40 | 40 | "source": [ |
41 | 41 | "import numpy as np\n", |
42 | 42 | "import pandas as pd\n", |
43 | | - "from fknni import FaissImputer\n", |
| 43 | + "from fknni import FastKNNImputer\n", |
44 | 44 | "from sklearn.impute import KNNImputer" |
45 | 45 | ] |
46 | 46 | }, |
|
795 | 795 | }, |
796 | 796 | { |
797 | 797 | "cell_type": "code", |
798 | | - "execution_count": 4, |
| 798 | + "execution_count": null, |
799 | 799 | "metadata": { |
800 | 800 | "ExecuteTime": { |
801 | 801 | "end_time": "2024-04-25T13:28:24.316976982Z", |
|
822 | 822 | } |
823 | 823 | ], |
824 | 824 | "source": [ |
825 | | - "faiss_imputer = FaissImputer(n_neighbors=5, strategy=\"weighted\")\n", |
| 825 | + "faiss_imputer = FastKNNImputer(n_neighbors=5, strategy=\"weighted\")\n", |
826 | 826 | "\n", |
827 | 827 | "df_imputed_faiss = faiss_imputer.fit_transform(df_missing)\n", |
828 | 828 | "df_imputed_faiss" |
|
965 | 965 | }, |
966 | 966 | { |
967 | 967 | "cell_type": "code", |
968 | | - "execution_count": 10, |
| 968 | + "execution_count": null, |
969 | 969 | "metadata": { |
970 | 970 | "ExecuteTime": { |
971 | 971 | "end_time": "2024-04-25T13:29:06.633118482Z", |
|
998 | 998 | "X.values[np.unravel_index(missing_indices, X.shape)] = np.nan\n", |
999 | 999 | "\n", |
1000 | 1000 | "knn_imputer = KNNImputer(n_neighbors=5)\n", |
1001 | | - "faiss_imputer = FaissImputer(n_neighbors=5)\n", |
| 1001 | + "faiss_imputer = FastKNNImputer(n_neighbors=5)\n", |
1002 | 1002 | "\n", |
1003 | 1003 | "start_time = time.time()\n", |
1004 | 1004 | "knn_imputed = knn_imputer.fit_transform(X)\n", |
|
1009 | 1009 | "faiss_time = time.time() - start_time\n", |
1010 | 1010 | "\n", |
1011 | 1011 | "times = [knn_time, faiss_time]\n", |
1012 | | - "labels = [\"scikit-learn KNNImputer\", \"FaissImputer\"]\n", |
| 1012 | + "labels = [\"scikit-learn KNNImputer\", \"FastKNNImputer\"]\n", |
1013 | 1013 | "plt.bar(labels, times, color=[\"blue\", \"green\"])\n", |
1014 | 1014 | "plt.ylabel(\"Time in seconds\")\n", |
1015 | 1015 | "plt.title(\"Imputation Time Comparison for 10000 samples and 50 features with 10% missing rate\")\n", |
|
0 commit comments