Skip to content

Commit

Permalink
Add factor-relatconstraints to linear terms
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcurbelo committed Jun 5, 2024
1 parent c362f0f commit ffbd62a
Show file tree
Hide file tree
Showing 3 changed files with 308 additions and 133 deletions.
113 changes: 63 additions & 50 deletions simlab_experiments/clusterKinetics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 94,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -85,7 +85,7 @@
},
{
"cell_type": "code",
"execution_count": 95,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -131,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 96,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -152,7 +152,7 @@
},
{
"cell_type": "code",
"execution_count": 97,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -211,7 +211,7 @@
},
{
"cell_type": "code",
"execution_count": 98,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -240,7 +240,7 @@
},
{
"cell_type": "code",
"execution_count": 99,
"execution_count": 18,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -280,7 +280,7 @@
},
{
"cell_type": "code",
"execution_count": 100,
"execution_count": 19,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -330,21 +330,21 @@
"\n",
"last_row = n_quadratic_first + 2\n",
"\n",
"## Inequality constraints\n",
"# Coefficient of x0^2 is positive\n",
"# x0^2 <= large_value\n",
"constraint_rhs = np.append(constraint_rhs, large_value)\n",
"constraint_lhs = np.vstack((constraint_lhs, np.zeros((1, n_targets * n_features))))\n",
"x0sqs_idx = features_names.index('x0^2')\n",
"constraint_lhs[-1, x0sqs_idx] = 1\n",
"# ## Inequality constraints\n",
"# # Coefficient of x0^2 is positive\n",
"# # x0^2 <= large_value\n",
"# constraint_rhs = np.append(constraint_rhs, large_value)\n",
"# constraint_lhs = np.vstack((constraint_lhs, np.zeros((1, n_targets * n_features))))\n",
"# x0sqs_idx = features_names.index('x0^2')\n",
"# constraint_lhs[-1, x0sqs_idx] = 1\n",
"\n",
"# x0^2 >= eps\n",
"constraint_rhs = np.append(constraint_rhs, eps_value)\n",
"constraint_lhs = np.vstack((constraint_lhs, np.zeros((1, n_targets * n_features))))\n",
"constraint_lhs[-1, x0sqs_idx] = -1\n",
"# # x0^2 >= eps\n",
"# constraint_rhs = np.append(constraint_rhs, eps_value)\n",
"# constraint_lhs = np.vstack((constraint_lhs, np.zeros((1, n_targets * n_features))))\n",
"# constraint_lhs[-1, x0sqs_idx] = -1\n",
"\n",
"# Adjust for the number of constraints\n",
"last_row = last_row + 2"
"# # Adjust for the number of constraints\n",
"# last_row = last_row + 2"
]
},
{
Expand All @@ -356,7 +356,7 @@
},
{
"cell_type": "code",
"execution_count": 101,
"execution_count": 20,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -422,7 +422,7 @@
},
{
"cell_type": "code",
"execution_count": 102,
"execution_count": 21,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -483,7 +483,7 @@
},
{
"cell_type": "code",
"execution_count": 123,
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -511,20 +511,33 @@
},
{
"cell_type": "code",
"execution_count": 124,
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Iteration ... |y - Xw|^2 ... |w-u|^2/v ... R(u) ... Total Error: |y - Xw|^2 + |w - u|^2 / v + R(u)\n",
" 0 ... 2.9003e-09 ... 2.2820e+11 ... 1.3063e-14 ... 2.2820e+11\n",
"(x0)' = -0.059 x0 + 0.424 x1 + 0.625 x2 + -0.268 x3 + -0.172 x4\n",
"(x1)' = 0.030 x0 + -0.332 x1 + 0.304 x2 + 0.221 x3 + 0.092 x4\n",
"(x2)' = 0.005 x0 + -0.046 x1 + 0.002 x2\n",
"(x3)' = 0.001 x0 + -0.007 x1\n",
"(x4)' = -0.001 x1\n"
" Iteration ... |y - Xw|^2 ... |w-u|^2/v ... R(u) ... Total Error: |y - Xw|^2 + |w - u|^2 / v + R(u)\n"
]
},
{
"ename": "LinAlgError",
"evalue": "Singular matrix",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mLinAlgError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[23], line 39\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m ignore_specific_warnings():\n\u001b[1;32m 31\u001b[0m \u001b[38;5;66;03m# Fit the model\u001b[39;00m\n\u001b[1;32m 32\u001b[0m model \u001b[38;5;241m=\u001b[39m ps\u001b[38;5;241m.\u001b[39mSINDy( \n\u001b[1;32m 33\u001b[0m \u001b[38;5;66;03m# discrete_time=True,\u001b[39;00m\n\u001b[1;32m 34\u001b[0m differentiation_method\u001b[38;5;241m=\u001b[39mdifferentiation_method,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 37\u001b[0m feature_library\u001b[38;5;241m=\u001b[39mfeature_library,\n\u001b[1;32m 38\u001b[0m )\n\u001b[0;32m---> 39\u001b[0m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfit\u001b[49m\u001b[43m(\u001b[49m\u001b[43mN_clusters_train\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mt\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdt\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 41\u001b[0m \u001b[38;5;66;03m# Print the model\u001b[39;00m\n\u001b[1;32m 42\u001b[0m model\u001b[38;5;241m.\u001b[39mprint()\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/pysindy/pysindy.py:262\u001b[0m, in \u001b[0;36mSINDy.fit\u001b[0;34m(self, x, t, x_dot, u)\u001b[0m\n\u001b[1;32m 260\u001b[0m x_dot \u001b[38;5;241m=\u001b[39m concat_sample_axis(x_dot)\n\u001b[1;32m 261\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel \u001b[38;5;241m=\u001b[39m Pipeline(steps)\n\u001b[0;32m--> 262\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\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[43mx_dot\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 264\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mn_features_in_ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfeature_library\u001b[38;5;241m.\u001b[39mn_features_in_\n\u001b[1;32m 265\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mn_output_features_ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfeature_library\u001b[38;5;241m.\u001b[39mn_output_features_\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/venv-pysindy/lib/python3.12/site-packages/sklearn/base.py:1474\u001b[0m, in \u001b[0;36m_fit_context.<locals>.decorator.<locals>.wrapper\u001b[0;34m(estimator, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1467\u001b[0m estimator\u001b[38;5;241m.\u001b[39m_validate_params()\n\u001b[1;32m 1469\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m config_context(\n\u001b[1;32m 1470\u001b[0m skip_parameter_validation\u001b[38;5;241m=\u001b[39m(\n\u001b[1;32m 1471\u001b[0m prefer_skip_nested_validation \u001b[38;5;129;01mor\u001b[39;00m global_skip_validation\n\u001b[1;32m 1472\u001b[0m )\n\u001b[1;32m 1473\u001b[0m ):\n\u001b[0;32m-> 1474\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",
"File \u001b[0;32m/u1/ame805/pysindy_fork/venv-pysindy/lib/python3.12/site-packages/sklearn/pipeline.py:475\u001b[0m, in \u001b[0;36mPipeline.fit\u001b[0;34m(self, X, y, **params)\u001b[0m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_final_estimator \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpassthrough\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 474\u001b[0m last_step_params \u001b[38;5;241m=\u001b[39m routed_params[\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msteps[\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m][\u001b[38;5;241m0\u001b[39m]]\n\u001b[0;32m--> 475\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_final_estimator\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfit\u001b[49m\u001b[43m(\u001b[49m\u001b[43mXt\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\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[43mlast_step_params\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfit\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 477\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/pysindy/optimizers/base.py:198\u001b[0m, in \u001b[0;36mBaseOptimizer.fit\u001b[0;34m(self, x_, y, sample_weight, **reduce_kws)\u001b[0m\n\u001b[1;32m 194\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhistory_ \u001b[38;5;241m=\u001b[39m [\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcoef_]\n\u001b[1;32m 196\u001b[0m x_normed \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39masarray(x_normed)\n\u001b[0;32m--> 198\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_reduce\u001b[49m\u001b[43m(\u001b[49m\u001b[43mx_normed\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my\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[43mreduce_kws\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mind_ \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mabs(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcoef_) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1e-14\u001b[39m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39munbias:\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/pysindy/optimizers/constrained_sr3.py:465\u001b[0m, in \u001b[0;36mConstrainedSR3._reduce\u001b[0;34m(self, x, y)\u001b[0m\n\u001b[1;32m 463\u001b[0m trimming_grad \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0.5\u001b[39m \u001b[38;5;241m*\u001b[39m np\u001b[38;5;241m.\u001b[39msum((y \u001b[38;5;241m-\u001b[39m x\u001b[38;5;241m.\u001b[39mdot(coef_full)) \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m \u001b[38;5;241m2\u001b[39m, axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m)\n\u001b[1;32m 464\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39muse_constraints:\n\u001b[0;32m--> 465\u001b[0m coef_full \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_update_full_coef_constraints\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 466\u001b[0m \u001b[43m \u001b[49m\u001b[43mH\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mx_transpose_y\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcoef_sparse\u001b[49m\n\u001b[1;32m 467\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 468\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 469\u001b[0m coef_full \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_update_full_coef(cho, x_transpose_y, coef_sparse)\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/pysindy/optimizers/constrained_sr3.py:264\u001b[0m, in \u001b[0;36mConstrainedSR3._update_full_coef_constraints\u001b[0;34m(self, H, x_transpose_y, coef_sparse)\u001b[0m\n\u001b[1;32m 262\u001b[0m inv1 \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mlinalg\u001b[38;5;241m.\u001b[39minv(H)\n\u001b[1;32m 263\u001b[0m inv1_mod \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mkron(inv1, np\u001b[38;5;241m.\u001b[39meye(coef_sparse\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m1\u001b[39m]))\n\u001b[0;32m--> 264\u001b[0m inv2 \u001b[38;5;241m=\u001b[39m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinalg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minv\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 265\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconstraint_lhs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdot\u001b[49m\u001b[43m(\u001b[49m\u001b[43minv1_mod\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdot\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconstraint_lhs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mT\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 266\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 268\u001b[0m rhs \u001b[38;5;241m=\u001b[39m g\u001b[38;5;241m.\u001b[39mflatten() \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconstraint_lhs\u001b[38;5;241m.\u001b[39mT\u001b[38;5;241m.\u001b[39mdot(inv2)\u001b[38;5;241m.\u001b[39mdot(\n\u001b[1;32m 269\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconstraint_rhs \u001b[38;5;241m-\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconstraint_lhs\u001b[38;5;241m.\u001b[39mdot(inv1_mod)\u001b[38;5;241m.\u001b[39mdot(g\u001b[38;5;241m.\u001b[39mflatten())\n\u001b[1;32m 270\u001b[0m )\n\u001b[1;32m 271\u001b[0m rhs \u001b[38;5;241m=\u001b[39m rhs\u001b[38;5;241m.\u001b[39mreshape(g\u001b[38;5;241m.\u001b[39mshape)\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/venv-pysindy/lib/python3.12/site-packages/numpy/linalg/linalg.py:561\u001b[0m, in \u001b[0;36minv\u001b[0;34m(a)\u001b[0m\n\u001b[1;32m 559\u001b[0m signature \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mD->D\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m isComplexType(t) \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124md->d\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 560\u001b[0m extobj \u001b[38;5;241m=\u001b[39m get_linalg_error_extobj(_raise_linalgerror_singular)\n\u001b[0;32m--> 561\u001b[0m ainv \u001b[38;5;241m=\u001b[39m \u001b[43m_umath_linalg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minv\u001b[49m\u001b[43m(\u001b[49m\u001b[43ma\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msignature\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msignature\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextobj\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 562\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m wrap(ainv\u001b[38;5;241m.\u001b[39mastype(result_t, copy\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m))\n",
"File \u001b[0;32m/u1/ame805/pysindy_fork/venv-pysindy/lib/python3.12/site-packages/numpy/linalg/linalg.py:112\u001b[0m, in \u001b[0;36m_raise_linalgerror_singular\u001b[0;34m(err, flag)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_raise_linalgerror_singular\u001b[39m(err, flag):\n\u001b[0;32m--> 112\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LinAlgError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSingular matrix\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
"\u001b[0;31mLinAlgError\u001b[0m: Singular matrix"
]
}
],
Expand All @@ -536,26 +549,26 @@
"# optimizer = ps.STLSQ(threshold=threshold)\n",
"# Define the optimizer with the specified constraints\n",
"\n",
"# optimizer = ps.ConstrainedSR3(\n",
"# verbose=True,\n",
"# # thresholder=\"l0\",\n",
"# # threshold=0.1,\n",
"# # trimming_fraction=0.1,\n",
"# # max_iter=5000,\n",
"# constraint_rhs=constraint_rhs, constraint_lhs=constraint_lhs\n",
"# )\n",
"\n",
"optimizer = ps.ConstrainedSR3(\n",
" verbose=True,\n",
" constraint_rhs=constraint_rhs,\n",
" constraint_lhs=constraint_lhs,\n",
" inequality_constraints=True, # Ensure this is True for inequality constraints\n",
" thresholder=\"l1\",\n",
" tol=1e-7,\n",
" threshold=1e-10,\n",
" max_iter=10000,\n",
" # thresholder=\"l0\",\n",
" # threshold=0.1,\n",
" # trimming_fraction=0.1,\n",
" # max_iter=5000,\n",
" constraint_rhs=constraint_rhs, constraint_lhs=constraint_lhs\n",
")\n",
"\n",
"# optimizer = ps.ConstrainedSR3(\n",
"# verbose=True,\n",
"# constraint_rhs=constraint_rhs,\n",
"# constraint_lhs=constraint_lhs,\n",
"# inequality_constraints=True, # Ensure this is True for inequality constraints\n",
"# thresholder=\"l1\",\n",
"# tol=1e-7,\n",
"# threshold=1e-10,\n",
"# max_iter=10000,\n",
"# )\n",
"\n",
"feature_library = ps.PolynomialLibrary(degree=poly_order)\n",
"\n",
"with ignore_specific_warnings():\n",
Expand All @@ -575,7 +588,7 @@
},
{
"cell_type": "code",
"execution_count": 125,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -592,7 +605,7 @@
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -646,7 +659,7 @@
},
{
"cell_type": "code",
"execution_count": 127,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down
Loading

0 comments on commit ffbd62a

Please sign in to comment.