Skip to content

Commit

Permalink
Merge pull request #29 from e10e3/sklearn-example
Browse files Browse the repository at this point in the history
Make the scikit-learn example runnable
  • Loading branch information
sherbold authored Jul 19, 2024
2 parents e01f410 + 839b6af commit ee9c8e3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion examples/sklearn.py → examples/example_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
import matplotlib.pyplot as plt
import pandas as pd

import sys
import importlib.util

is_available = importlib.util.find_spec("sklearn")
if not is_available:
print(
"""scikit-learn needs to be installed for this example.
If you use pip as a package manager, you can install it with the following command:
pip install scikit-learn"""
)
sys.exit(1)

from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification, make_hastie_10_2
Expand All @@ -12,7 +24,7 @@
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.naive_bayes import GaussianNB
from autorank import autorank, create_report
from autorank import autorank, create_report, latex_table, plot_stats


clf_names = ["Linear SVM", "RBF SVM", "Decision Tree", "Random Forest", "Neural Net", "Naive Bayes"]
Expand Down

0 comments on commit ee9c8e3

Please sign in to comment.