Giter VIP home page Giter VIP logo

Comments (4)

qichaozhao avatar qichaozhao commented on June 30, 2024

Update, running it on the THEANO backend with an older version of Keras seems to bring much better results... I guess I will have to keep digging as to where the differences are coming from!

from py_crepe.

liufuyang avatar liufuyang commented on June 30, 2024

I seem to encounter the same problem, basically using the same code and fix a few minor place to be able to run on python 3, but the loss is not reducing and acc stays at 0.25

from py_crepe.

liufuyang avatar liufuyang commented on June 30, 2024

Saw discussion from another issue post, basically you seem to have to use RandomNormal as mentioned here https://keras.io/initializers/, instead of using the default glorot_uniform
Just to add it in all the convolution layers like this

initializer = RandomNormal(mean=0.0, stddev=0.05, seed=None)
...
conv = Convolution1D(nb_filter=nb_filter, filter_length=filter_kernels[0], kernel_initializer=initializer,
                         border_mode='valid', activation='relu',
                         input_shape=(maxlen, vocab_size))(inputs)

Initialization matters !!!

from py_crepe.

ayrtondenner avatar ayrtondenner commented on June 30, 2024

I finished running the neural network with ag_news set, using Keras version 2.1.5, Python 3.6.5, and I couldn't get Theano version, it seems it isn't installed. Doing it without any initializer in convolution layer, my network managed to get between 87%~92% of accuracy

Epoch: 8
  Step: 100
        Loss: 0.2301556259393692. Accuracy: 0.9221250146627427
  Step: 200
        Loss: 0.23537617575377226. Accuracy: 0.9201875126361847
  Step: 300
        Loss: 0.23534504453341165. Accuracy: 0.9205833458900452
  Step: 400
        Loss: 0.23604939280077816. Accuracy: 0.9202500122785569
  Step: 500
        Loss: 0.23330221936106682. Accuracy: 0.9211000119447708
  Step: 600
        Loss: 0.2331778311356902. Accuracy: 0.9213541778922081
  Step: 700
        Loss: 0.2310873696208. Accuracy: 0.9223928680590221
  Step: 800
        Loss: 0.23309540571644902. Accuracy: 0.9215625112503767
  Step: 900
        Loss: 0.23280121087200112. Accuracy: 0.9213472335868411
  Step: 1000
        Loss: 0.234288040317595. Accuracy: 0.9208625118732452
  Step: 1100
        Loss: 0.23586858349090273. Accuracy: 0.9205227390744469
  Step: 1200
        Loss: 0.2381015682592988. Accuracy: 0.9195833456019561
  Step: 1300
        Loss: 0.2377806937465301. Accuracy: 0.9194711661338806
  Step: 1400
        Loss: 0.2373836720788053. Accuracy: 0.9197500126702445
  Step: 1500
        Loss: 0.23760153172910214. Accuracy: 0.9196000128587087
Epoch 8. Loss: 0.3596184071741606. Accuracy: 0.8811842416462146
Epoch time: 0:07:20.014854. Total time: 1:08:38.125534

Epoch: 9
  Step: 100
        Loss: 0.21075385928153992. Accuracy: 0.9301250070333481
  Step: 200
        Loss: 0.21289151340723036. Accuracy: 0.9299375078082085
  Step: 300
        Loss: 0.21473157433172066. Accuracy: 0.9292916737000148
  Step: 400
        Loss: 0.21344165759161116. Accuracy: 0.9293750070035458
  Step: 500
        Loss: 0.21545475232601166. Accuracy: 0.9288500069379807
  Step: 600
        Loss: 0.21487088636805615. Accuracy: 0.9284791740775108
  Step: 700
        Loss: 0.21380332414593015. Accuracy: 0.9287678642783846
  Step: 800
        Loss: 0.21491042390465737. Accuracy: 0.9276875076442956
  Step: 900
        Loss: 0.21594439257350234. Accuracy: 0.9273194525639216
  Step: 1000
        Loss: 0.21687575853615998. Accuracy: 0.9271750084161758
  Step: 1100
        Loss: 0.21711503727869555. Accuracy: 0.9269545538858934
  Step: 1200
        Loss: 0.21854913759355743. Accuracy: 0.9265833417574565
  Step: 1300
        Loss: 0.21921507142484187. Accuracy: 0.9262211626768112
  Step: 1400
        Loss: 0.21991488710578. Accuracy: 0.9260446515253612
  Step: 1500
        Loss: 0.21934504335621993. Accuracy: 0.9262916754086812
Epoch 9. Loss: 0.3565275182849483. Accuracy: 0.8784210826221265
Epoch time: 0:07:19.129080. Total time: 1:16:13.310350

from py_crepe.

Related Issues (9)

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.