tag:blogger.com,1999:blog-1693014329567144872.comments2023-08-27T06:49:20.658+01:00The Glowing PythonJustGlowinghttp://www.blogger.com/profile/17212021288715206641noreply@blogger.comBlogger918125tag:blogger.com,1999:blog-1693014329567144872.post-65893238247731804062022-07-19T23:18:46.674+01:002022-07-19T23:18:46.674+01:00It seems that the code is calculating log(average ...It seems that the code is calculating log(average of pairwise distance), vs the paper (https://hastie.su.domains/Papers/gap.pdf) is calculating average(log of W), where W is the sum of square pairwise distance divided by 2*size of the clusters. Dannoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-83606130164914999362022-02-24T20:21:50.493+00:002022-02-24T20:21:50.493+00:00Bonjour , je suis mathematicien et dissinateur pro...Bonjour , je suis mathematicien et dissinateur professionnel,je me demande pourquoi toujours ,un zp[i]=wa[i] , qui est un point fixe . Aussi un zp[i] qui une translation d'un wa[i] .<br /><br />Le choix de zp[i] influence-t-il le resultat , pour une meme fonction de mobuis ?Pascal matetehttps://www.blogger.com/profile/11730657270930109448noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-17865349782731818762022-01-27T17:09:05.200+00:002022-01-27T17:09:05.200+00:00This is what I needed. With a few tweaks I was abl...This is what I needed. With a few tweaks I was able to extend the function to handle colormaps. Thank you for posting this!philipnelson5https://www.blogger.com/profile/02932563599593820449noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-40994885366968730502022-01-21T07:42:42.477+00:002022-01-21T07:42:42.477+00:00this example was written using python 2 and urllib...this example was written using python 2 and urllib2 doesn't exist in python 3. You need to use urllib.requestJustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-41353871811905150702022-01-21T06:58:07.275+00:002022-01-21T06:58:07.275+00:00Hello sir, im getting the following error. Could y...Hello sir, im getting the following error. Could you please help?<br />ModuleNotFoundError: No module named 'urllib2'<br /><br />i have tried to install the it on cmd but it throws the following error<br />ERROR: Could not find a version that satisfies the requirement urllib2 (from versions: none)<br />ERROR: No matching distribution found for urllib2<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-10130431417652205432021-11-22T07:44:33.365+00:002021-11-22T07:44:33.365+00:00hi there, the second example in this post shows ex...hi there, the second example in this post shows exactly that.JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-41732047854817931062021-11-22T05:17:00.612+00:002021-11-22T05:17:00.612+00:00hi! I was wondering if it's possible to draw a...hi! I was wondering if it's possible to draw a tangent line on a given graph? So basically is there a way to plot a tangent line without knowing the function of the original graph?Anonymoushttps://www.blogger.com/profile/00418129150790631425noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-19815637099526354292021-08-24T09:59:11.789+01:002021-08-24T09:59:11.789+01:00This comment has been removed by a blog administrator.Pagerankhttps://0art5.blogspot.com/2021/05/pagerank-google-ranking-banner-for-your.htmlnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-52041235147157854162021-07-21T04:05:02.857+01:002021-07-21T04:05:02.857+01:00Thank you so much for this tutorial. Using native ...Thank you so much for this tutorial. Using native matplotlib provides great flexibility for customization.arteagachttps://www.blogger.com/profile/15995432326465513553noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-26097823644622820002021-06-29T18:14:17.046+01:002021-06-29T18:14:17.046+01:00hi there, MiniSom is trained on a single sample at...hi there, MiniSom is trained on a single sample at each iteration. If you have 100 samples and perform 20 iterations, only part of them is used.<br /><br />Please, use GitHub for questions on MiniSom.<br /><br />https://github.com/JustGlowing/minisomJustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-66987965596961783652021-06-29T17:45:11.942+01:002021-06-29T17:45:11.942+01:00Hi! I am an undergrad who's trying to write a ...Hi! I am an undergrad who's trying to write a thesis on SOM modifications based on your miniSOM. I have a few questions if you don't mind:<br /><br />Looking at the code in train() method, it seems the variable "iteration" takes values from 1 to iteration (say 20) only, and then you access data with "data[iteration]". So it doesn't access all of the data? How does the training process work?<br /><br />Also, the only difference between train() and train_batch() seems to be random_order=False, so I'd like to ask you how the batch learning is conducted as well - at the moment I don't quite see how. Sorry for the long message and have a nice week ahead!Anonymoushttps://www.blogger.com/profile/05426004193181968983noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-57500687495251634012021-06-09T21:52:48.810+01:002021-06-09T21:52:48.810+01:00Code did not work : Modified som.weights to som._w...Code did not work : Modified som.weights to som._weights and also had to change the target definitions <br /><br />from pylab import plot,axis,show,pcolor,colorbar,bone<br />bone()<br />pcolor(som.distance_map().T) # distance map as background<br />colorbar()<br /><br /># loading the labels<br />target = genfromtxt('iris-dataset.csv', delimiter=',',usecols=(4),dtype=str)<br /><br />t = zeros(len(target),dtype=int)<br /><br />t[target=='Iris-setosa'] = 0<br />t[target=='Iris-versicolor'] = 1<br />t[target=='Iris-virginica'] = 2<br /><br /># use different colors and markers for each label<br />markers = ['o','s','D']<br />colors = ['r','g','b']<br /><br />for cnt,xx in enumerate(data):<br /> w = som.winner(xx) # getting the winner<br /> # place a marker on the winning position for the sample xx<br /> plot(w[0]+.5,w[1]+.5,markers[t[cnt]],markerfacecolor='None', <br /> markeredgecolor=colors[t[cnt]],markersize=12,markeredgewidth=2)<br /> <br />axis([0,som._weights.shape[0],0,som._weights.shape[1]])<br />show() # show the figure<br /><br />Many many thanks! Great work Sir!Anonymoushttps://www.blogger.com/profile/04584672334270856672noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-85421713196846830272021-06-04T17:21:12.551+01:002021-06-04T17:21:12.551+01:00It will be very helpful if u provide the source co...It will be very helpful if u provide the source code for classification and dimensionality reduction of images(not numericals) using SOM and store that result in a format accepted by general MLP.Anonymoushttps://www.blogger.com/profile/17260760712421996207noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-28381376058470558992021-05-04T08:33:18.112+01:002021-05-04T08:33:18.112+01:00Glad it helped!Glad it helped!JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-4644826094021218072021-05-04T08:29:07.578+01:002021-05-04T08:29:07.578+01:00Thank you for your answer.
you are are right, when...Thank you for your answer.<br />you are are right, when the curved in well "elbow shaped", it works, because it is an easy case where the data are not blured. But it seems to me gap statistics is sophisticated enough to target more complicated cases.<br />If you reduce the number of data per cluster, or increase the cluster_std, you might obtain elbows not so prominent. However, looking directly at the data will allow your eye to distinguish the clusters easily. The last term in "Gapk(k) >= Gap(k+1) - sk+1." seems to be the keystone of gap statistics, in enabling the algo to precisely distinguish clusters when they are a bit blured.<br />The meaning of this last term was not easy to get (for me, at least). Reading the answer on the following forum helped me a lot : https://stats.stackexchange.com/questions/95290/how-should-i-interpret-gap-statistic<br />Anyway, thank you very much for your article !Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-69333484575731238802021-05-03T18:51:23.760+01:002021-05-03T18:51:23.760+01:00Assuming that the curve is elbow shaped, it's ...Assuming that the curve is elbow shaped, it's the same.JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-10148638634943452042021-05-03T18:21:22.374+01:002021-05-03T18:21:22.374+01:00Thank you very much for this code and explanation ...Thank you very much for this code and explanation !<br />I have been looking at the paper you are refering to (Tibshirani et al.), and it seems your code stops too early. The papers states "Finally choose the number of clusters via k such that Gapk(k) >= Gap(k+1) - sk+1." (page 5/13). But, according to your code and explanations, the reader should only find the maximum of the gap. This seems incorrect according to Tibshirani et al.<br />BR,Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-59183465198263985652021-04-26T09:35:57.547+01:002021-04-26T09:35:57.547+01:00hi there, please check previous comments.hi there, please check previous comments.JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-61161279594380953892021-04-26T09:32:33.487+01:002021-04-26T09:32:33.487+01:00# frequencies normalization and fitering
32 ... # frequencies normalization and fitering<br /> 32 m = float(max(freq.values()))<br />---> 33 for w in freq.keys():<br /> 34 freq[w] = freq[w]/m<br /> 35 if freq[w] >= self._max_cut or freq[w] <= self._min_cut:<br /><br />RuntimeError: dictionary changed size during iterationAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-53638545256721317142021-04-12T07:50:52.855+01:002021-04-12T07:50:52.855+01:00fmin does return intermediate values, you might wa...fmin does return intermediate values, you might want to have a look at the documentation https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fmin.htmlJustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-53761127394100094202021-04-12T07:48:46.814+01:002021-04-12T07:48:46.814+01:00is there a way to get the errors for the parameter...is there a way to get the errors for the parameters in the fit from fmin?<br />Anonymoushttps://www.blogger.com/profile/15400648360362987710noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-49375968985708866832021-03-13T19:19:40.966+00:002021-03-13T19:19:40.966+00:00The method train takes in input the number of iter...The method train takes in input the number of iterations to perform.JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-2721182944450990992021-03-13T19:09:48.997+00:002021-03-13T19:09:48.997+00:00Hi, is there a way to train the SOM for several it...Hi, is there a way to train the SOM for several iterations instead of just one? Thanks! Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-74500951133837548042021-02-21T10:52:12.079+00:002021-02-21T10:52:12.079+00:00I think the reference_inertia should be log first ...I think the reference_inertia should be log first and then mean rather than mean first then log?Anonymoushttps://www.blogger.com/profile/10393911196101155557noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-67195912031029268182021-02-01T18:43:56.300+00:002021-02-01T18:43:56.300+00:00Okay, thank you very much!Okay, thank you very much!Anonymousnoreply@blogger.com