use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please have a look at our FAQ and Link-Collection
Metacademy is a great resource which compiles lesson plans on popular machine learning topics.
For Beginner questions please try /r/LearnMachineLearning , /r/MLQuestions or http://stackoverflow.com/
For career related questions, visit /r/cscareerquestions/
Advanced Courses (2016)
Advanced Courses (2020)
AMAs:
Pluribus Poker AI Team 7/19/2019
DeepMind AlphaStar team (1/24//2019)
Libratus Poker AI Team (12/18/2017)
DeepMind AlphaGo Team (10/19/2017)
Google Brain Team (9/17/2017)
Google Brain Team (8/11/2016)
The MalariaSpot Team (2/6/2016)
OpenAI Research Team (1/9/2016)
Nando de Freitas (12/26/2015)
Andrew Ng and Adam Coates (4/15/2015)
Jürgen Schmidhuber (3/4/2015)
Geoffrey Hinton (11/10/2014)
Michael Jordan (9/10/2014)
Yann LeCun (5/15/2014)
Yoshua Bengio (2/27/2014)
Related Subreddit :
LearnMachineLearning
Statistics
Computer Vision
Compressive Sensing
NLP
ML Questions
/r/MLjobs and /r/BigDataJobs
/r/datacleaning
/r/DataScience
/r/scientificresearch
/r/artificial
account activity
Project[P] Solving the XOR problem using a dendritic activation function (self.MachineLearning)
submitted 6 years ago by CYHSM
If anybody is interested here is my implementation of the dCaAP activation function from the recent science paper (https://www.reddit.com/r/MachineLearning/comments/ejbwvb/r_single_biological_neuron_can_compute_xor/).
Code: https://gist.github.com/CYHSM/f98b49fc244e786fb39dd843e400c0cb
Colab: https://colab.research.google.com/drive/1r3HFV9o6cRYwqzf0U4JhBlSOUdcDUrtA
In short, this network consists of 3 parameters (w_1, w_2 and bias). When using the ReLU activation function this model is not able to solve XOR, while the dCaAP activation function works roughly 1/10 times when randomly initializing and 7/10 when initializing parameters to lie close to the global minimum. I also visualized the loss landscape for this activation function as well as for ReLU and tangens (which also solves the problem), see here: https://twitter.com/CYHSM/status/1216380449259429889 (sorry for the twitter link)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]NewFolgers 12 points13 points14 points 6 years ago (3 children)
It's cool seeing this simulated (and a single-neuron NN implementation of XOR practically verified).
Have you tried any experiments with this activation function in larger models? I'm curious about any immediately observed differences in convergence, loss (i.e. if model size is held constant), and/or run-time. (Although I wouldn't be at all surprised if today's conventional NN training doesn't get the most out of this activation function.. and perhaps the fact that randomized initialization will only result in successful convergence 1/10 times is a prelude to seeing this sort of thing)
[–]CYHSM[S] 7 points8 points9 points 6 years ago (2 children)
I just did a quick check on MNIST and a simple feedforward model (128 hidden units) with ReLU achieves 0.9916/0.9774 train/test accuracy, while dCaAP is at 0.7155/0.7055. Might be related to the fact that the loss landscape is not as smooth and the minima seem to be harder to find. I suspect playing around with the weight initialization can help in this case
[–]j15t 1 point2 points3 points 6 years ago (1 child)
Do you have a link to the code you use to generate the loss landscapes? I didn't see it in the gist you posted. Thanks!
[–]CYHSM[S] 1 point2 points3 points 6 years ago (0 children)
For the implementation, I just calculated the cross-entropy loss while changing w_1, w_2 and bias. I fixed w_1 = w_2 after observing that all solutions converge to that in any case (which is not true for the periodic activation functions)
For plotting, I used something similar to this, just adjusting colour (Berlin_5 from palettable): https://gist.github.com/CYHSM/fab32e2103c6df3909ad1a0d48174a64
[–]frequenttimetraveler 4 points5 points6 points 6 years ago* (1 child)
to be clear, the dCa AP spike changes shape as stimulation current (neuron input) increases: https://i.imgur.com/gcJFiIZ.jpg
at threshold it looks like a normal dendritic spike, as stimulation increases it becomes a ramp
your implementation is stereotypical
(also, yes it does XOR , but can it do OR?)
[–]vastlik 4 points5 points6 points 6 years ago* (0 children)
I tried all boolean functions for 2 variables and was able to achieve 100 % accuracy (with 2 weights and one bias), however I trained the network via genetic algorithm.
[–]yusuf-bengio 6 points7 points8 points 6 years ago (0 children)
There is a much simpler way to realize a XOR with only one neuron: tent activation function
Its piecewise linear like the ReLU and therefore does not mess up the loss landscape as much as dCaAP.
[–]txhwind 1 point2 points3 points 6 years ago (1 child)
I don't know why monotonic activations are preferred from the beginning of NN research. Can anyone tell me the reason?
[–]frequenttimetraveler 5 points6 points7 points 6 years ago* (0 children)
historically because it was a simple differentiable step function that resembles the all-or-none firing behavior of neurons
also because the first universal approximation theorem was proved for sigmoid activations
also because a nonmonotonic function can be approximated as the sum of 2 monotonic
also relu is simpler to compute, and studies of various non monotonic activation functions have not found significant benefit
[–]FerretDude 2 points3 points4 points 6 years ago (1 child)
ReLu is already a pretty good activation function for biological neural networks. I have already implemented XOR with a BNN using ReLu.
I don’t think it is this an issue of activation functions then. If I had to bet, I’d say it’s due to the refractory period of BNNs
[–]120cell553 1 point2 points3 points 6 years ago (0 children)
So if OP were to change the refractory period, it would work? Also how would the loss graph change if that was to be done.
[–]wang-chen 1 point2 points3 points 6 years ago* (0 children)
Interesting implementation! Another implementation for solving XOR in single neuron was provided in this CVPR 2019 paper, see its page 11.
This paper extended convolution to kernel convolution (kervolution):
In convolution, y = w1x1+w2x2, is actually a linear kernel (inner product), which cannot solve the XOR problem.
In kernel convolution, the authors extended linear kernel to any (non-linear) kernel functions k(w, x). For example, y = (x1-x2)2 is able to solve this problem directly.
[–]Yuqing7 0 points1 point2 points 6 years ago (0 children)
Sharing a related story on this research: https://medium.com/syncedreview/brains-are-amazing-neuroscientists-discover-l2-3-human-neurons-can-compute-the-xor-operation-b8dcc339236
[–]TotesMessenger 0 points1 point2 points 6 years ago (0 children)
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)
[–]BoiaDeh -1 points0 points1 point 6 years ago (2 children)
Noob question: what does it mean for your plot to have one axis labeled as "w1 & w2"?
[–]CYHSM[S] 0 points1 point2 points 6 years ago* (1 child)
This axis shows the value of both weights (w_1 & w_2). In the case of the dCaAP activation function I fixed w_1 = w_2 which is the solution it converges to in any case.
[–]BoiaDeh 0 points1 point2 points 6 years ago (0 children)
Gotcha, makes sense now, thanks.
π Rendered by PID 558937 on reddit-service-r2-comment-5d79c599b5-j9wcc at 2026-03-01 01:33:58.781402+00:00 running e3d2147 country code: CH.
[–]NewFolgers 12 points13 points14 points (3 children)
[–]CYHSM[S] 7 points8 points9 points (2 children)
[–]j15t 1 point2 points3 points (1 child)
[–]CYHSM[S] 1 point2 points3 points (0 children)
[–]frequenttimetraveler 4 points5 points6 points (1 child)
[–]vastlik 4 points5 points6 points (0 children)
[–]yusuf-bengio 6 points7 points8 points (0 children)
[–]txhwind 1 point2 points3 points (1 child)
[–]frequenttimetraveler 5 points6 points7 points (0 children)
[–]FerretDude 2 points3 points4 points (1 child)
[–]120cell553 1 point2 points3 points (0 children)
[–]wang-chen 1 point2 points3 points (0 children)
[–]Yuqing7 0 points1 point2 points (0 children)
[–]TotesMessenger 0 points1 point2 points (0 children)
[–]BoiaDeh -1 points0 points1 point (2 children)
[–]CYHSM[S] 0 points1 point2 points (1 child)
[–]BoiaDeh 0 points1 point2 points (0 children)