Comments (3)
im sorry i know that vj is like unit vector of 16 D
from capsnet-tensorflow.
You do not understand squashing correctly. Squashing ensures the length (euclidean norm) of its output vector is in [0, 1], not about the element in the vector. Have fun with the following code:
import numpy as np
from matplotlib import pyplot as plt
def squash(vector, axis=None):
norm = np.linalg.norm(vector, axis=axis, keepdims=True)`
norm_squared = np.square(norm)
scalar_factor = norm_squared / (1 + norm_squared)
return scalar_factor * (vector / norm)
#Create 10000 samples each with 3 elements
num_samples = 10000
c1 = np.random.uniform(size=(num_samples, 1))
c2 = np.random.normal(size=(num_samples, 1))
c3 = np.random.logistic(size=(num_samples, 1))
vectors = np.hstack((c1, c2, c3)) # [num_samples, 3]
squashed_vector = squash(vectors, axis=1)
length = np.sqrt(np.sum(np.square(squashed_vector), axis=1))
plt.plot(np.sort(length))
from capsnet-tensorflow.
Look "reduce_mean" function in utils.py carefully and also after this function is applied using axis=2, we are taking the mean of the sum of squared sum of vector so the range is not (-4, 4) it is (0, 1).
from capsnet-tensorflow.
Related Issues (20)
- Only 10% accuracy for scaled images!!!!! HOT 3
- reshape question
- a question HOT 1
- Question about num_outputs
- Train on different dataset HOT 7
- Using Caps-Net to Handle High-dimensional and Small-sample Problems HOT 1
- Baidu Link Not Working Correctly: Mirror?
- Cannot handle rotation ??? HOT 1
- English Version of Blog HOT 1
- Medical Imaging HOT 7
- Vector Length HOT 3
- About the routing biases HOT 2
- TypeError: 'numpy.ndarray' object is not callable!
- a quesion HOT 1
- about tensorflow c++
- about
- about a problem in gpu_version
- How to save model in SavedModel or frozen_graph format?
- Cap
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capsnet-tensorflow.