{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import joblib\n", "\n", "obj = joblib.load('traning_zone/mini_modèle/maquillage/transformers/object.pkl')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['maquillage'], dtype=object)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "obj.inverse_transform([1])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from traning_zone.traitement_data.feature_engeneering_mini_modele.data_clearning import *\n", "from traning_zone.data_import.data_importation import *" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df = clearning_pred(*[\"1964\"])\n", "DF = data_import(*[\"1964\"])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "obj = joblib.load('traning_zone/mini_modèle/maquillage/transformers/object.pkl')\n", "tv = joblib.load('traning_zone/mini_modèle/maquillage/transformers/tv_transform.pkl')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(array(['confiserie de sucre'], dtype=object),\n", " array(['confiserie'], dtype=object))" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from traning_zone.classe_prediction.classe_prediction import *\n", "\n", "X = [\"milka e\"] \n", "\n", "pred = Prediction(X)\n", "pred.final_prediction()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "obj = joblib.load('traning_zone/modèles/transformers/object.pkl')\n", "tv = joblib.load('traning_zone/modèles/transformers/tv_transform.pkl')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "df = pd.read_csv(\"data_maquillage.csv\")\n", "DF = df.copy()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0COUNTRY_KEYITEM_DESCBARCODEBEM_CLASS_KEYBEM_CLASS_DESC_FRprediction
00FRA150ML SECHE VERNIS VITRY35388925260341964DIVERS MAQUILLAGEmaquillage des ongles
11FRA15COM.SOMMEIL TRIPLE ACTI.PURE37010568034431964DIVERS MAQUILLAGEmaquillage
22FRA2 EPONG.DEMAQUILLER N°42 SANOD37015095804261964DIVERS MAQUILLAGEautres produits maquillage
33FRA200ML DIFF PFUM FIGUE CDP35517801640331964DIVERS MAQUILLAGEmaquillage
44FRA2PCS EPONGE DEMAQUILLANTE32765582202531964DIVERS MAQUILLAGEautres produits maquillage
\n", "
" ], "text/plain": [ " Unnamed: 0 COUNTRY_KEY ITEM_DESC BARCODE \\\n", "0 0 FRA 150ML SECHE VERNIS VITRY 3538892526034 \n", "1 1 FRA 15COM.SOMMEIL TRIPLE ACTI.PURE 3701056803443 \n", "2 2 FRA 2 EPONG.DEMAQUILLER N°42 SANOD 3701509580426 \n", "3 3 FRA 200ML DIFF PFUM FIGUE CDP 3551780164033 \n", "4 4 FRA 2PCS EPONGE DEMAQUILLANTE 3276558220253 \n", "\n", " BEM_CLASS_KEY BEM_CLASS_DESC_FR prediction \n", "0 1964 DIVERS MAQUILLAGE maquillage des ongles \n", "1 1964 DIVERS MAQUILLAGE maquillage \n", "2 1964 DIVERS MAQUILLAGE autres produits maquillage \n", "3 1964 DIVERS MAQUILLAGE maquillage \n", "4 1964 DIVERS MAQUILLAGE autres produits maquillage " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "X = df.ITEM_DESC\n", "tv_x = tv.transform(X)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Model = joblib.load('traning_zone/hyper_modèles/LogisticRegression/LogisticRegression.pkl')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ 4, 12, 8, 17, 4, 4, 4, 2, 8, 12, 9, 17, 18, 4, 4, 11, 9,\n", " 9, 13, 18, 18, 13, 18, 18, 4, 4, 18, 6, 6, 18, 4, 17, 4, 13,\n", " 13, 13, 9, 9, 9, 18, 18, 18, 18, 18, 18, 4, 17, 17, 17, 17, 17,\n", " 17, 17, 17, 17, 5, 5, 12, 12, 13, 9, 9, 9, 9, 9, 9, 18, 4,\n", " 6, 11, 11, 11, 4, 4, 9, 4, 9, 9, 9, 9, 9, 9, 9, 9, 18,\n", " 2, 18, 4, 18, 18, 18, 9, 2, 11, 2, 9])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "y_pred = Model.predict(tv_x)\n", "y_pred" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['confiserie', 'premiers soins', 'hygiène féminine intime',\n", " 'soins du corps', 'confiserie', 'confiserie', 'confiserie',\n", " 'bain douches savons', 'hygiène féminine intime', 'premiers soins',\n", " 'maquillage', 'soins du corps', 'soins du visage', 'confiserie',\n", " 'confiserie', 'parfums', 'maquillage', 'maquillage',\n", " 'produits diététiques', 'soins du visage', 'soins du visage',\n", " 'produits diététiques', 'soins du visage', 'soins du visage',\n", " 'confiserie', 'confiserie', 'soins du visage',\n", " 'hygiène bucco dentaire', 'hygiène bucco dentaire',\n", " 'soins du visage', 'confiserie', 'soins du corps', 'confiserie',\n", " 'produits diététiques', 'produits diététiques',\n", " 'produits diététiques', 'maquillage', 'maquillage', 'maquillage',\n", " 'soins du visage', 'soins du visage', 'soins du visage',\n", " 'soins du visage', 'soins du visage', 'soins du visage',\n", " 'confiserie', 'soins du corps', 'soins du corps', 'soins du corps',\n", " 'soins du corps', 'soins du corps', 'soins du corps',\n", " 'soins du corps', 'soins du corps', 'soins du corps',\n", " 'fruits et jus de fruits surgelés',\n", " 'fruits et jus de fruits surgelés', 'premiers soins',\n", " 'premiers soins', 'produits diététiques', 'maquillage',\n", " 'maquillage', 'maquillage', 'maquillage', 'maquillage',\n", " 'maquillage', 'soins du visage', 'confiserie',\n", " 'hygiène bucco dentaire', 'parfums', 'parfums', 'parfums',\n", " 'confiserie', 'confiserie', 'maquillage', 'confiserie',\n", " 'maquillage', 'maquillage', 'maquillage', 'maquillage',\n", " 'maquillage', 'maquillage', 'maquillage', 'maquillage',\n", " 'soins du visage', 'bain douches savons', 'soins du visage',\n", " 'confiserie', 'soins du visage', 'soins du visage',\n", " 'soins du visage', 'maquillage', 'bain douches savons', 'parfums',\n", " 'bain douches savons', 'maquillage'], dtype=object)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Y = obj.inverse_transform(y_pred)\n", "Y" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['alimentation infantile', 'bain douches savons',\n", " 'coloration cheveux', 'confiserie',\n", " 'fruits et jus de fruits surgelés', 'hygiène bucco dentaire',\n", " 'hygiène bébé', 'hygiène féminine intime', 'maquillage', 'oeufs',\n", " 'parfums', 'premiers soins', 'produits diététiques',\n", " 'produits solaires', 'shampooings', 'soins cheveux',\n", " 'soins du corps', 'soins du visage'], dtype=object)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "y = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]\n", "y = obj.inverse_transform(y)\n", "y" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "DF[\"Prediction\"] = Y" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0COUNTRY_KEYITEM_DESCBARCODEBEM_CLASS_KEYBEM_CLASS_DESC_FRpredictionPrediction
00FRA150ML SECHE VERNIS VITRY35388925260341964DIVERS MAQUILLAGEmaquillage des onglesconfiserie
11FRA15COM.SOMMEIL TRIPLE ACTI.PURE37010568034431964DIVERS MAQUILLAGEmaquillagepremiers soins
22FRA2 EPONG.DEMAQUILLER N°42 SANOD37015095804261964DIVERS MAQUILLAGEautres produits maquillagehygiène féminine intime
33FRA200ML DIFF PFUM FIGUE CDP35517801640331964DIVERS MAQUILLAGEmaquillagesoins du corps
44FRA2PCS EPONGE DEMAQUILLANTE32765582202531964DIVERS MAQUILLAGEautres produits maquillageconfiserie
...........................
9191FRATAILLE CRAYON JUMBO EYE CARE35326650091061964DIVERS MAQUILLAGEmaquillage des yeuxmaquillage
9292FRATROUSSE CM + GEL + SAVON C41934334253160241964DIVERS MAQUILLAGEautres produits maquillagebain douches savons
9393FRATROUSSE CM BOI ROSE OSM C41934334253159281964DIVERS MAQUILLAGEautres produits maquillageparfums
9494FRATRSE CM+GELHYDRO+SAVON GR C41934334253160791964DIVERS MAQUILLAGEautres produits maquillagebain douches savons
9595FRAZAP FAP NACRE 106 BIO 3G37007566010691964DIVERS MAQUILLAGEmaquillagemaquillage
\n", "

96 rows × 8 columns

\n", "
" ], "text/plain": [ " Unnamed: 0 COUNTRY_KEY ITEM_DESC BARCODE \\\n", "0 0 FRA 150ML SECHE VERNIS VITRY 3538892526034 \n", "1 1 FRA 15COM.SOMMEIL TRIPLE ACTI.PURE 3701056803443 \n", "2 2 FRA 2 EPONG.DEMAQUILLER N°42 SANOD 3701509580426 \n", "3 3 FRA 200ML DIFF PFUM FIGUE CDP 3551780164033 \n", "4 4 FRA 2PCS EPONGE DEMAQUILLANTE 3276558220253 \n", ".. ... ... ... ... \n", "91 91 FRA TAILLE CRAYON JUMBO EYE CARE 3532665009106 \n", "92 92 FRA TROUSSE CM + GEL + SAVON C419 3433425316024 \n", "93 93 FRA TROUSSE CM BOI ROSE OSM C419 3433425315928 \n", "94 94 FRA TRSE CM+GELHYDRO+SAVON GR C419 3433425316079 \n", "95 95 FRA ZAP FAP NACRE 106 BIO 3G 3700756601069 \n", "\n", " BEM_CLASS_KEY BEM_CLASS_DESC_FR prediction \\\n", "0 1964 DIVERS MAQUILLAGE maquillage des ongles \n", "1 1964 DIVERS MAQUILLAGE maquillage \n", "2 1964 DIVERS MAQUILLAGE autres produits maquillage \n", "3 1964 DIVERS MAQUILLAGE maquillage \n", "4 1964 DIVERS MAQUILLAGE autres produits maquillage \n", ".. ... ... ... \n", "91 1964 DIVERS MAQUILLAGE maquillage des yeux \n", "92 1964 DIVERS MAQUILLAGE autres produits maquillage \n", "93 1964 DIVERS MAQUILLAGE autres produits maquillage \n", "94 1964 DIVERS MAQUILLAGE autres produits maquillage \n", "95 1964 DIVERS MAQUILLAGE maquillage \n", "\n", " Prediction \n", "0 confiserie \n", "1 premiers soins \n", "2 hygiène féminine intime \n", "3 soins du corps \n", "4 confiserie \n", ".. ... \n", "91 maquillage \n", "92 bain douches savons \n", "93 parfums \n", "94 bain douches savons \n", "95 maquillage \n", "\n", "[96 rows x 8 columns]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "DF" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "DF.to_csv(\"data_maquillage.csv\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.3" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }