commit 81bed44ac61392f592c7bed27ae2cee54828cd2a Author: aboelhamd Date: Fri Jul 26 23:13:58 2019 +0200 save the encoder too diff --git a/all-datasets-models.ipynb b/all-datasets-models.ipynb index 48d893e..24137bb 100644 --- a/all-datasets-models.ipynb +++ b/all-datasets-models.ipynb @@ -9,30 +9,6 @@ "%matplotlib inline" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n", - "# Classifier comparison\n", - "\n", - "\n", - "A comparison of a several classifiers in scikit-learn on synthetic datasets.\n", - "The point of this example is to illustrate the nature of decision boundaries\n", - "of different classifiers.\n", - "This should be taken with a grain of salt, as the intuition conveyed by\n", - "these examples does not necessarily carry over to real datasets.\n", - "\n", - "Particularly in high-dimensional spaces, data can more easily be separated\n", - "linearly and the simplicity of classifiers such as naive Bayes and linear SVMs\n", - "might lead to better generalization than is achieved by other classifiers.\n", - "\n", - "The plots show training points in solid colors and testing points\n", - "semi-transparent. The lower right shows the classification accuracy on the test\n", - "set.\n", - "\n" - ] - }, { "cell_type": "code", "execution_count": 2, @@ -15521,6 +15497,10 @@ " from sklearn.preprocessing import OrdinalEncoder\n", " enc = OrdinalEncoder(dtype=np.int32)\n", " features = enc.fit_transform(data.iloc[:,2:])\n", + " \n", + " # save the encoder\n", + " modelname = 'models/'+'encoder'+'-'+file[:-4]\n", + " joblib.dump(clf, modelname)\n", "# display(enc.categories_)\n", "# display(data.iloc[:,2:],features)\n", " # target and weights\n", @@ -15547,9 +15527,9 @@ " print(\" score =\", score)\n", " \n", " # save models\n", - " name+'-'+file[:-4]+'.model'\n", - " filename = 'models/'+name+'-'+file[:-4]+'.model'\n", - " joblib.dump(clf, filename)\n", + "# name+'-'+file[:-4]+'.model'\n", + " modelname = 'models/'+name+'-'+file[:-4]\n", + " joblib.dump(clf, modelname)\n", " print(\"----------------------------------------------\\n\")\n" ] },