mobook / MO-book

Hands-On Optimization with Python
MIT License
153 stars 40 forks source link

SVM conic #61

Closed glebbelov closed 1 year ago

glebbelov commented 1 year ago

06/svm-conic.ipynb does not run. The link to a "previous SVM model" in Chapter 4 is broken (I assume it's now in Chapter 5). Class LinearSVM is not defined (the one from Chapter 5 works). Function scatter4 is not defined, we use the following:

def scatter4(X_test, y_test, y_pred):
    fig, ax = plt.subplots(1, 2, figsize=(10, 4))
    scatter_labeled_data(
        X_test,
        y_test,
        labels=["genuine", "counterfeit"],
        ax=ax[0],
        title="Test Set",
    )
    scatter_labeled_data(
        X_test,
        y_pred,
        labels=["genuine", "counterfeit"],
        ax=ax[1],
        title="Prediction",
)

And a technical question. My Python installation is via apt. Can I install Mosek this way, or do I have to reinstall Python via Anaconda?

jckantor commented 1 year ago

Thanks for opening this issue. The link has been updated to reflect the final organization of chapters and notebook filenames. There was an obvious breakdown in my testing that allowed the missing utilities to get through. svm-conic should now be working for you.

I don't see why it wouldn't work with Python installed via apt, provided pip is installing things in a manner consistent with the installation. You can add the location the executable in pyomo.SolverFactory if mosek is installed somewhere off the search path.