{ "cells": [ { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "#using PyCall\n", "using DataFrames\n", "using CSV\n", "using PyCall, JLD, PyCallJLD" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.83418762482611" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "## Example of python code used into julia\n", "#ipfml_utils = pyimport(\"ipfml.utils\")\n", "#b = [1:10;]\n", "#ipfml_utils.get_entropy(b)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example of Julia use for train" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prepare dataframe" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"test_model\"" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "## Define file variable\n", "data_filename = \"../data/test_data\"\n", "output_filename = \"test_model\"" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

3 rows × 201 columns

Column1Column2Column3Column4Column5Column6Column7Column8Column9Column10Column11Column12Column13Column14Column15Column16Column17Column18Column19Column20Column21Column22Column23Column24Column25Column26Column27Column28Column29Column30Column31Column32Column33Column34Column35Column36Column37Column38Column39Column40Column41Column42Column43Column44Column45Column46Column47Column48Column49Column50Column51Column52Column53Column54Column55Column56Column57Column58Column59Column60Column61Column62Column63Column64Column65Column66Column67Column68Column69Column70Column71Column72Column73Column74Column75Column76Column77Column78Column79Column80Column81Column82Column83Column84Column85Column86Column87Column88Column89Column90Column91Column92Column93Column94Column95Column96Column97Column98Column99Column100Column101Column102Column103Column104Column105Column106Column107Column108Column109Column110Column111Column112Column113Column114Column115Column116Column117Column118Column119Column120Column121Column122Column123Column124Column125Column126Column127Column128Column129Column130Column131Column132Column133Column134Column135Column136Column137Column138Column139Column140Column141Column142Column143Column144Column145Column146Column147Column148Column149Column150Column151Column152Column153Column154Column155Column156Column157Column158Column159Column160Column161Column162Column163Column164Column165Column166Column167Column168Column169Column170Column171Column172Column173Column174Column175Column176Column177Column178Column179Column180Column181Column182Column183Column184Column185Column186Column187Column188Column189Column190Column191Column192Column193Column194Column195Column196Column197Column198Column199Column200Column201
Int64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰Float64⍰
110.8088740.02626890.02221770.0158710.01281750.01049190.009622790.008817320.008357050.00802370.007580010.007272140.006760850.006697250.006315130.00574160.005627750.005394970.005101660.004923740.004673610.004588110.00445620.004119010.004033690.003763570.003720160.003524320.003419070.003333170.003274880.003177140.003112010.003027010.002959150.002792150.002733650.002626620.002500850.002457760.002393910.002339990.002323160.002237650.002189950.002119190.002111930.002008170.00196190.001840260.001807690.001785570.001753340.001699910.001690880.001638030.00159430.001537680.001522120.001498890.001453910.001439260.001398770.001359520.001332420.00129180.001261770.001243070.001232110.001207880.001188310.001173470.001147570.001138020.001109610.00108770.001081840.001069140.001058780.001034260.001025830.001013320.0009957380.0009811190.0009737270.0009643580.000931030.0009215930.0009112270.0008985860.0008823440.000874990.0008578510.0008535040.0008437470.0008278790.0008145320.0008050820.0007948530.0007924450.0007815860.0007686220.000762740.0007499330.0007466370.0007354390.0007192990.0007098990.0007028080.0006952260.0006876490.0006768850.0006663980.0006534370.0006505970.0006324470.0006228210.0006158370.0006079350.00060580.0005896460.0005792610.0005767940.0005686510.0005580260.0005530010.0005361240.0005221280.0005169230.0005129870.0005016450.0005005520.0004867270.0004793560.0004707610.0004659230.0004600790.0004549620.0004482580.0004425630.0004384390.0004182180.0004141420.0004083520.0003950540.000392570.0003812410.0003724220.0003662530.000359410.0003539580.0003466370.0003453670.0003361080.0003287240.0003244750.0003140680.0003074150.0002973860.0002875280.0002792770.0002760.0002684150.0002657160.0002574760.0002463840.0002397520.000232360.0002251660.0002158250.0002073340.0002056360.0001940020.0001896260.0001815480.0001750820.0001672760.0001545410.0001529930.0001468150.0001344380.0001294530.0001221540.0001138740.0001091720.0001017719.86451e-59.46115e-58.18943e-57.41208e-56.04935e-55.42601e-55.01811e-53.68342e-53.12112e-52.70286e-52.19542e-51.32832e-58.56768e-63.34723e-16
210.806760.02629530.02220410.01589410.01279220.01054210.009692210.008813560.008411070.008104390.007601080.007345460.006771070.006751010.006367590.005824770.005719420.005413950.005102910.005054690.00471510.004645970.00443070.004123680.00408240.003824880.003802990.003645440.003513930.003473840.003314840.003293490.003151310.003045580.002997530.002901550.002740790.002679310.002571120.002500990.002458710.002432510.002402830.002369030.002284630.002265590.002223380.002142030.002023030.001955440.001917690.001889010.001835870.001803670.001750340.001721260.001681640.001678520.001635770.001610540.001564380.001524770.001500080.00146210.001425740.001416730.001410240.001398970.001370920.001363510.00131120.00130010.001287570.001272350.001250950.001224060.001218010.001203640.001172850.001166990.001150440.001128320.001109370.001105660.001097640.001081990.001066350.001048630.001032240.001023710.00100320.0009967390.0009753970.0009671710.0009590320.0009530950.0009423490.0009306350.0009208690.000901330.0008969780.0008945980.0008803960.0008721250.000859480.0008328970.0008190510.000814290.0008011670.0007871460.0007737120.0007680680.0007532030.0007478840.0007297650.0007206380.000709480.0006982830.0006869710.000677550.0006696780.0006575070.0006537040.0006501610.0006345610.0006215740.0006166830.0006014570.0005994740.0005887890.0005792670.0005750260.000561450.0005552880.0005455650.0005385280.0005343720.0005168420.0005031970.0005017870.0004934890.0004836230.0004731190.0004659850.0004571610.0004521860.0004385570.000431790.0004138080.0004113940.0004013470.0003897140.0003875320.0003827620.0003711690.0003599160.0003440230.000338950.0003356520.0003277310.0003181040.0003132360.0003038610.0003002190.0002891240.0002778470.0002727050.0002596570.0002576590.0002444080.0002357990.0002337960.0002247910.0002177130.0002097770.0002057330.0001826590.0001764720.0001686980.0001641220.0001550.0001521390.0001409260.0001325230.0001268330.0001191640.0001118640.0001058789.48576e-57.98109e-57.73623e-57.41885e-55.6716e-54.95331e-53.81919e-53.02685e-52.70465e-51.70699e-55.12223e-63.56071e-16
310.8073310.02630520.02219390.01589280.01277590.01051010.009686090.008800190.008401730.008111820.007580820.007328660.006746850.006735950.0063330.005789790.005653630.005429150.005115950.005025220.004710150.004619190.004449550.00412110.004038150.003819490.003770560.003624760.003501550.003461350.003274970.003245350.003167240.003045910.003015110.00289090.002751730.002679260.002567080.002488130.002435860.00240360.002361950.00233660.002290570.002217970.002195240.002083560.001987460.001917990.001895780.001867780.001829110.001778850.001736250.001714490.001637860.001620340.001603810.001570190.001523190.001488840.001465130.001447840.001395420.00138330.001375310.001373080.001332010.001322210.00129520.001284630.001262950.001230850.001223650.001197380.001158810.001154570.001136840.001125680.001116280.001103210.001083890.001072250.001063290.001062310.001041430.001021510.001007640.0009955950.0009831080.000974880.0009472210.0009388150.0009317420.0009243930.0009052690.000902820.0008775450.0008737230.0008625640.0008531720.0008438890.0008381760.0008232340.0008113080.0008009230.0007988050.0007864340.0007648820.0007582580.0007564760.0007413370.0007321460.0007244250.0007131870.0006996130.000675440.0006728320.0006620720.0006513260.0006477630.0006387260.000633640.0006232330.0006114350.0005964180.00058540.0005715490.0005624610.0005527410.0005435690.000541010.0005361470.0005311070.0005114790.0005061570.0004999680.0004934810.0004833280.0004781480.0004691910.0004611150.0004500920.0004491060.0004314640.0004170960.0004109050.0004089560.0004015190.0003863540.0003829670.0003748740.0003741760.000357720.0003524590.0003417690.0003384240.0003273810.0003192020.0003149520.000303160.0002980750.0002864140.000282640.0002786780.0002736980.0002624840.000256390.000246860.000232040.0002297870.0002259480.0002198590.0002084680.0001988120.0001783840.0001750950.0001686610.0001584760.0001519870.0001394280.0001348350.0001317480.000123320.0001123540.0001071349.44475e-58.85095e-58.49721e-57.36481e-56.39981e-55.58528e-54.52237e-53.86871e-52.70101e-51.695e-51.37046e-56.3018e-63.41281e-16
" ], "text/latex": [ "\\begin{tabular}{r|ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}\n", "\t& Column1 & Column2 & Column3 & Column4 & Column5 & Column6 & Column7 & Column8 & Column9 & Column10 & Column11 & Column12 & Column13 & Column14 & Column15 & Column16 & Column17 & Column18 & Column19 & Column20 & Column21 & Column22 & Column23 & Column24 & Column25 & Column26 & Column27 & Column28 & Column29 & Column30 & Column31 & Column32 & Column33 & Column34 & Column35 & Column36 & Column37 & Column38 & Column39 & Column40 & Column41 & Column42 & Column43 & Column44 & Column45 & Column46 & Column47 & Column48 & Column49 & Column50 & Column51 & Column52 & Column53 & Column54 & Column55 & Column56 & Column57 & Column58 & Column59 & Column60 & Column61 & Column62 & Column63 & Column64 & Column65 & Column66 & Column67 & Column68 & Column69 & Column70 & Column71 & Column72 & Column73 & Column74 & Column75 & Column76 & Column77 & Column78 & Column79 & Column80 & Column81 & Column82 & Column83 & Column84 & Column85 & Column86 & Column87 & Column88 & Column89 & Column90 & Column91 & Column92 & Column93 & Column94 & Column95 & Column96 & Column97 & Column98 & Column99 & Column100 & Column101 & Column102 & Column103 & Column104 & Column105 & Column106 & Column107 & Column108 & Column109 & Column110 & Column111 & Column112 & Column113 & Column114 & Column115 & Column116 & Column117 & Column118 & Column119 & Column120 & Column121 & Column122 & Column123 & Column124 & Column125 & Column126 & Column127 & Column128 & Column129 & Column130 & Column131 & Column132 & Column133 & Column134 & Column135 & Column136 & Column137 & Column138 & Column139 & Column140 & Column141 & Column142 & Column143 & Column144 & Column145 & Column146 & Column147 & Column148 & Column149 & Column150 & Column151 & Column152 & Column153 & Column154 & Column155 & Column156 & Column157 & Column158 & Column159 & Column160 & Column161 & Column162 & Column163 & Column164 & Column165 & Column166 & Column167 & Column168 & Column169 & Column170 & Column171 & Column172 & Column173 & Column174 & Column175 & Column176 & Column177 & Column178 & Column179 & Column180 & Column181 & Column182 & Column183 & Column184 & Column185 & Column186 & Column187 & Column188 & Column189 & Column190 & Column191 & Column192 & Column193 & Column194 & Column195 & Column196 & Column197 & Column198 & Column199 & Column200 & Column201\\\\\n", "\t\\hline\n", "\t& Int64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰ & Float64⍰\\\\\n", "\t\\hline\n", "\t1 & 1 & 0.808874 & 0.0262689 & 0.0222177 & 0.015871 & 0.0128175 & 0.0104919 & 0.00962279 & 0.00881732 & 0.00835705 & 0.0080237 & 0.00758001 & 0.00727214 & 0.00676085 & 0.00669725 & 0.00631513 & 0.0057416 & 0.00562775 & 0.00539497 & 0.00510166 & 0.00492374 & 0.00467361 & 0.00458811 & 0.0044562 & 0.00411901 & 0.00403369 & 0.00376357 & 0.00372016 & 0.00352432 & 0.00341907 & 0.00333317 & 0.00327488 & 0.00317714 & 0.00311201 & 0.00302701 & 0.00295915 & 0.00279215 & 0.00273365 & 0.00262662 & 0.00250085 & 0.00245776 & 0.00239391 & 0.00233999 & 0.00232316 & 0.00223765 & 0.00218995 & 0.00211919 & 0.00211193 & 0.00200817 & 0.0019619 & 0.00184026 & 0.00180769 & 0.00178557 & 0.00175334 & 0.00169991 & 0.00169088 & 0.00163803 & 0.0015943 & 0.00153768 & 0.00152212 & 0.00149889 & 0.00145391 & 0.00143926 & 0.00139877 & 0.00135952 & 0.00133242 & 0.0012918 & 0.00126177 & 0.00124307 & 0.00123211 & 0.00120788 & 0.00118831 & 0.00117347 & 0.00114757 & 0.00113802 & 0.00110961 & 0.0010877 & 0.00108184 & 0.00106914 & 0.00105878 & 0.00103426 & 0.00102583 & 0.00101332 & 0.000995738 & 0.000981119 & 0.000973727 & 0.000964358 & 0.00093103 & 0.000921593 & 0.000911227 & 0.000898586 & 0.000882344 & 0.00087499 & 0.000857851 & 0.000853504 & 0.000843747 & 0.000827879 & 0.000814532 & 0.000805082 & 0.000794853 & 0.000792445 & 0.000781586 & 0.000768622 & 0.00076274 & 0.000749933 & 0.000746637 & 0.000735439 & 0.000719299 & 0.000709899 & 0.000702808 & 0.000695226 & 0.000687649 & 0.000676885 & 0.000666398 & 0.000653437 & 0.000650597 & 0.000632447 & 0.000622821 & 0.000615837 & 0.000607935 & 0.0006058 & 0.000589646 & 0.000579261 & 0.000576794 & 0.000568651 & 0.000558026 & 0.000553001 & 0.000536124 & 0.000522128 & 0.000516923 & 0.000512987 & 0.000501645 & 0.000500552 & 0.000486727 & 0.000479356 & 0.000470761 & 0.000465923 & 0.000460079 & 0.000454962 & 0.000448258 & 0.000442563 & 0.000438439 & 0.000418218 & 0.000414142 & 0.000408352 & 0.000395054 & 0.00039257 & 0.000381241 & 0.000372422 & 0.000366253 & 0.00035941 & 0.000353958 & 0.000346637 & 0.000345367 & 0.000336108 & 0.000328724 & 0.000324475 & 0.000314068 & 0.000307415 & 0.000297386 & 0.000287528 & 0.000279277 & 0.000276 & 0.000268415 & 0.000265716 & 0.000257476 & 0.000246384 & 0.000239752 & 0.00023236 & 0.000225166 & 0.000215825 & 0.000207334 & 0.000205636 & 0.000194002 & 0.000189626 & 0.000181548 & 0.000175082 & 0.000167276 & 0.000154541 & 0.000152993 & 0.000146815 & 0.000134438 & 0.000129453 & 0.000122154 & 0.000113874 & 0.000109172 & 0.000101771 & 9.86451e-5 & 9.46115e-5 & 8.18943e-5 & 7.41208e-5 & 6.04935e-5 & 5.42601e-5 & 5.01811e-5 & 3.68342e-5 & 3.12112e-5 & 2.70286e-5 & 2.19542e-5 & 1.32832e-5 & 8.56768e-6 & 3.34723e-16 \\\\\n", "\t2 & 1 & 0.80676 & 0.0262953 & 0.0222041 & 0.0158941 & 0.0127922 & 0.0105421 & 0.00969221 & 0.00881356 & 0.00841107 & 0.00810439 & 0.00760108 & 0.00734546 & 0.00677107 & 0.00675101 & 0.00636759 & 0.00582477 & 0.00571942 & 0.00541395 & 0.00510291 & 0.00505469 & 0.0047151 & 0.00464597 & 0.0044307 & 0.00412368 & 0.0040824 & 0.00382488 & 0.00380299 & 0.00364544 & 0.00351393 & 0.00347384 & 0.00331484 & 0.00329349 & 0.00315131 & 0.00304558 & 0.00299753 & 0.00290155 & 0.00274079 & 0.00267931 & 0.00257112 & 0.00250099 & 0.00245871 & 0.00243251 & 0.00240283 & 0.00236903 & 0.00228463 & 0.00226559 & 0.00222338 & 0.00214203 & 0.00202303 & 0.00195544 & 0.00191769 & 0.00188901 & 0.00183587 & 0.00180367 & 0.00175034 & 0.00172126 & 0.00168164 & 0.00167852 & 0.00163577 & 0.00161054 & 0.00156438 & 0.00152477 & 0.00150008 & 0.0014621 & 0.00142574 & 0.00141673 & 0.00141024 & 0.00139897 & 0.00137092 & 0.00136351 & 0.0013112 & 0.0013001 & 0.00128757 & 0.00127235 & 0.00125095 & 0.00122406 & 0.00121801 & 0.00120364 & 0.00117285 & 0.00116699 & 0.00115044 & 0.00112832 & 0.00110937 & 0.00110566 & 0.00109764 & 0.00108199 & 0.00106635 & 0.00104863 & 0.00103224 & 0.00102371 & 0.0010032 & 0.000996739 & 0.000975397 & 0.000967171 & 0.000959032 & 0.000953095 & 0.000942349 & 0.000930635 & 0.000920869 & 0.00090133 & 0.000896978 & 0.000894598 & 0.000880396 & 0.000872125 & 0.00085948 & 0.000832897 & 0.000819051 & 0.00081429 & 0.000801167 & 0.000787146 & 0.000773712 & 0.000768068 & 0.000753203 & 0.000747884 & 0.000729765 & 0.000720638 & 0.00070948 & 0.000698283 & 0.000686971 & 0.00067755 & 0.000669678 & 0.000657507 & 0.000653704 & 0.000650161 & 0.000634561 & 0.000621574 & 0.000616683 & 0.000601457 & 0.000599474 & 0.000588789 & 0.000579267 & 0.000575026 & 0.00056145 & 0.000555288 & 0.000545565 & 0.000538528 & 0.000534372 & 0.000516842 & 0.000503197 & 0.000501787 & 0.000493489 & 0.000483623 & 0.000473119 & 0.000465985 & 0.000457161 & 0.000452186 & 0.000438557 & 0.00043179 & 0.000413808 & 0.000411394 & 0.000401347 & 0.000389714 & 0.000387532 & 0.000382762 & 0.000371169 & 0.000359916 & 0.000344023 & 0.00033895 & 0.000335652 & 0.000327731 & 0.000318104 & 0.000313236 & 0.000303861 & 0.000300219 & 0.000289124 & 0.000277847 & 0.000272705 & 0.000259657 & 0.000257659 & 0.000244408 & 0.000235799 & 0.000233796 & 0.000224791 & 0.000217713 & 0.000209777 & 0.000205733 & 0.000182659 & 0.000176472 & 0.000168698 & 0.000164122 & 0.000155 & 0.000152139 & 0.000140926 & 0.000132523 & 0.000126833 & 0.000119164 & 0.000111864 & 0.000105878 & 9.48576e-5 & 7.98109e-5 & 7.73623e-5 & 7.41885e-5 & 5.6716e-5 & 4.95331e-5 & 3.81919e-5 & 3.02685e-5 & 2.70465e-5 & 1.70699e-5 & 5.12223e-6 & 3.56071e-16 \\\\\n", "\t3 & 1 & 0.807331 & 0.0263052 & 0.0221939 & 0.0158928 & 0.0127759 & 0.0105101 & 0.00968609 & 0.00880019 & 0.00840173 & 0.00811182 & 0.00758082 & 0.00732866 & 0.00674685 & 0.00673595 & 0.006333 & 0.00578979 & 0.00565363 & 0.00542915 & 0.00511595 & 0.00502522 & 0.00471015 & 0.00461919 & 0.00444955 & 0.0041211 & 0.00403815 & 0.00381949 & 0.00377056 & 0.00362476 & 0.00350155 & 0.00346135 & 0.00327497 & 0.00324535 & 0.00316724 & 0.00304591 & 0.00301511 & 0.0028909 & 0.00275173 & 0.00267926 & 0.00256708 & 0.00248813 & 0.00243586 & 0.0024036 & 0.00236195 & 0.0023366 & 0.00229057 & 0.00221797 & 0.00219524 & 0.00208356 & 0.00198746 & 0.00191799 & 0.00189578 & 0.00186778 & 0.00182911 & 0.00177885 & 0.00173625 & 0.00171449 & 0.00163786 & 0.00162034 & 0.00160381 & 0.00157019 & 0.00152319 & 0.00148884 & 0.00146513 & 0.00144784 & 0.00139542 & 0.0013833 & 0.00137531 & 0.00137308 & 0.00133201 & 0.00132221 & 0.0012952 & 0.00128463 & 0.00126295 & 0.00123085 & 0.00122365 & 0.00119738 & 0.00115881 & 0.00115457 & 0.00113684 & 0.00112568 & 0.00111628 & 0.00110321 & 0.00108389 & 0.00107225 & 0.00106329 & 0.00106231 & 0.00104143 & 0.00102151 & 0.00100764 & 0.000995595 & 0.000983108 & 0.00097488 & 0.000947221 & 0.000938815 & 0.000931742 & 0.000924393 & 0.000905269 & 0.00090282 & 0.000877545 & 0.000873723 & 0.000862564 & 0.000853172 & 0.000843889 & 0.000838176 & 0.000823234 & 0.000811308 & 0.000800923 & 0.000798805 & 0.000786434 & 0.000764882 & 0.000758258 & 0.000756476 & 0.000741337 & 0.000732146 & 0.000724425 & 0.000713187 & 0.000699613 & 0.00067544 & 0.000672832 & 0.000662072 & 0.000651326 & 0.000647763 & 0.000638726 & 0.00063364 & 0.000623233 & 0.000611435 & 0.000596418 & 0.0005854 & 0.000571549 & 0.000562461 & 0.000552741 & 0.000543569 & 0.00054101 & 0.000536147 & 0.000531107 & 0.000511479 & 0.000506157 & 0.000499968 & 0.000493481 & 0.000483328 & 0.000478148 & 0.000469191 & 0.000461115 & 0.000450092 & 0.000449106 & 0.000431464 & 0.000417096 & 0.000410905 & 0.000408956 & 0.000401519 & 0.000386354 & 0.000382967 & 0.000374874 & 0.000374176 & 0.00035772 & 0.000352459 & 0.000341769 & 0.000338424 & 0.000327381 & 0.000319202 & 0.000314952 & 0.00030316 & 0.000298075 & 0.000286414 & 0.00028264 & 0.000278678 & 0.000273698 & 0.000262484 & 0.00025639 & 0.00024686 & 0.00023204 & 0.000229787 & 0.000225948 & 0.000219859 & 0.000208468 & 0.000198812 & 0.000178384 & 0.000175095 & 0.000168661 & 0.000158476 & 0.000151987 & 0.000139428 & 0.000134835 & 0.000131748 & 0.00012332 & 0.000112354 & 0.000107134 & 9.44475e-5 & 8.85095e-5 & 8.49721e-5 & 7.36481e-5 & 6.39981e-5 & 5.58528e-5 & 4.52237e-5 & 3.86871e-5 & 2.70101e-5 & 1.695e-5 & 1.37046e-5 & 6.3018e-6 & 3.41281e-16 \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "3×201 DataFrame. Omitted printing of 195 columns\n", "│ Row │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6 │\n", "│ │ \u001b[90mInt64⍰\u001b[39m │ \u001b[90mFloat64⍰\u001b[39m │ \u001b[90mFloat64⍰\u001b[39m │ \u001b[90mFloat64⍰\u001b[39m │ \u001b[90mFloat64⍰\u001b[39m │ \u001b[90mFloat64⍰\u001b[39m │\n", "├─────┼─────────┼──────────┼───────────┼───────────┼───────────┼───────────┤\n", "│ 1 │ 1 │ 0.808874 │ 0.0262689 │ 0.0222177 │ 0.015871 │ 0.0128175 │\n", "│ 2 │ 1 │ 0.80676 │ 0.0262953 │ 0.0222041 │ 0.0158941 │ 0.0127922 │\n", "│ 3 │ 1 │ 0.807331 │ 0.0263052 │ 0.0221939 │ 0.0158928 │ 0.0127759 │" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataset_train = CSV.read(\"$data_filename.train\", nastrings=[\"NA\", \"na\", \"n/a\", \"missing\"], delim=';', header=0)\n", "dataset_test = CSV.read(\"$data_filename.test\", nastrings=[\"NA\", \"na\", \"n/a\", \"missing\"], delim=';', header=0)\n", "first(dataset_train, 3)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Split datasets done.." ] } ], "source": [ "nb_columns = size(dataset_train, 2)\n", "train_labels = dataset_train[1]\n", "train_data = dataset_train[2:nb_columns]\n", "print(\"Split datasets done..\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "597" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "noisy_df_train = filter(row -> row[1] == 1, dataset_train)\n", "not_noisy_df_train = filter(row -> row[1] == 0, dataset_train)\n", "nb_noisy_train = size(noisy_df_train, 1)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "357" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "noisy_df_test = filter(row -> row[1] == 1, dataset_test)\n", "not_noisy_df_test = filter(row -> row[1] == 0, dataset_test)\n", "nb_noisy_test = size(noisy_df_test, 1)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "All datasets filled" ] } ], "source": [ "#final_df_train = join(not_noisy_df_train[1:nb_noisy_train, :], noisy_df_train, kind=:outer, makeunique=true)\n", "final_df_train = append!(noisy_df_train, not_noisy_df_train[1:nb_noisy_train, :])\n", "final_df_test = append!(noisy_df_test, not_noisy_df_test[1:nb_noisy_test, :])\n", "print(\"All datasets filled\")\n", "# TODO : See how it's possible to shuffler the whole dataframes\n", "# py\"shuffle\"(final_df_train)\n", "# py\"shuffle\"(final_df_test)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Labels and data split" ] } ], "source": [ "x_dataset_train = Array{Float64,2}(final_df_train[2:nb_columns])\n", "x_dataset_test = Array{Float64,2}(final_df_test[2:nb_columns])\n", "\n", "y_dataset_train = Array{Int64,1}(final_df_train[1])\n", "y_dataset_test = Array{Int64,1}(final_df_test[1])\n", "print(\"Labels and data split\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Train part using SkLearn" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "┌ Warning: `getindex(o::PyObject, s::Symbol)` is deprecated in favor of dot overloading (`getproperty`) so elements should now be accessed as e.g. `o.s` instead of `o[:s]`.\n", "│ caller = top-level scope at Skcore.jl:158\n", "└ @ Core /home/jbuisine/.julia/packages/ScikitLearn/HK6Vs/src/Skcore.jl:158\n", "WARNING: redefining constant SVC\n" ] }, { "data": { "text/plain": [ "PyObject " ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "using ScikitLearn\n", "using ScikitLearn.GridSearch: GridSearchCV\n", "@sk_import svm: SVC" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Best parameters: Dict{Symbol,Any}(:gamma=>100.0,:C=>1000.0)\n" ] } ], "source": [ "Cs = [0.001, 0.01, 0.1, 1, 10, 100, 1000]\n", "gammas = [0.001, 0.01, 0.1, 1, 5, 10, 100]\n", "param_grid = Dict(:C => Cs, :gamma => gammas)\n", "\n", "gridsearch = GridSearchCV(SVC(), param_grid)\n", "fit!(gridsearch, x_dataset_train, y_dataset_train)\n", "println(\"Best parameters: $(gridsearch.best_params_)\")" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Train score : 0.9782244556113903\n", "Test score : 0.5854341736694678" ] } ], "source": [ "train_score = score(gridsearch, x_dataset_train, y_dataset_train)\n", "test_score = score(gridsearch, x_dataset_test, y_dataset_test)\n", "print(\"Train score : $(train_score)\\n\")\n", "print(\"Test score : $(test_score)\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.1.0", "language": "julia", "name": "julia-1.1" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.1.0" } }, "nbformat": 4, "nbformat_minor": 2 }