Giter Site home page Giter Site logo

dec-keras's Introduction

dec-keras's People

Contributors

fferroni avatar nadavbar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dec-keras's Issues

visualize

how can we visualize the clusters?

DEC in TensorFlow 1.3; AttributeError: can't set attribute

Thank you for posting the code! I attempted to implement your code in TF 1.3 making the following changes:

import tensorflow.contrib.keras.api.keras as K
from tensorflow.contrib.keras.api.keras.initializers import RandomNormal
from tensorflow.contrib.keras.api.keras.layers import Layer, InputSpec
from tensorflow.contrib.keras.api.keras.models import Model, Sequential
from tensorflow.contrib.keras.api.keras.layers import Dense, Dropout, Input
from tensorflow.contrib.keras.api.keras.optimizers import SGD
from tensorflow.contrib.keras.api.keras.callbacks import LearningRateScheduler
from tensorflow.contrib.keras.api.keras.backend import floatx

However, I encounter en error message pointing to line#71, which is the last line in the following:

def build(self, input_shape):
        assert len(input_shape) == 2
        input_dim = input_shape[1]
        self.input_spec = [InputSpec(dtype=K.backend.floatx(),
                                     shape=(None, input_dim))]
        
        self.W = K.backend.variable(self.initial_weights) 
        self.trainable_weights = [self.W]

layerwise pretrain and Finetuning autoencoder works fine on the test example (mnist), but then Initializing cluster centres with k-means. crushes with an error message:

self.trainable_weights = K.backend.variable(self.initial_weights)

AttributeError: can't set attribute

What could be the reason for that??? Thanks in advance.

Normalized Mutual Information (NMI) and Generalizability (G)

Are there any plans to implement NMI and G metrics as outlined in the paper?

Looking at the original Caffe version of DEC, NMI is defined using sklearn.metrics.normalized_mutual_info_score. https://github.com/piiswrong/dec/blob/master/dec/dec.py#L701

As for G, it should be a straightforward division of training loss and validation loss.

I plan to use use this to play around with some clustering. If/when I do I'm happy to take a stab at it. Or if you have time to work on it before then that would be great too.

loss: nan

HI,

i have this value.
Any ideas?

Question: Unknown number of clusters?

Do you know if there have been any usage with an unknown number of clusters? Thanks for posting this btw! It makes a lot more sense looking at the code than interpreting math symbols for me.

The loss didn't converge to zero during fine-tunning in my own data.

DEC-Keras network is so wonderful for my data.

I changed the input as my data instead of mnist data.

The pre_trainning is so good.

But the loss value diverge to NaN during fine tunning.

I think that dynamic learning rate will be needed in fine tunning !

Could you suggest me the best method for applying dynamic learning rate.

Thank you in advance.

new dataset

Hi,
Great work! Thanks a lot.
I'm just wondering how I can use my own dataset here. I have a folder full of images that I want to be clustered.

Thanks!

Getting a 'initial_value must be specified' ValueError

Trying to load model for production predictions with the code:

from keras_dec import ClusteringLayer
from keras.models import load_model
model = load_model('./DEC.model', custom_objects={'ClusteringLayer': ClusteringLayer})
...

This is not working and producing:
ValueError: initial_value must be specified.
This error is referring to line #64 in keras_dec.py
What is the issue?

Multi GPU Support

This is a great implementation of DEC, would it be possible to add support for using multiple GPUs via Keras?

Wrong ending condition

Hi, thanks for sharing your code. It is very helpful. However, I thought I found an error in keras_dec.py:

                delta_label = ((y_pred == self.y_pred).sum().astype(np.float32) / y_pred.shape[0])
                if y is not None:
                    acc = self.cluster_acc(y, y_pred)[0]
                    self.accuracy.append(acc)
                    print('Iteration '+str(iteration)+', Accuracy '+str(np.round(acc, 5)))
                else:
                    print(str(np.round(delta_label*100, 5))+'% change in label assignment')

                if delta_label < tol:
                    print('Reached tolerance threshold. Stopping training.')
                    train = False
                    np.save("cluster_loss", np.asarray(cluster_loss))
                    continue

It should be != instead of == when it comes to delta_label, isn't it?

DeprecationWarning: linear_assignment_ module is deprecated

/usr/local/lib/python3.6/dist-packages/sklearn/utils/linear_assignment_.py:21: DeprecationWarning: The linear_assignment_ module is deprecated in 0.21 and will be removed from 0.23. Use scipy.optimize.linear_sum_assignment instead.
  DeprecationWarning)

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.