|
66 | 66 | },
|
67 | 67 | {
|
68 | 68 | "cell_type": "code",
|
69 |
| - "execution_count": null, |
| 69 | + "execution_count": 2, |
70 | 70 | "metadata": {},
|
71 | 71 | "outputs": [],
|
72 | 72 | "source": [
|
|
84 | 84 | },
|
85 | 85 | {
|
86 | 86 | "cell_type": "code",
|
87 |
| - "execution_count": null, |
| 87 | + "execution_count": 3, |
88 | 88 | "metadata": {},
|
89 | 89 | "outputs": [],
|
90 | 90 | "source": [
|
|
94 | 94 | },
|
95 | 95 | {
|
96 | 96 | "cell_type": "code",
|
97 |
| - "execution_count": null, |
| 97 | + "execution_count": 4, |
98 | 98 | "metadata": {},
|
99 |
| - "outputs": [], |
| 99 | + "outputs": [ |
| 100 | + { |
| 101 | + "name": "stdout", |
| 102 | + "output_type": "stream", |
| 103 | + "text": [ |
| 104 | + "isdtype(DType.float32, IsDtypeKind.string(\"integral\"))\n", |
| 105 | + " -> FALSE\n", |
| 106 | + " -> FALSE\n", |
| 107 | + "DType.float64 == NDArray.var(\"X\").dtype\n", |
| 108 | + " -> DType.float64 == NDArray.var(\"X\").dtype\n", |
| 109 | + " -> TRUE\n", |
| 110 | + "asarray(NDArray.var(\"X\")).ndim == Int(0)\n", |
| 111 | + " -> NDArray.var(\"X\").ndim == Int(0)\n", |
| 112 | + " -> FALSE\n", |
| 113 | + "asarray(NDArray.var(\"X\")).ndim == Int(1)\n", |
| 114 | + " -> NDArray.var(\"X\").ndim == Int(1)\n", |
| 115 | + " -> FALSE\n", |
| 116 | + "asarray(NDArray.var(\"X\")).ndim >= Int(3)\n", |
| 117 | + " -> NDArray.var(\"X\").ndim >= Int(3)\n", |
| 118 | + " -> FALSE\n", |
| 119 | + "asarray(asarray(NDArray.var(\"X\"))).dtype == DType.object\n", |
| 120 | + " -> NDArray.var(\"X\").dtype == DType.object\n", |
| 121 | + " -> FALSE\n", |
| 122 | + "isdtype(asarray(asarray(NDArray.var(\"X\"))).dtype, (IsDtypeKind.string(\"real floating\") | (IsDtypeKind.string(\"complex floating\") | IsDtypeKind.NULL)))\n", |
| 123 | + " -> isdtype(NDArray.var(\"X\").dtype, (IsDtypeKind.string(\"real floating\") | IsDtypeKind.string(\"complex floating\")))\n", |
| 124 | + " -> TRUE\n", |
| 125 | + "isfinite(sum(asarray(asarray(NDArray.var(\"X\"))))).to_bool()\n", |
| 126 | + " -> isfinite(sum(NDArray.var(\"X\"))).to_bool()\n", |
| 127 | + " -> TRUE\n", |
| 128 | + "asarray(NDArray.var(\"X\")).shape.length()\n", |
| 129 | + " -> NDArray.var(\"X\").ndim\n", |
| 130 | + " -> Int(2)\n", |
| 131 | + "asarray(NDArray.var(\"X\")).shape[Int(0)] < Int(2)\n", |
| 132 | + " -> NDArray.var(\"X\").shape[Int(0)] < Int(2)\n", |
| 133 | + " -> FALSE\n", |
| 134 | + "asarray(NDArray.var(\"X\")).ndim == Int(2)\n", |
| 135 | + " -> NDArray.var(\"X\").ndim == Int(2)\n", |
| 136 | + " -> TRUE\n", |
| 137 | + "asarray(NDArray.var(\"X\")).shape[Int(1)] < Int(1)\n", |
| 138 | + " -> NDArray.var(\"X\").shape[Int(1)] < Int(1)\n", |
| 139 | + " -> FALSE\n", |
| 140 | + "asarray(NDArray.var(\"y\")).ndim >= Int(3)\n", |
| 141 | + " -> NDArray.var(\"y\").ndim >= Int(3)\n", |
| 142 | + " -> FALSE\n", |
| 143 | + "asarray(NDArray.var(\"y\")).ndim == Int(2)\n", |
| 144 | + " -> NDArray.var(\"y\").ndim == Int(2)\n", |
| 145 | + " -> FALSE\n", |
| 146 | + "asarray(NDArray.var(\"y\")).shape.length()\n", |
| 147 | + " -> NDArray.var(\"y\").ndim\n", |
| 148 | + " -> Int(1)\n", |
| 149 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).dtype == DType.object\n", |
| 150 | + " -> NDArray.var(\"y\").dtype == DType.object\n", |
| 151 | + " -> FALSE\n", |
| 152 | + "isdtype(\n", |
| 153 | + " asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).dtype,\n", |
| 154 | + " (IsDtypeKind.string(\"real floating\") | (IsDtypeKind.string(\"complex floating\") | IsDtypeKind.NULL)),\n", |
| 155 | + ")\n", |
| 156 | + " -> isdtype(NDArray.var(\"y\").dtype, (IsDtypeKind.string(\"real floating\") | IsDtypeKind.string(\"complex floating\")))\n", |
| 157 | + " -> FALSE\n", |
| 158 | + "asarray(NDArray.var(\"X\")).shape.length()\n", |
| 159 | + " -> NDArray.var(\"X\").ndim\n", |
| 160 | + " -> Int(2)\n", |
| 161 | + "asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))).shape.length()\n", |
| 162 | + " -> Int(1)\n", |
| 163 | + " -> Int(1)\n", |
| 164 | + "asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))).shape[Int(0)] < asarray(NDArray.var(\"X\")).shape[Int(0)]\n", |
| 165 | + " -> NDArray.var(\"y\").size < NDArray.var(\"X\").shape[Int(0)]\n", |
| 166 | + " -> FALSE\n", |
| 167 | + "asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))).shape[Int(0)] > asarray(NDArray.var(\"X\")).shape[Int(0)]\n", |
| 168 | + " -> NDArray.var(\"y\").size > NDArray.var(\"X\").shape[Int(0)]\n", |
| 169 | + " -> FALSE\n", |
| 170 | + "asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))).shape[Int(0)] == asarray(NDArray.var(\"X\")).shape[Int(0)]\n", |
| 171 | + " -> NDArray.var(\"y\").size == NDArray.var(\"X\").shape[Int(0)]\n", |
| 172 | + " -> TRUE\n", |
| 173 | + "asarray(NDArray.var(\"X\")).shape.length()\n", |
| 174 | + " -> NDArray.var(\"X\").ndim\n", |
| 175 | + " -> Int(2)\n", |
| 176 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).ndim == Int(2)\n", |
| 177 | + " -> FALSE\n", |
| 178 | + " -> FALSE\n", |
| 179 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).ndim == Int(1)\n", |
| 180 | + " -> TRUE\n", |
| 181 | + " -> TRUE\n", |
| 182 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).shape.length()\n", |
| 183 | + " -> Int(1)\n", |
| 184 | + " -> Int(1)\n", |
| 185 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).shape[Int(0)] == Int(0)\n", |
| 186 | + " -> NDArray.var(\"y\").size == Int(0)\n", |
| 187 | + " -> FALSE\n", |
| 188 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).dtype == DType.object\n", |
| 189 | + " -> NDArray.var(\"y\").dtype == DType.object\n", |
| 190 | + " -> FALSE\n", |
| 191 | + "asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).ndim == Int(2)\n", |
| 192 | + " -> FALSE\n", |
| 193 | + " -> FALSE\n", |
| 194 | + "isdtype(asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).dtype, IsDtypeKind.string(\"real floating\"))\n", |
| 195 | + " -> isdtype(NDArray.var(\"y\").dtype, IsDtypeKind.string(\"real floating\"))\n", |
| 196 | + " -> FALSE\n", |
| 197 | + "unique_values(asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))))).shape[Int(0)] > Int(2)\n", |
| 198 | + " -> unique_values(reshape(NDArray.var(\"y\"), TupleInt(Int(-1)))).shape[Int(0)] > Int(2)\n", |
| 199 | + " -> TRUE\n", |
| 200 | + "asarray(NDArray.var(\"X\")).shape.length()\n", |
| 201 | + " -> NDArray.var(\"X\").ndim\n", |
| 202 | + " -> Int(2)\n", |
| 203 | + "asarray(NDArray.var(\"X\")).shape[Int(0)] == unique_values(\n", |
| 204 | + " concat((TupleNDArray(unique_values(asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))))) + TupleNDArray.EMPTY))\n", |
| 205 | + ").shape[Int(0)]\n", |
| 206 | + " -> NDArray.var(\"X\").shape[Int(0)] == unique_values(reshape(NDArray.var(\"y\"), TupleInt(Int(-1)))).shape[Int(0)]\n", |
| 207 | + " -> FALSE\n", |
| 208 | + "unique_counts(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).length()\n", |
| 209 | + " -> Int(2)\n", |
| 210 | + " -> Int(2)\n", |
| 211 | + "asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))).shape[Int(0)]\n", |
| 212 | + " -> NDArray.var(\"y\").size\n", |
| 213 | + " -> Int(150)\n", |
| 214 | + "any(\n", |
| 215 | + " (\n", |
| 216 | + " (\n", |
| 217 | + " astype(unique_counts(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))))[Int(1)], asarray(NDArray.var(\"X\")).dtype)\n", |
| 218 | + " / NDArray.scalar_float(Float(150.0))\n", |
| 219 | + " )\n", |
| 220 | + " < NDArray.scalar_int(Int(0))\n", |
| 221 | + " )\n", |
| 222 | + ").to_bool()\n", |
| 223 | + " -> FALSE\n", |
| 224 | + " -> FALSE\n", |
| 225 | + "(\n", |
| 226 | + " abs(\n", |
| 227 | + " (\n", |
| 228 | + " sum(\n", |
| 229 | + " (\n", |
| 230 | + " astype(unique_counts(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))))[Int(1)], asarray(NDArray.var(\"X\")).dtype)\n", |
| 231 | + " / NDArray.scalar_float(Float(150.0))\n", |
| 232 | + " )\n", |
| 233 | + " )\n", |
| 234 | + " - NDArray.scalar_float(Float(1.0))\n", |
| 235 | + " )\n", |
| 236 | + " )\n", |
| 237 | + " > NDArray.scalar_float(Float(1e-05))\n", |
| 238 | + ").to_bool()\n", |
| 239 | + " -> (\n", |
| 240 | + " abs(\n", |
| 241 | + " (\n", |
| 242 | + " (astype(NDArray.scalar_int(reshape(NDArray.var(\"y\"), TupleInt(Int(-1))).size), NDArray.var(\"X\").dtype) / NDArray.scalar_float(Float(150.0)))\n", |
| 243 | + " - NDArray.scalar_float(Float(1.0))\n", |
| 244 | + " )\n", |
| 245 | + " )\n", |
| 246 | + " > NDArray.scalar_float(Float(1e-05))\n", |
| 247 | + ").to_bool()\n", |
| 248 | + " -> FALSE\n", |
| 249 | + "asarray(NDArray.var(\"X\")).shape[Int(1)] < (\n", |
| 250 | + " unique_values(concat((TupleNDArray(unique_values(asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))))) + TupleNDArray.EMPTY))).shape[\n", |
| 251 | + " Int(0)\n", |
| 252 | + " ]\n", |
| 253 | + " - Int(1)\n", |
| 254 | + ")\n", |
| 255 | + " -> NDArray.var(\"X\").shape[Int(1)] < (unique_values(reshape(NDArray.var(\"y\"), TupleInt(Int(-1)))).shape[Int(0)] - Int(1))\n", |
| 256 | + " -> FALSE\n", |
| 257 | + "(\n", |
| 258 | + " unique_values(concat((TupleNDArray(unique_values(asarray(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))))) + TupleNDArray.EMPTY))).shape[\n", |
| 259 | + " Int(0)\n", |
| 260 | + " ]\n", |
| 261 | + " - Int(1)\n", |
| 262 | + ") < Int(2)\n", |
| 263 | + " -> (unique_values(reshape(NDArray.var(\"y\"), TupleInt(Int(-1)))).shape[Int(0)] - Int(1)) < Int(2)\n", |
| 264 | + " -> FALSE\n", |
| 265 | + "asarray(NDArray.var(\"X\")).shape.length()\n", |
| 266 | + " -> NDArray.var(\"X\").ndim\n", |
| 267 | + " -> Int(2)\n", |
| 268 | + "unique_inverse(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY)))).length()\n", |
| 269 | + " -> Int(2)\n", |
| 270 | + " -> Int(2)\n", |
| 271 | + "unique_inverse(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))))[Int(0)].shape[Int(0)]\n", |
| 272 | + "unique_inverse(asarray(reshape(asarray(NDArray.var(\"y\")), (TupleInt(Int(-1)) + TupleInt.EMPTY))))[Int(0)].shape[Int(0)]\n", |
| 273 | + " -> unique_values(reshape(NDArray.var(\"y\"), TupleInt(Int(-1)))).shape[Int(0)]\n", |
| 274 | + " -> Int(3)\n" |
| 275 | + ] |
| 276 | + }, |
| 277 | + { |
| 278 | + "ename": "TypeError", |
| 279 | + "evalue": "NDArray has no method __iter__", |
| 280 | + "output_type": "error", |
| 281 | + "traceback": [ |
| 282 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 283 | + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", |
| 284 | + "File \u001b[0;32m~/p/egg-smol-python/python/egglog/runtime.py:452\u001b[0m, in \u001b[0;36m_preserved_method\u001b[0;34m(self, __name)\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 452\u001b[0m method \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__egg_decls__\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_class_decl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__egg_typed_expr__\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpreserved_methods\u001b[49m\u001b[43m[\u001b[49m\u001b[43m__name\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m:\n", |
| 285 | + "\u001b[0;31mKeyError\u001b[0m: '__iter__'", |
| 286 | + "\nDuring handling of the above exception, another exception occurred:\n", |
| 287 | + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", |
| 288 | + "Cell \u001b[0;32mIn[4], line 21\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# Add values for the constants\u001b[39;00m\n\u001b[1;32m 8\u001b[0m egraph\u001b[38;5;241m.\u001b[39mregister(\n\u001b[1;32m 9\u001b[0m rewrite(X_arr\u001b[38;5;241m.\u001b[39mdtype, runtime_ruleset)\u001b[38;5;241m.\u001b[39mto(convert(X\u001b[38;5;241m.\u001b[39mdtype, DType)),\n\u001b[1;32m 10\u001b[0m rewrite(y_arr\u001b[38;5;241m.\u001b[39mdtype, runtime_ruleset)\u001b[38;5;241m.\u001b[39mto(convert(y\u001b[38;5;241m.\u001b[39mdtype, DType)),\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 17\u001b[0m rewrite(unique_values(y_arr)\u001b[38;5;241m.\u001b[39mshape)\u001b[38;5;241m.\u001b[39mto(TupleInt(Int(\u001b[38;5;241m3\u001b[39m))),\n\u001b[1;32m 18\u001b[0m )\n\u001b[0;32m---> 21\u001b[0m res \u001b[38;5;241m=\u001b[39m \u001b[43mfit\u001b[49m\u001b[43m(\u001b[49m\u001b[43mX_arr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my_arr\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 23\u001b[0m \u001b[38;5;66;03m# X_obj, y_obj = egraph.save_object(X), egraph.save_object(y)\u001b[39;00m\n\u001b[1;32m 24\u001b[0m \n\u001b[1;32m 25\u001b[0m \u001b[38;5;66;03m# X_arr = NDArray(X_obj)\u001b[39;00m\n\u001b[1;32m 26\u001b[0m \u001b[38;5;66;03m# y_arr = NDArray(y_obj)\u001b[39;00m\n", |
| 289 | + "Cell \u001b[0;32mIn[1], line 15\u001b[0m, in \u001b[0;36mfit\u001b[0;34m(X, y)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m config_context(array_api_dispatch\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[1;32m 14\u001b[0m lda \u001b[38;5;241m=\u001b[39m LinearDiscriminantAnalysis(n_components\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m2\u001b[39m)\n\u001b[0;32m---> 15\u001b[0m X_r2 \u001b[38;5;241m=\u001b[39m \u001b[43mlda\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfit\u001b[49m\u001b[43m(\u001b[49m\u001b[43mX\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mtransform(X)\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m X_r2\n\u001b[1;32m 18\u001b[0m target_names \u001b[38;5;241m=\u001b[39m iris\u001b[38;5;241m.\u001b[39mtarget_names\n", |
| 290 | + "File \u001b[0;32m/usr/local/Caskroom/miniconda/base/envs/egg-smol-python/lib/python3.10/site-packages/sklearn/base.py:1151\u001b[0m, in \u001b[0;36m_fit_context.<locals>.decorator.<locals>.wrapper\u001b[0;34m(estimator, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1144\u001b[0m estimator\u001b[38;5;241m.\u001b[39m_validate_params()\n\u001b[1;32m 1146\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m config_context(\n\u001b[1;32m 1147\u001b[0m skip_parameter_validation\u001b[38;5;241m=\u001b[39m(\n\u001b[1;32m 1148\u001b[0m prefer_skip_nested_validation \u001b[38;5;129;01mor\u001b[39;00m global_skip_validation\n\u001b[1;32m 1149\u001b[0m )\n\u001b[1;32m 1150\u001b[0m ):\n\u001b[0;32m-> 1151\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfit_method\u001b[49m\u001b[43m(\u001b[49m\u001b[43mestimator\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", |
| 291 | + "File \u001b[0;32m/usr/local/Caskroom/miniconda/base/envs/egg-smol-python/lib/python3.10/site-packages/sklearn/discriminant_analysis.py:629\u001b[0m, in \u001b[0;36mLinearDiscriminantAnalysis.fit\u001b[0;34m(self, X, y)\u001b[0m\n\u001b[1;32m 623\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcovariance_estimator \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 624\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 625\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcovariance estimator \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 626\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis not supported \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 627\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwith svd solver. Try another solver\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 628\u001b[0m )\n\u001b[0;32m--> 629\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_solve_svd\u001b[49m\u001b[43m(\u001b[49m\u001b[43mX\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 630\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msolver \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlsqr\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 631\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_solve_lstsq(\n\u001b[1;32m 632\u001b[0m X,\n\u001b[1;32m 633\u001b[0m y,\n\u001b[1;32m 634\u001b[0m shrinkage\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshrinkage,\n\u001b[1;32m 635\u001b[0m covariance_estimator\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcovariance_estimator,\n\u001b[1;32m 636\u001b[0m )\n", |
| 292 | + "File \u001b[0;32m/usr/local/Caskroom/miniconda/base/envs/egg-smol-python/lib/python3.10/site-packages/sklearn/discriminant_analysis.py:506\u001b[0m, in \u001b[0;36mLinearDiscriminantAnalysis._solve_svd\u001b[0;34m(self, X, y)\u001b[0m\n\u001b[1;32m 503\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcovariance_ \u001b[38;5;241m=\u001b[39m _class_cov(X, y, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpriors_)\n\u001b[1;32m 505\u001b[0m Xc \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m--> 506\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m idx, group \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28;43menumerate\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclasses_\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 507\u001b[0m Xg \u001b[38;5;241m=\u001b[39m X[y \u001b[38;5;241m==\u001b[39m group]\n\u001b[1;32m 508\u001b[0m Xc\u001b[38;5;241m.\u001b[39mappend(Xg \u001b[38;5;241m-\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmeans_[idx, :])\n", |
| 293 | + "File \u001b[0;32m~/p/egg-smol-python/python/egglog/runtime.py:454\u001b[0m, in \u001b[0;36m_preserved_method\u001b[0;34m(self, __name)\u001b[0m\n\u001b[1;32m 452\u001b[0m method \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__egg_decls__\u001b[38;5;241m.\u001b[39mget_class_decl(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__egg_typed_expr__\u001b[38;5;241m.\u001b[39mtp\u001b[38;5;241m.\u001b[39mname)\u001b[38;5;241m.\u001b[39mpreserved_methods[__name]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m:\n\u001b[0;32m--> 454\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__egg_typed_expr__\u001b[38;5;241m.\u001b[39mtp\u001b[38;5;241m.\u001b[39mname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m has no method \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m__name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 455\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m method(\u001b[38;5;28mself\u001b[39m)\n", |
| 294 | + "\u001b[0;31mTypeError\u001b[0m: NDArray has no method __iter__" |
| 295 | + ] |
| 296 | + } |
| 297 | + ], |
100 | 298 | "source": [
|
101 | 299 | "from egglog.exp.array_api import *\n",
|
102 | 300 | "\n",
|
|
0 commit comments