Closed akol67 closed 3 years ago
Hi @akol67 ,
Are we talking about unsupervised learning or supervised? If supervised, then classification?
After quick research, it seems that a quantization error can be implemented very easily. Please give me more information on how you define it, for what you would like to use et etc.
Dear Félix
Thanks for replying me.
Yes, we are doing supervised prediction. As labels we import K-means results from SOMPY. Since there (SOMPY) I have control of quantization and topographic error I want the same control here.
So far métrics like recall, precision are high enough. Just need to know if SOM errors are small too, as in SOMPY results.
Data are seismic geométric attributes. Looking for faults.
Regards
Alexandre Sênior geophysicist
Em seg., 6 de set. de 2021 às 06:15, Dr. Felix M. Riese < @.***> escreveu:
Hi @akol67 https://github.com/akol67 ,
Are we talking about unsupervised learning or supervised? If supervised, then classification?
After quick research, it seems that a quantization error can be implemented very easily. Please give me more information on how you define it, for what you would like to use et etc.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/felixriese/susi/issues/25#issuecomment-913486908, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3MX6SYVDIOKBOY7SK5LL3UASBB5ANCNFSM5C3ZYTYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Att Alexandre Kolisnyk
Thanks, I will implement it and will keep you updated!
@akol67 Please update your SuSi package:
pip uninstall susi
git clone https://github.com/felixriese/susi.git
cd susi/
git checkout quanti-error
python setup.py install
And then please test the new function som.som.get_quantization_error()
. If it works fine, I will merge it to main.
Thank you. In the next days I going to test it.
And about topographic error? In Sompy package It´s often more relevant than low quantization to select a good size map, when inside a loop for.
In fact I was surprised when I saw there was no error metric in your SOM package. How do you know your iterations are big enough?
Em ter., 14 de set. de 2021 às 11:49, Dr. Felix M. Riese < @.***> escreveu:
@akol67 https://github.com/akol67 Please update your SuSi package:
pip uninstall susi git clone https://github.com/felixriese/susi.gitcd susi/ git checkout quanti-error python setup.py install
And then please test the new function som.som.get_quantization_error(). If it works fine, I will merge it to main.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/felixriese/susi/issues/25#issuecomment-919225309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3MX6SWLKVR6HKF2HH3EM3UB5OI5ANCNFSM5C3ZYTYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Att Alexandre Kolisnyk
It not working.When coding...is that below right?
import susi
som_superv = susi.SOMClassifier( n_rows= siz1, n_columns= siz2, n_iter_unsupervised= n_epocas, n_iter_supervised= n_epocas, missing_label_placeholder=-1, random_state=42, verbose=1, n_jobs=1)
[image: image.png]
Em ter., 14 de set. de 2021 às 11:49, Dr. Felix M. Riese < @.***> escreveu:
@akol67 https://github.com/akol67 Please update your SuSi package:
pip uninstall susi git clone https://github.com/felixriese/susi.gitcd susi/ git checkout quanti-error python setup.py install
And then please test the new function som.som.get_quantization_error(). If it works fine, I will merge it to main.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/felixriese/susi/issues/25#issuecomment-919225309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3MX6SWLKVR6HKF2HH3EM3UB5OI5ANCNFSM5C3ZYTYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Att Alexandre Kolisnyk
About your error: Thanks for testing. I don't see the image, though. Please paste your error message here. What can be missing is som.fit(X)
before you calculate any error.
About the topographic error: Feel free to fork the repository, implement the topographic error, and create a pull request. That would be the easiest solution.
About how to train without error metric: There are several aspects to consider.
Hi Felix,
Fit was already done before. Seems to me there is something wrong when using semisupervised and supervised. It works fine if we use unlabeled_size = 0. Below is with unlabeled_size not equal zero.
unlabeled_size = 0.8
rng = np.random.RandomState(42)
random_unlabeled_points = rng.rand(len(y_train)) < unlabeled_size
y_train[random_unlabeled_points] = -1
print("Datapoints for training with label (supervised):\t", y_train.shape[0])
print("Datapoints for training with label (semi-supervised):\t", np.sum(y_train != -1))
print("Datapoints for testing:\t\t\t\t\t", y_test.shape[0])
>Datapoints for training with label (supervised): 6012
>Datapoints for training with label (semi-supervised): 1203
>Datapoints for testing: 2577
som_superv = susi.SOMClassifier(
n_rows= siz1,
n_columns= siz2,
n_iter_unsupervised= n_epocas,
n_iter_supervised= n_epocas,
missing_label_placeholder=-1,
random_state=42,
verbose=1,
n_jobs=1)
som_superv.fit(data_train, y_train)
print("Training:"+str(som_superv.score(data_train,y_train)))
print("Test:"+str(som_superv.score(data_test,y_test)))
y_pred = som_superv.predict(data_test)
y_pred_proba = som_superv.predict_proba(data_test)
>Training:0.18196939454424485
>Test:0.9064804035700427
som_superv.get_quantization_error()
>---------------------------------------------------------------------------
>ValueError Traceback (most recent call last)
<ipython-input-36-58ee03585184> in <module>
>----> 1 som_superv.get_quantization_error()
>~/anaconda3/lib/python3.8/site-packages/susi-1.2-py3.8.egg/susi/SOMClustering.py in get_quantization_error(self)
> 954
> 955 quantization_errors = np.linalg.norm(
--> 956 np.subtract(weights_per_datapoint, self.X_)
> 957 )
> 958
>ValueError: operands could not be broadcast together with shapes (1203,4) (6012,4)
Thanks!
I fixed a bug, see #26. Please do the following before you run your code again within the susi
folder:
pip uninstall susi
git pull
python setup.py install
Hi @akol67, Did you check the latest update? Does it work for you?
Hi Dr. Felix
It's working. Hopefully some day you will put topographic error as well.
Thanks for our conversation
Alexandre
Em ter., 14 de set. de 2021 às 11:49, Dr. Felix M. Riese < @.***> escreveu:
@akol67 https://github.com/akol67 Please update your SuSi package:
pip uninstall susi git clone https://github.com/felixriese/susi.gitcd susi/ git checkout quanti-error python setup.py install
And then please test the new function som.som.get_quantization_error(). If it works fine, I will merge it to main.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/felixriese/susi/issues/25#issuecomment-919225309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3MX6SWLKVR6HKF2HH3EM3UB5OI5ANCNFSM5C3ZYTYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Att Alexandre Kolisnyk
Thanks, I added it to the list!
Just want to compare with other SOM results