Giter Club home page Giter Club logo

Comments (13)

akol67 avatar akol67 commented on May 29, 2024

Just want to compare with other SOM results

from susi.

felixriese avatar felixriese commented on May 29, 2024

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.

from susi.

akol67 avatar akol67 commented on May 29, 2024

from susi.

felixriese avatar felixriese commented on May 29, 2024

Thanks, I will implement it and will keep you updated!

from susi.

felixriese avatar felixriese commented on May 29, 2024

@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.

from susi.

akol67 avatar akol67 commented on May 29, 2024

from susi.

akol67 avatar akol67 commented on May 29, 2024

from susi.

felixriese avatar felixriese commented on May 29, 2024

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.

  1. The way the learning rate etc. is set up, the number of iterations does not need to be optimized that much. Therefore, I had no need for error metrics so far.
  2. The package is mostly used in(semi-) supervised learning where you get classification/regression quality metrics. They are also very helpful for the training.

from susi.

akol67 avatar akol67 commented on May 29, 2024

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) 

from susi.

felixriese avatar felixriese commented on May 29, 2024

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

from susi.

felixriese avatar felixriese commented on May 29, 2024

Hi @akol67, Did you check the latest update? Does it work for you?

from susi.

akol67 avatar akol67 commented on May 29, 2024

from susi.

felixriese avatar felixriese commented on May 29, 2024

Thanks, I added it to the list!

from susi.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.